Difference between revisions of "Messagebox Tutorial/Set Variables"
no edit summary
imported>Haama |
imported>Haama |
||
Line 59: | Line 59: | ||
return | return | ||
endif</pre> | endif</pre> | ||
If you want to use minimums and/or maximums for the variable, you'll need to run checks at a few key locations. To cover all of the '''''-10''''', '''''-5''''', '''''+5''''', '''''+10''''' options place the check right before the [[MessageBox]] function. You have 2 options for the other, variable-changing options ('''''-2''''', '''''-1''''', '''''+1''''', '''''+2'''''): | If you want to use minimums and/or maximums for the variable, you'll need to run checks at a few key locations. To cover all of the '''''-10''''', '''''-5''''', '''''+5''''', '''''+10''''' options place the check right before the [[MessageBox]] function, as such: | ||
*Place the check(s) inside each of those '''''Choice''''' sections | <pre> elseif (Choosing == -22) | ||
if (NumNewIngsDefault < 0) | |||
set NumNewIngsDefault to 0 | |||
endif | |||
messagebox "Set the default number of essences to be created. | |||
(Currently %g)", NumNewIngsDefault, | |||
...</pre> | |||
You have 2 options for the other, variable-changing options ('''''-2''''', '''''-1''''', '''''+1''''', '''''+2'''''): | |||
*Place the check(s) inside each of those '''''Choice''''' sections, as such: | |||
<pre> elseif (Choice == 2) ;-2 | |||
set NumNewIngsDefault to (NumNewIngsDefault - 2) | |||
if (NumNewIngsDefault < 0) | |||
set NumNewIngsDefault to 0 | |||
endif | |||
set Choosing to -21 | |||
return</pre> | |||
*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: | *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) | <pre> elseif (Choosing == -21) |