Special Case: Prereqs
The context of a prereq or an exprreq is the container (either the hero or the gizmo) that this item is being added to (or is currently in, if the user has selected this item). This is different from the eval scripts, where the initial context is the pick that the script is running on.
In a prereq or an exprreq, there are some special instructions and special transitions that are available, and there are some restrictions on what you'll be able to accomplish.
Questions you can ask
- @ispick
- You can only use this by itself
- It's a TRUE/FALSE test - it will return 1 if this has been added to the character and 0 if it's still in the list of things to test.
Operations you can perform
(these can either look up the current value of this special operator, or you can change its value)
- @valid
- You can only use this by itself
- This stores whether the prereq has failed or not.
- At the beginning of a prereq script, it is already set to 0.
- To make the prereq succeed, set it to 1 (or any other value that's not 0).
Places you can travel
- altthing & altpick
- These travel to the pick the prereq is actually on - remember that the initial context for a prereq is the container. That differs from the initial context of an eval script, which is the pick. So, if you need to look up information on the pick for a prereq
- If @ispick = 0, you must use altthing to travel to the pick. If @ispick = 1, you must use altpick.
Here's how altthing and altpick are used in practice:
Code:
if (@ispick <> 0) then
altpick.something
else
altthing.something
endif
the .something is the same in each branch.