Parameters / Action 7

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

Moderator: Graphics Moderators

Post Reply
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Parameters / Action 7

Post by andythenorth »

I am having a little (big) trouble with parameters and action 7.

The intention is to use an action 7 to skip a sprite if the parameter value doesn't match x (in this case x = 2, but that's not significant)

This code doesn't work (checking param 0 as a dword - TTDPatch wiki says params are 4 bytes)

Code: Select all

  252 * 9	 07 \b00 04 \7! \d02 \b01 // skip one action, if the parameter doesn't match.
Nor does this (checking param 0 as a byte).

Code: Select all

  252 * 9	 07 \b00 01 \7! \b02 \b01 // skip one action, if the parameter doesn't match.
In both cases, the value of the first parameter is set to 2 in the newgrf gui window.

This however does work (setting the value of param 0 with an action D)

Using the action D is just a test to prove that the action 7 is not fundamentally wrong.

Code: Select all

  251 * 9	 0D \b00 \D= FF FF \d02 // force the value of param 0 to be 2 
  252 * 9	 07 \b00 04 \7! \d02 \b01 // skip one action, if the parameter doesn't match.
So the problem appears to be isolated to reading a parameter set by the player.

I'm sure I'm doing something stupid :roll:

cheers,

Andy
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1680
Joined: 04 Mar 2005 01:07

Re: Parameters / Action 7

Post by OzTrans »

...
Last edited by OzTrans on 04 Feb 2012 00:50, edited 1 time in total.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Parameters / Action 7

Post by PikkaBird »

Action 7 is only executed during GRF activation, so setting the parameter in a running game will not work.

Alternatively, make sure there's no Action D setting the parameter further up in the GRF. ;)
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Parameters / Action 7

Post by andythenorth »

PikkaBird wrote:Alternatively, make sure there's no Action D setting the parameter further up in the GRF. ;)
That was it. Sorted now, thanks.

Collaborative development with one author unavoidably out of contact...these things happen :D
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Parameters / Action 7

Post by DaleStan »

OzTransLtd wrote:I'm sorry, I only speak NFO
That is NFO. Or, at least, so say both NFORenum and GRFCodec.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 27 guests