Difference between revisions of "Messagebox Tutorial/Set Variables"

Removed returns, minor edits
imported>Haama
(Added Generalization disclaimer)
imported>Haama
(Removed returns, minor edits)
if (Choice == -1)
set Choice to GetButtonPressed
return
elseif (Choice == 0) ;10 fewer
set NumNewIngsDefault to (NumNewIngsDefault - 10)
set Choosing to -22
return
elseif (Choice == 1) ;5 fewer
set NumNewIngsDefault to (NumNewIngsDefault - 5)
set Choosing to -22
return
elseif (Choice == 7) ;5 more
set NumNewIngsDefault to (NumNewIngsDefault + 5)
set Choosing to -22
return
elseif (Choice == 8) ;10 more
set NumNewIngsDefault to (NumNewIngsDefault + 10)
set Choosing to -22
return
elseif (Choice == 2) ;-2
set NumNewIngsDefault to (NumNewIngsDefault - 2)
set Choosing to -21
return
elseif (Choice == 3) ;-1
set NumNewIngsDefault to (NumNewIngsDefault - 1)
set Choosing to -21
return
elseif (Choice == 4) ;Cancel
set Choosing to -21
return
elseif (Choice == 5) ;+1
set NumNewIngsDefault to (NumNewIngsDefault + 1)
set Choosing to -21
return
elseif (Choice == 6) ;+2
set NumNewIngsDefault to (NumNewIngsDefault + 2)
set Choosing to -21
return
elseif (Choice == 9) ;Return to previous menu
set Choosing to -2
return
endif
...</pre>
(Currently %g)", NumNewIngsDefault,
...</pre>
You have 2a few options for the other, variable-changing options ('''''-2''''', '''''-1''''', '''''+1''''', '''''+2'''''):
*Place the check(s) inside each of those '''''Choice''''' sections, as such:
<pre>...
endif
set Choosing to -21
return
...</pre>
*Place the check(s) right after all of the '''Choices''':
*Place the check(s) in a menu that all of them run through. In this case, all of these '''''Choice'''''s run through '''''Choosing == -21''''', so all of the checks(s) can be placed immediately before the [[MessageBox]] function of that menu, as such:
<pre>...
elseif (Choosing == -21)
Anonymous user