YesNoOk
avatar

IsHelper (Triggers) (Read 5453 times)

Started by Ricepigeon, September 14, 2015, 07:03:39 pm
Share this topic:
IsHelper (Triggers)
New #1  September 14, 2015, 07:03:39 pm
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
This trigger takes an optional ID number as an argument. If the ID number is omitted, IsHelper returns 1 if the player is a helper character, and 0 otherwise. If the ID number is included, then IsHelper returns 1 if the player is a helper character with the specified ID number, and 0 otherwise.

Format:
        IsHelper
        IsHelper(exprn)

Arguments:
    none
Return type:
    boolean int (1 or 0)
Error conditions:
    Returns bottom if exprn evaluates to bottom.

Examples:
Code:
1. trigger1 = !IsHelper
  Triggers if the player is not a helper-type character.
2. trigger1 = IsHelper(1234)
  Triggers if the player is a helper character with ID number 1234.

Additional Notes:
The second format's "exprn" argument is equivalent to the ID parameter of the Helper SCTRL, which defaults to 0 if omitted. Thus, when a helper calls this trigger, the "exprn" argument is compared to its internal ID parameter that was assigned to it by the Helper SCTRL. For instance, a helper created with the following Helper controller:
Code:
[State 2000, Helper]
type = Helper
...
ID = 2010

... executes the following lines of code:

Code:
trigger1 = ishelper
trigger2 = ishelper(2010)
trigger3 = ishelper(4010)

In these instances;
  • Trigger1 will return true, since no argument was to the trigger, it will simply check whether or not the caller is a helper.
  • Trigger2 will also return true, since 2010 is passed as an argument to the trigger, which is compared to the ID parameter of 2010 that we assigned in the Helper SCTRL.
  • Trigger3 returns false, as 4010 is passed as an argument to the trigger, and is not equal to the ID parameter of 2010 that we assigned earlier.

Last Edit: September 18, 2015, 02:51:13 pm by Just No Point