Have effect

From Kolmafia
Revision as of 15:25, 13 March 2010 by imported>Heeheehee (Question!)
Jump to navigation Jump to search

Function Syntax

int have_effect(effect have_effect )

  • have_effect is an effect to check for

Returns the number of turns for which you currently have_effect. Returns 0 if you do not have any turns of have_effect. If the effect is an intrinsic that you currently have, this function returns 2147483547 (which is 100 less than a signed integer's upper limit).

Code Sample

The following casts Disco Aerobics if you have less than 10 turns Disco State of Mind & have the skill.

//This would normally be better handled with a mood, and is for illustration only
if ((have_effect($effect[Disco State of Mind]) < 10) && have_skill($skill[Disco Aerobics]))
   use_skill(1 , $skill[Disco Aerobics]);

CLI Equivalent

The CLI command "effects" gives information on all of your current effect durations.

See Also

have_skill() | use_skill()


Attention KoLmafia Experts!

We need your help; some details of this function's operation are unknown or unclear.

The following specific questions have been raised:

  • Why 100 less than signed int limit?
  • How does this work for effects that are available as both intrinsic and extrinsic (i.e. Temporary Blindness, Teleportitis)?