User Tools

Site Tools


set

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
set [2013/12/18 04:07]
l
set [2017/10/09 20:39] (current)
Line 39: Line 39:
 | /=          | 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''​ |
  
 +====Multiple operations in one <<​set>>​ ====
 +
 +When you have multiple <<​set>>​ macro tags next to one another, you can replace them with a shorthand that uses only one <<​set>>​. Simply take the operations in each instance, and join them together using either commas or semicolons.
 +For instance, these three macro tags:
 +<​code><<​set $pants = "​large">>​
 +<<set $shoes = "​huge">>​
 +<<set $spats = "​classy">></​code>​
 +...can be changed to just this:
 +<​code><<​set $pants = "​large";​ $shoes = "​huge";​ $spats = "​classy">></​code>​
 ====A note about <<​set>>​ and links==== ====A note about <<​set>>​ and links====
  
Line 51: Line 60:
 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 <<set $lamp to "​blue">>​ tag to not have happened. 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 <<set $lamp to "​blue">>​ tag to not have happened.
  
-To achieve the desired effect in the above passage, you should ​do the following:+To achieve the desired effect in the above passage, you should ​use [[link|setter links]]:
 <​code>​ <​code>​
 [[The lamp is red][$lamp = "​red"​]] [[The lamp is red][$lamp = "​red"​]]
 [[The lamp is blue][$lamp = "​blue"​]] [[The lamp is blue][$lamp = "​blue"​]]
 </​code>​ </​code>​
set.1387357632.txt.gz ยท Last modified: 2017/10/09 20:37 (external edit)