set

# Differences

This shows you the differences between two versions of the page.

 set [2013/12/17 20:52]l set [2013/12/24 01:39]l [A note about <> and links] Both sides previous revision Previous revision 2014/07/15 23:11 l [Setter operators] 2013/12/24 01:39 l [A note about <> and links] 2013/12/18 04:07 l 2013/12/17 20:52 l 2013/12/17 20:04 l 2013/12/17 20:03 l created Next revision Previous revision 2014/07/15 23:11 l [Setter operators] 2013/12/24 01:39 l [A note about <> and links] 2013/12/18 04:07 l 2013/12/17 20:52 l 2013/12/17 20:04 l 2013/12/17 20:03 l created Next revision Both sides next revision Line 38: Line 38: | *=          | Multiplies the variable on the left by the number on the right. ''​\$var *= 2''​ is shorthand for ''​\$var to \$var * 2'' ​        | ''​\$shields *= 2''​ | | *=          | Multiplies the variable on the left by the number on the right. ''​\$var *= 2''​ is shorthand for ''​\$var to \$var * 2'' ​        | ''​\$shields *= 2''​ | | /=          | Divides the variable on the left by the number on the right. ''​\$var /= 2''​ is shorthand for ''​\$var to \$var / 2'' ​        | ''​\$coins /= 2''​ | | /=          | Divides the variable on the left by the number on the right. ''​\$var /= 2''​ is shorthand for ''​\$var to \$var / 2'' ​        | ''​\$coins /= 2''​ | + + ====A note about <<​set>>​ and links==== + + It is easy to assume that the placement of links in a passage has some bearing on what the game's variable state will be once you click it: + <​code>​ + /% The following code is ineffectual %/ + <>​ + [[The lamp is red]] + <>​ + [[The lamp is blue]] + ​ + But this is erroneous! All of these [[<<​set>>​]] macros are run as soon as the passage is displayed, in order. Clicking the "The lamp is red" link won't cause the <>​ tag to not have happened. + + To achieve the desired effect in the above passage, you should use [[link|setter links]]: + <​code>​ + [[The lamp is red][\$lamp = "​red"​]] + [[The lamp is blue][\$lamp = "​blue"​]] +