Have effect: Difference between revisions
imported>StDoodle Created page with '{{#vardefine:name|have_effect}} {{#vardefine:return_type|int}} {{FunctionPage| name={{#var:name}}| function_category=Skills and Effects| function1={{Function| name={{#var:name}…' |
imported>Heeheehee Basis for RFI no longer valid, apparently. |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{#vardefine:name|have_effect}} | {{ | ||
{{#vardefine:return_type|int}} | #vardefine:name|have_effect}}{{ | ||
#vardefine:return_type|int}}{{ | |||
FunctionPage| | |||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 15: | Line 15: | ||
}}| | }}| | ||
function_description=Returns the number of turns for which you currently {{pspan|have_effect}}. Returns 0 if you do not have any turns of {{pspan|have_effect}}. If the effect is an intrinsic that you currently have, this function returns 2147483547 (which is 100 less than | function_description=Returns the number of turns for which you currently {{pspan|have_effect}}. Returns 0 if you do not have any turns of {{pspan|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).| | ||
code1={{CodeSample| | code1={{CodeSample| | ||
Line 25: | Line 25: | ||
if ((have_effect($effect[Disco State of Mind]) < 10) && have_skill($skill[Disco Aerobics])) | if ((have_effect($effect[Disco State of Mind]) < 10) && have_skill($skill[Disco Aerobics])) | ||
use_skill(1 , $skill[Disco Aerobics]); | use_skill(1 , $skill[Disco Aerobics]); | ||
</syntaxhighlight>}}| | </syntaxhighlight> | ||
}}| | |||
see_also={{SeeAlso|have_skill|use_skill}}| | see_also={{SeeAlso|have_skill|use_skill}}| | ||
cli_equiv=The CLI command "effects" gives information on all of your current effect durations.| | cli_equiv=The CLI command "effects" gives information on all of your current effect durations.| | ||
special=Note that in KoL, having an effect from both an intrinsic and turn-limited source will only report the intrinsic (infinite) duration while active, and as such this function will return 2147483647 (Java's Integer.MAX_VALUE) when you are under an effect from both types of sources. | |||
}} | }} | ||
[[Category:Skills and Effects]] |
Latest revision as of 04:01, 7 May 2013
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
Special
Note that in KoL, having an effect from both an intrinsic and turn-limited source will only report the intrinsic (infinite) duration while active, and as such this function will return 2147483647 (Java's Integer.MAX_VALUE) when you are under an effect from both types of sources.