Jump to content

Recommended Posts

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");
              }
      }
}

 

Share this post


Link to post
Share on other sites

Not sure quite what you're trying to achieve at the end of state_entry()  in the HUD script, as it stands it will simply generate a TRUE or FALSE condition but you don't save the result. If you had meant to put a single = instead of == it makes absolutely no sense at all, however.

llGetOwner() == teleportee;

Then, inside the Listen event, you have llListenRemoveHandle before some subsequent tests for messages, it should be moved to the end of all tests where you don't want to initiate a further dialog or further actions.

The main issue I see in the listener script you are using llDetectedKey(0)  outside of an event.

From what I understand you are wanting to get the collision event in one script and obtain the key of a colliding avatar and after obtaining permission to Teleport, but then use a second script to actually teleport the colliding agent, but the permissions you asked for will be those granted to the agent wearing the HUD when it was first put on, not the person bumping into the HUD, (which I don't think could ever actually happen).

Edited by Profaitchikenz Haiku
Typos

Share this post


Link to post
Share on other sites
16 minutes ago, Profaitchikenz Haiku said:

Not sure quite what you're trying to achieve at the end of state_entry()  in the HUD script, as it stands it will simply generate a TRUE or FALSE condition but you don't save the result. If you had meant to put a single = instead of == it makes absolutely no sense at all, however.


llGetOwner() == teleportee;

Then, inside the Listen event, you have llListenRemoveHandle before some subsequent tests for messages, it should be moved to the end of all tests where you don't want to initiate a further dialog or further actions.

The main issue I see in the listener script you are using llDetectedKey(0)  outside of an event.

From what I understand you are wanting to get the collision event in one script and obtain the key of a colliding avatar and after obtaining permission to Teleport, but then use a second script to actually teleport the colliding agent, but the permissions you asked for will be those granted to the agent wearing the HUD when it was first put on, not the person bumping into the HUD, (which I don't think could ever actually happen).

Im tryign to get it to where people who are wearing the hud and bump into certain objects get teleported.  I am trying to make it easier on telelporting since bumping without grabbing permissions does not work.

Share this post


Link to post
Share on other sites

You must  request permissions before calling  llTeleportAgent();

run_time_permissions(integer perm)
{
    if(PERMISSION_TELEPORT & perm)
    {
        llTeleportAgent(teleportee, "", <13.0, 38.0, 23.5>, <13.0, 12.0, 23.5>);
    }
}

teleportee = llDetectedKey(0);
llRequestPermissions(teleportee, PERMISSION_TELEPORT);

Share this post


Link to post
Share on other sites
4 minutes ago, Rachel1206 said:

You must  request permissions before calling  llTeleportAgent();

run_time_permissions(integer perm)
{
    if(PERMISSION_TELEPORT & perm)
    {
        llTeleportAgent(teleportee, "", <13.0, 38.0, 23.5>, <13.0, 12.0, 23.5>);
    }
}

teleportee = llDetectedKey(0);
llRequestPermissions(teleportee, PERMISSION_TELEPORT);

I did that in the hud script, how do i get my listening script to read that?

Share this post


Link to post
Share on other sites

A script that needs permissions needs to request that permissions.

The permissions are then granted for that script. For the requesting script and ONLY this script.

If you have a 2nd script that requires permissions this script needs to request permissions too.

 

For your case: your hud has teleport permissions. There is no need to do the teleportation by another object. Just let the object send the target location to the hud and the hud can do the teleportation. Otherwise you need to grant permissions for every collision object or use experiences.
You did read the wiki and know that llTeleportAgent can only teleport the owner?
If you have other plans you definitely need experiences.

Share this post


Link to post
Share on other sites
2 minutes ago, Nova Convair said:

A script that needs permissions needs to request that permissions.

The permissions are then granted for that script. For the requesting script and ONLY this script.

If you have a 2nd script that requires permissions this script needs to request permissions too.

 

For your case: your hud has teleport permissions. There is no need to do the teleportation by another object. Just let the object send the target location to the hud and the hud can do the teleportation. Otherwise you need to grant permissions for every collision object or use experiences.
You did read the wiki and know that llTeleportAgent can only teleport the owner?
If you have other plans you definitely need experiences.

Correct yes, its a hud for an rp sim so everyone will have one, I dont have the premium account for experiences so i was trying to see if i could script something similar or close to that effect.

Share this post


Link to post
Share on other sites

Then let your hud listen and the collision objects send the position where to teleport to the hud.

You can use llRegionSayTo(<avatar-uuid>,channel,(string)position)
That way only this one hud will get the message and the avatar uuid you get by the collision event.

Maybe think about some security measures, so that not every griefer can teleport every RPer or all of them at once.

Share this post


Link to post
Share on other sites
1 minute ago, Nova Convair said:

Then let your hud listen and the collision objects send the position where to teleport to the hud.

You can use llRegionSayTo(<avatar-uuid>,channel,(string)position)
That way only this one hud will get the message and the avatar uuid you get by the collision event.

Maybe think about some security measures, so that not every griefer can teleport every RPer or all of them at once.

So reverse it then? I think i can group lock the script.

Share this post


Link to post
Share on other sites

The hud can determine the owner of the collision object which sends the message. (llGetObjectDetails)

So it can accept teleportetion commands only from objects of specific owners. That should prevent any griefing activities.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×