Difference between revisions of "Trigger"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
(Changed in r10025)
imported>Winterbay
(Add example of unconditional trigger to make the extra comma more obvious)
Line 6: Line 6:
 
* Parameters for adding a trigger are: [type,] effect [, action]
 
* Parameters for adding a trigger are: [type,] effect [, action]
 
** Possible types are gain_effect, lose_effect, unconditional
 
** Possible types are gain_effect, lose_effect, unconditional
** For an unconditional trigger, the effect is ignored and may be left blank, but you still need commas around that place-holder.  
+
** For an unconditional trigger, the effect is ignored and may be left blank, but you still need commas around that place-holder, see below.
 
** action is CLI command to be executed when that condition is fulfilled
 
** action is CLI command to be executed when that condition is fulfilled
  
 
For example, you can tell your mood to auto-olfact Goth Giants whenever you lose the effect "On the Trail", like this:
 
For example, you can tell your mood to auto-olfact Goth Giants whenever you lose the effect "On the Trail", like this:
 
:<pre>trigger lose_effect, On the Trail, olfact monster Goth Giant</pre>
 
:<pre>trigger lose_effect, On the Trail, olfact monster Goth Giant</pre>
 +
 +
Example of an unconditional trigger to abort adventuring when a hunter brain has been found that you can eat:
 +
:<pre>trigger unconditional, , ashq if(item_amount($item[hunter brain]) > 0 && my_fullness() < fullness_limit()) {abort();}
  
  

Revision as of 15:04, 29 September 2012

This is a CLI command to add triggers to your mood, or remove all triggers.

  • trigger clear will remove all triggers from your mood
  • trigger autofill will add triggers for all your buffing skills. This could be troublesome if you have Flavour of Magic since it will add triggers for all 5 elemental types.
  • Parameters for adding a trigger are: [type,] effect [, action]
    • Possible types are gain_effect, lose_effect, unconditional
    • For an unconditional trigger, the effect is ignored and may be left blank, but you still need commas around that place-holder, see below.
    • action is CLI command to be executed when that condition is fulfilled

For example, you can tell your mood to auto-olfact Goth Giants whenever you lose the effect "On the Trail", like this:

trigger lose_effect, On the Trail, olfact monster Goth Giant

Example of an unconditional trigger to abort adventuring when a hunter brain has been found that you can eat:

trigger unconditional, , ashq if(item_amount($item[hunter brain]) > 0 && my_fullness() < fullness_limit()) {abort();}


There can be no other command following trigger on a line. This is so that you can use a semi-colon to enable a multiple actions with a trigger like this:

<pre>trigger lose_effect, Form of...Bird!, gong bird;use 5 yummy death watch beetle