Difference between revisions of "Initiative modifier"
Jump to navigation
Jump to search
imported>Grotfang |
imported>Grotfang m |
||
Line 10: | Line 10: | ||
return_also={{#var:return_also}} | return_also={{#var:return_also}} | ||
}}| | }}| | ||
− | function_description=Returns your current percentage initiative modifier in the form of a float| | + | function_description=Returns your current percentage initiative modifier in the form of a float.| |
code1={{CodeSample| | code1={{CodeSample| | ||
title=Code Samples| | title=Code Samples| | ||
− | description= | + | description=Checks to see whether your initiative modifier is positive.| |
code= | code= | ||
<syntaxhighlight> | <syntaxhighlight> | ||
boolean positive_initiative() | boolean positive_initiative() | ||
{ | { | ||
− | + | if(initiative_modifier() < 0) | |
− | + | { | |
− | + | return false; | |
− | + | } | |
+ | return true; | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
}}| | }}| | ||
code2={{CodeSample| | code2={{CodeSample| | ||
− | description=Uses your initiative result to determine whether it will adventure in the sewers (where a +60% initiative guarantees getting the jump). There is also a check for my_familiar() | + | description=Uses your initiative result to determine whether it will adventure in the sewers (where a +60% initiative guarantees getting the jump). There is also a check for my_familiar().| |
code= | code= | ||
<syntaxhighlight> | <syntaxhighlight> | ||
boolean first_yellow_ray() | boolean first_yellow_ray() | ||
{ | { | ||
− | + | if(initiative_modifier() >= 60) | |
− | + | { | |
− | + | if(my_familiar() == $familiar[he-boulder]) | |
− | + | { | |
− | + | adventure(1 , $location[A Maze of Sewer Tunnels]); | |
− | + | return true; | |
− | + | } | |
− | + | else | |
− | + | print("You should use the He-Boulder for this"); | |
− | + | } | |
− | + | else | |
− | + | print("Your initiative is too low"); | |
− | + | return false; | |
} | } | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 19:01, 28 February 2010
Function Syntax
float initiative_modifier()
Returns your current percentage initiative modifier in the form of a float.
Code Samples
Checks to see whether your initiative modifier is positive.
boolean positive_initiative()
{
if(initiative_modifier() < 0)
{
return false;
}
return true;
}
Uses your initiative result to determine whether it will adventure in the sewers (where a +60% initiative guarantees getting the jump). There is also a check for my_familiar().
boolean first_yellow_ray()
{
if(initiative_modifier() >= 60)
{
if(my_familiar() == $familiar[he-boulder])
{
adventure(1 , $location[A Maze of Sewer Tunnels]);
return true;
}
else
print("You should use the He-Boulder for this");
}
else
print("Your initiative is too low");
return false;
}
See Also
Special
When not logged in the function returns 0 (needs spading).