Difference between revisions of "MessageBox Tutorial/Centralized Decision Catching"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Haama
imported>JustinOther
m (Reverted edits by ReneCrawford1978 (talk) to last revision by Haama)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This is a subsection of the [[MessageBox Tutorial]], and uses [[MessageBox_Tutorial#Activator_Script|this script]] as a base. The following code may or may not require certain aspects of that script to work, however the information should prove useful for any script (it may take a bit of care to make it work, though).
----
For 99.9% of your menus, you won't need to differentiate the decision catching:
For 99.9% of your menus, you won't need to differentiate the decision catching:
<pre>  Elseif (Choosing == 1)
<pre>  If (Choosing == 0)
...
  Elseif (Choosing == 1)
     If (Choice == -1) ;No choice yet
     If (Choice == -1) ;No choice yet
       Set Choice to GetButtonPressed
       Set Choice to GetButtonPressed
      Return
    Elseif (Choice == 0)
...
...
   Elseif (Choosing == 2)
   Elseif (Choosing == 2)
     If (Choice == -1) ;No choice yet
     If (Choice == -1) ;No choice yet
       Set Choice to GetButtonPressed
       Set Choice to GetButtonPressed
      Return
    Elseif (Choice == 0)
...</pre>
...</pre>


Line 16: Line 22:
   elseif (Choosing > 0) && (Choice == -1)
   elseif (Choosing > 0) && (Choice == -1)
     Set Choice to GetButtonPressed
     Set Choice to GetButtonPressed
     Return
...
  elseif (Choosing == 1)
     if (Choice == 0)
...
...
   elseif (Choosing == 2)
   elseif (Choosing == 2)
     if (Choice == 0) ;first choice, "Gold" in the example
     if (Choice == 0)
...
  elseif (Choosing == 3)
    if (Choice == 0) ;first choice, "25" in the example
</pre>
</pre>
*Editor's Note: This needs to be added to the [[MesssageBox Tutorial]]

Latest revision as of 06:22, 19 February 2013

This is a subsection of the MessageBox Tutorial, and uses this script as a base. The following code may or may not require certain aspects of that script to work, however the information should prove useful for any script (it may take a bit of care to make it work, though).


For 99.9% of your menus, you won't need to differentiate the decision catching:

  If (Choosing == 0)
...
  Elseif (Choosing == 1)
    If (Choice == -1) ;No choice yet
      Set Choice to GetButtonPressed
    Elseif (Choice == 0)
...
  Elseif (Choosing == 2)
    If (Choice == -1) ;No choice yet
      Set Choice to GetButtonPressed
    Elseif (Choice == 0)
...

To reduce the lines used, and to centralize the decision catching, try this instead:

  if (Choosing == 0)
...
  elseif (Choosing > 0) && (Choice == -1)
    Set Choice to GetButtonPressed
...
  elseif (Choosing == 1)
    if (Choice == 0)
...
  elseif (Choosing == 2)
    if (Choice == 0)