Posted Saturday, December 28, 2002 - 18:14 CET by Veldrin
Don Moar, Tools Programmer
Climbing Into Pits: We've I've done something similar in one of my modules. To achieve the effect, I use a trigger at the edge of some pit terrain in the Forest tileset. When the player crosses the trigger, a conversation is started in which the a description of the situation is presented and one of the player options is to "Climb down into the pit."
Scripting: Typically, oPC is a variable of type object but how it's used depends upon the event to which the script is assigned. If the script were assigned to the OnEnter event of a trigger, for example you'd probably have something like this:
object oPC;
oPC = GetEnteringObject();
Mark Brockington, Lead Research Scientist
STACK_UNDERFLOW Error: The inner script generates the STACK_UNDERFLOW, and passes the error to the outer script. The error is inside the script called from the ExecuteScript command.
break statements inside while loops can be problematic, especially since you've defined a variable inside the while loop before the break.
If you can, move the variable declaration out of the while loop, or do not use the break command. Are the problems with "break" statements and while loops being fixed in a future patch? Yes.
Do I know which patch? No. I hope that this helps.
On appearance, it may look like I've made an error. However, you've changed the code inside the while loop inside the faction_good_hb and faction_evil_hb scripts! Run your old faction_good_hb and faction_evil_hb scripts from the first post, and you'll see the problem still persists. This was the example from your first post (faction_good_hb).
while ( ... )
{
...
int nAlreadyChecked = GetLocalInt( ... )
if (nAlreadyChecked == TRUE)
{
break;
}
...
}
This causes an error, because the integer (represented by nAlreadyChecked) will be left behind on the stack if the break is run. This was the example from your second post.
while ( ... )
{
...
if (GetLocalInt( ... ) == TRUE)
{
break;
}
...
}
This works just fine, because you haven't created a new variable to store the result of the GetLocalInt check. Hope this helps!