Initiative modifier: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Grotfang
Conform to template
imported>Grotfang
No edit summary
Line 12: Line 12:
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=Positive Initiative Checker|
title=Code Samples|
description=Returns false if you have a negative initiative modifier|
description=Returns false if you have a negative initiative modifier|
code=
code=
Line 26: Line 26:
}}|
}}|
code2={{CodeSample|
code2={{CodeSample|
title=Yellow Ray Checker|
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(). The function will return true if it's a success, false otherwise.|
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(). The function will return true if it's a success, false otherwise.|
code=
code=
Line 49: Line 48:
}}|
}}|
see_also={{SeeAlso|my_familiar}}|
see_also={{SeeAlso|my_familiar}}|
cli_equiv=LIST_CLI_EQUIVALENT_INFO|
more_info=A_LINE_TO_NOTIFY_OF_EXTERNAL_INFO|
special=When not logged in the function returns 0 (needs spading).
special=When not logged in the function returns 0 (needs spading).
}}
}}

Revision as of 18:47, 28 February 2010


Function Syntax

float initiative_modifier()

Returns your current percentage initiative modifier in the form of a float

Code Samples

Returns false if you have a negative initiative modifier

boolean positive_initiative()
{
    if( initiative_modifier() < 0 )
        return false;
    else
        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(). The function will return true if it's a success, false otherwise.

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

my_familiar()

Special

When not logged in the function returns 0 (needs spading).