WhatPumpkin/Sburb-Legacy

Command: try

Closed this issue · 0 comments

Takes a trigger and runs tryToTrigger on it once.
syntax: trigger

Example:

<action command='try' name='Give Key.'>
 <args>
  <trigger>
   <args>gameState,hasKey=true</args>
   <action command='talk'>
    <args>@! You give the key</args>
   </action>
  </trigger>
 </args>
</action>

Obviously in this case the ability to do something "otherwise" would be handy. Possible constructs to accomplish this:

  • #126: in-trigger support for "else"
  • have the "follow up" of the "try" action be the else. If the trigger is successful it should in theory already overwrite the "try" action as curAction, meaning the followUp will only be evaluated should the trigger fail. Upon reflection this seems like the best solution, and might make #126 unnecessary for now.
  • have a second action/trigger in the args to function as the else/else-if. Could be handy, but might not be necessary.