Hey there! I’ve been wondering, is there a way to ‘increment’ a text value by one or more spaces left or right of it? Say for example this is a list of values for a set of scales:
Farthest left, far left, middle left, leaning left, balanced, leaning right, middle right, far right, farthest right.
And the default is ‘balanced’, would I be able to create a simple script so that if you put generic small items in one side or other it would slowly shunt along the scale? I can do it with a number and convert that into left or right, but I’m wondering if I could do it this way? Or should I use a table? The idea is that I can then just print the value to the game window without making a huge long ‘to say’ list to translate it.
No problem–define your values as a kind of value, and then you can use “the [value] after” as described in Writing with Inform §11.18:
[code]Orientation is a kind of value. The orientations are farthest left, far left, middle left, leaning left, balanced, leaning right, middle right, far right, farthest right.
Lab is a room. The scale is in the Lab. The scale has an orientation.
now the orientation of the scale is the orientation after the orientation of the scale; [this is a bit long-winded but it’s of the same form as Let X = X + 1]
say “The scale is now [orientation of the scale].”[/code]
Note that this will wrap around from farthest right to farthest left. If you want to keep it from wrapping around, you have to do a check to keep that from happening.
Thanks a lot! Do you know if there is a shorter way to do it as well, or is that the only way?