OK, so I am trying to create hud that premtively grabs perms then sends out those perms when colliding with something.
I created step level testing for each phase, so far it works up until it needs to read the permissions. In the testing it says no perms detected even though perms were given.
Excuse my language I just find it funny when the object talks back
Hud Script:
list buttons = ["-", "Btn1", "Btn2", "Btn3"];
string dialogInfo = "\nPlease make a choice.";
key teleportee;
key ToucherID;
integer dialogChannel;
integer listenHandle;
default
{
// reset script when the object is rezzed
on_rez(integer start_param)
{
llResetScript();
}
changed(integer change)
{
// reset script when the owner or the inventory changed
if (change & (CHANGED_OWNER | CHANGED_INVENTORY))
llResetScript();
}
state_entry()
{
dialogChannel = -1 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) );
llRequestPermissions(llGetOwner(), PERMISSION_TELEPORT);
llGetOwner() == teleportee;
}
touch_start(integer num_detected)
{
ToucherID = llDetectedKey(0);
llListenRemove(listenHandle);
listenHandle = llListen(dialogChannel, "", ToucherID, "");
llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
llSetTimerEvent(60.0); // Here we set a time limit for responses
}
collision_start(integer num)
{
llSay(1642,"Pressed");
}
listen(integer channel, string name, key id, string message)
{
if (message == "-")
{
llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
return;
}
llListenRemove(listenHandle);
// stop timer since the menu was clicked
llSetTimerEvent(0);
if (message == "Btn1")
{
//listen to this specific channel
llListen(1641, "",NULL_KEY, "");
llSay(1640,"Pressed");
}
else if (message == "Btn2")
{
//listen to this specific channel
llListen(1641, "",NULL_KEY, "");
llSay(1643,"Pressed");
}
if (message == "Btn3")
{
//listen to this specific channel
llListen(1641, "",NULL_KEY, "");
llSay(1644,"Pressed");
}
else
{
//do anything else
}
}
timer()
{
// stop timer
llSetTimerEvent(0);
llListenRemove(listenHandle);
llWhisper(0, "Sorry. You snooze; you lose.");
}
}
Listening Script
key teleportee;
Teleport()
{
integer perm = llGetPermissions();
{
if(PERMISSION_TELEPORT & perm)
{
llSay(0,"Perms Detected");
llTeleportAgent(llDetectedKey(0), "", <13.0, 38.0, 23.5>, <13.0, 12.0, 23.5>);
}
else
{
llSay(0,"No Perms Detected");
}
}
}
default
{
state_entry()
{
//listen to this specific channel
llListen(1641, "",NULL_KEY, "");
llListen(1640, "",NULL_KEY, "");
llListen(1643, "",NULL_KEY, "");
llListen(1644, "",NULL_KEY, "");
llListen(1642, "",NULL_KEY, "");
//you can say something like this
llSay(1641,"Pressed");
}
//listen for something to happen
listen(integer channel, string name, key id, string message)
{
if(channel == 1642)
{
llSay(0, "The Hud Works!");
Teleport();
}
else
{
llSay(0,"You *****ed it");
}
}
}