vector DestinationPos;
rotation DestinationRot;
default
{
state_entry()
{
llListen(1,"",llGetOwner(),""
;
vector DestinationPos = llGetPos();
rotation DestinationRot = llGetRot();
}
listen(integer channel, string name, key id, string message)
{
if (llToLower(message) == "store"
{
vector DestinationPos = llGetPos();
rotation DestinationRot = llGetRot();
llSay(0, "Position stored at " + (string)DestinationPos);
}
if (llToLower(message) == "reset"
{
llSetStatus(STATUS_PHYSICS, FALSE);
llSetStatus(STATUS_PHANTOM, TRUE);
llSetAlpha(0.4, -1);
llSetPos(DestinationPos);
llSetRot(DestinationRot);
llSay(0, "Position reset to " + (string)DestinationPos);
llSleep(1);
llSetStatus(STATUS_PHYSICS, TRUE);
llSetStatus(STATUS_PHANTOM, FALSE);
llSetAlpha(1, -1);
}
if (llToLower(message) == "clear"
{
llSay(0, "Cleared."
;
llDie();
}
}
}
rotation DestinationRot;
default
{
state_entry()
{
llListen(1,"",llGetOwner(),""
;vector DestinationPos = llGetPos();
rotation DestinationRot = llGetRot();
}
listen(integer channel, string name, key id, string message)
{
if (llToLower(message) == "store"
{vector DestinationPos = llGetPos();
rotation DestinationRot = llGetRot();
llSay(0, "Position stored at " + (string)DestinationPos);
}
if (llToLower(message) == "reset"
{llSetStatus(STATUS_PHYSICS, FALSE);
llSetStatus(STATUS_PHANTOM, TRUE);
llSetAlpha(0.4, -1);
llSetPos(DestinationPos);
llSetRot(DestinationRot);
llSay(0, "Position reset to " + (string)DestinationPos);
llSleep(1);
llSetStatus(STATUS_PHYSICS, TRUE);
llSetStatus(STATUS_PHANTOM, FALSE);
llSetAlpha(1, -1);
}
if (llToLower(message) == "clear"
{llSay(0, "Cleared."
;llDie();
}
}
}
The problem is, when I try the resetting command, it thinks my "DestinationPos" and "DestinationRot" variables are the default 0...s, even though I set them with both the store command and in state_entry. They are supposed to be global variables, right? How are they being wiped clean?