Extracting Position from Cargo Type Scope in NML

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
Aischri
Engineer
Engineer
Posts: 3
Joined: 28 Dec 2020 13:27

Extracting Position from Cargo Type Scope in NML

Post by Aischri »

Hi,

Basically what I'm trying to do is to find someway to change the return value of the profit callback of a cargo with respect to the cargo's delivery location. E.g. extra profit for transporting a cargo to a snowy mountain town or something like that. However I can't for the life of me think of anyway to do it. I'm still new to NML so is there something obvious I'm missing or is it impossible?

Thanks
User avatar
Andrew350
Chairman
Chairman
Posts: 768
Joined: 19 Dec 2011 07:54
Location: Washington State, USA
Contact:

Re: Extracting Position from Cargo Type Scope in NML

Post by Andrew350 »

No, it's not possible. You can change payment based on time and distance travelled, but there's no way to determine where on the map a cargo is delivered to.
Aischri
Engineer
Engineer
Posts: 3
Joined: 28 Dec 2020 13:27

Re: Extracting Position from Cargo Type Scope in NML

Post by Aischri »

Awww, that's a shame. Thank you though.
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5656
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Extracting Position from Cargo Type Scope in NML

Post by andythenorth »

I looked, there's no parent scope for cargo varaction 2.

That means the callback can only access the variables for the cargo, and those listed explicitly for the callback.

https://newgrf-specs.tt-wiki.net/wiki/V ... nalAction2

Cargo payment rates that can change (e.g. per town) would be a nice pony to have. I wouldn't expect it any time soon though :)
madrito
Engineer
Engineer
Posts: 37
Joined: 05 Jul 2018 15:38

Re: Extracting Position from Cargo Type Scope in NML

Post by madrito »

for example..
GScript ,,+ Subsidy ((Town)),, ≈ 3* profit
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 5 guests