Skip to content

Instantly share code, notes, and snippets.

@cinderblocks
Created December 4, 2014 01:47
Show Gist options
  • Save cinderblocks/4582919dcd3d37e4628d to your computer and use it in GitHub Desktop.
Save cinderblocks/4582919dcd3d37e4628d to your computer and use it in GitHub Desktop.
integer attempts = 0;
default
{
state_entry()
{
llOwnerSay("Accept my permissions to start. Touch to stop.");
llRequestPermissions(llGetOwner(), PERMISSION_TELEPORT);
}
run_time_permissions(integer perm)
{
if (~perm & PERMISSION_TELEPORT)
{
llOwnerSay("I need permissions to teleport you!");
llRequestPermissions(llGetOwner(), PERMISSION_TELEPORT);
}
else
{
state activated;
}
}
}
state activated
{
state_entry()
{
llSetTimerEvent(3.0);
}
touch_start(integer touch_me_bb)
{
if (llDetectedKey(0) == llGetOwner())
state default;
}
state_exit()
{
llSetTimerEvent(0.0);
}
timer()
{
list agents = llGetAgentList(AGENT_LIST_REGION, []);
integer agent_count = llGetListLength(agents);
if (!agent_count) state default;
integer i;
integer found = FALSE;
for (i = 0; i < agent_count; ++i)
{
if (llList2Key(agents,i) == llGetOwner())
{
llTeleportAgentGlobalCoords(llGetOwner(), <263168,324864,0>, <128,128,50>, ZERO_VECTOR);
llOwnerSay("Attempts: " + (string)(++attempts));
found = TRUE;
}
}
if (!found)
state default;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment