Jump to content

LLglobalTeleport


steph Arnott
 Share

You are about to reply to a thread that has been inactive for 1944 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I use RLV so am rather confused with this. I have added a passed data which was added at the last min and may be wrong. The issue i can not get around is repeated agent perms acceptance. I just do not want the owner having to repeatedly give permission.

string simName;// = " my sim removed";//this temp to see what is doing what
vector simGlobalCoords;
vector simLocalCoords;// = <30.0, 90.0, 24.0>;//

key  agent;
key ownerid;


default
{
    state_entry()
    {
        ownerid = llGetOwner();
        llListen(-200600, "", ownerid, "");
    }
    listen(integer channel, string name, key id, string params)
    {
        list parameters = llParseString2List(params, ["|"], []);
        string simName = (string)llList2String(parameters,0);
        vector simLocalCoords = (vector)llList2String(parameters, 1);
        //rotation rot = (rotation)llList2String(parameters, 2);
        llRequestSimulatorData( simName, DATA_SIM_POS );
    }
    touch_start( integer total_number )
    {
        agent = llDetectedKey(0);
        llRequestPermissions( agent, PERMISSION_TELEPORT );
    }
    run_time_permissions( integer perm )
    {
        if ( simGlobalCoords == ZERO_VECTOR )
        {
            llOwnerSay( "Sim not found.");
            return;
        }
        else if ( PERMISSION_TELEPORT & perm )
        {
            llTeleportAgentGlobalCoords( agent, simGlobalCoords, simLocalCoords, ZERO_VECTOR );
        }
    }
    dataserver(key query_id, string data)
    {
        simGlobalCoords = (vector)data;
    }
    changed(integer change)
    {
        if (change & CHANGED_OWNER)
            llResetScript();
    }
}

 

Edited by steph Arnott
removed my sim
Link to comment
Share on other sites

Unlike PERMISSION_CONTROL_CAMERA and a few other permissions, PERMISSION_TELEPORT cannot be granted silently unless it is requested in the context of an Experience.  There's no way to get around the explicit permissions dialog box with normal LSL, I'm afraid.  I do not use RLV myself, so I do not know whether it's possible when you use that system.  If so, of course, then the user would have to have RLV or RLVa enabled.

  • Thanks 1
Link to comment
Share on other sites

7 minutes ago, Rolig Loon said:

Unlike PERMISSION_CONTROL_CAMERA and a few other permissions, PERMISSION_TELEPORT cannot be granted silently unless it is requested in the context of an Experience.  There's no way to get around the explicit permissions dialog box with normal LSL, I'm afraid.  I do not use RLV myself, so I do not know whether it's possible when you use that system.  If so, of course, then the user would have to have RLV or RLVa enabled.

Groan. Okay thank you. The relay auto uses the llMap if not RLV. Well at least it is not something i am doing incorrectly so that is a bonus. 

Link to comment
Share on other sites

Would this not work?

	touch_start( integer total_number )
	{
		agent = llDetectedKey(0);
		if(llGetPermissions() & PERMISSION_TELEPORT && agent == llGetPermissionsKey()){//if script has permissions granted by this avatar to telport her
			llTeleportAgentGlobalCoords( agent, simGlobalCoords, simLocalCoords, ZERO_VECTOR );
		}
		else{
			llRequestPermissions( agent, PERMISSION_TELEPORT );
		}
	}

 

Link to comment
Share on other sites

3 minutes ago, Innula Zenovka said:

Would this not work?


	touch_start( integer total_number )
	{
		agent = llDetectedKey(0);
		if(llGetPermissions() & PERMISSION_TELEPORT && agent == llGetPermissionsKey()){//if script has permissions granted by this avatar to telport her
			llTeleportAgentGlobalCoords( agent, simGlobalCoords, simLocalCoords, ZERO_VECTOR );
		}
		else{
			llRequestPermissions( agent, PERMISSION_TELEPORT );
		}
	}

Well i will give it a try. Am not in world at te moment so will let you kow.

 

Link to comment
Share on other sites

13 minutes ago, steph Arnott said:

No. It invokes the 'sim not found'.

Oh, there's a good reason for that.  If you click on the object and find that PERMISSION_TELEPORT has not been granted yet, your script executes the run_time_permissions event and discovers that simGlobalCoords == ZERO_VECTOR , because you never sent it a value in a chat message.  Try uncommenting the values for simGlobalCoords and simName at the top of your script and invoking the dataserver in state_entry.   Then see what happens.

Link to comment
Share on other sites

5 minutes ago, Rolig Loon said:

Oh, there's a good reason for that.  If you click on the object and find that PERMISSION_TELEPORT has not been granted yet, your script executes the run_time_permissions event and discovers that simGlobalCoords == ZERO_VECTOR , because you never sent it a value in a chat message.  Try uncommenting the values for simGlobalCoords and simName at the top of your script and invoking the dataserver in state_entry.   Then see what happens.

Brain fell out, and ran away. You totaly have lost me now on what you mean.

Link to comment
Share on other sites

Try this....

string simName= "Sweet Serenity"; //this temp to see what is doing what -- a default startup
vector simGlobalCoords;
vector simLocalCoords = <30.0, 90.0, 24.0>; // default startup value

key  agent;
key ownerid;


default
{
    state_entry()
    {
        ownerid = llGetOwner();
        llListen(-200600, "", ownerid, "");
        llRequestSimulatorData( simName, DATA_SIM_POS );  // I added this
    }
    listen(integer channel, string name, key id, string params)
    {
        list parameters = llParseString2List(params, ["|"], []);
        string simName = (string)llList2String(parameters,0);
        vector simLocalCoords = (vector)llList2String(parameters, 1);
        //rotation rot = (rotation)llList2String(parameters, 2);
        llRequestSimulatorData( simName, DATA_SIM_POS );
    }
    touch_start( integer total_number )   // Here's Innula's suggestion
    {
        agent = llDetectedKey(0);
        if(llGetPermissions() & PERMISSION_TELEPORT && agent == llGetPermissionsKey()){//if script has permissions granted by this avatar to telport her
            llTeleportAgentGlobalCoords( agent, simGlobalCoords, simLocalCoords, ZERO_VECTOR );
        }
        else{
            llRequestPermissions( agent, PERMISSION_TELEPORT );
        }
    }
    run_time_permissions( integer perm )
    {
        if ( simGlobalCoords == ZERO_VECTOR )
        {
            llOwnerSay( "Sim not found.");
            return;
        }
        else if ( PERMISSION_TELEPORT & perm )
        {
            llTeleportAgentGlobalCoords( agent, simGlobalCoords, simLocalCoords, ZERO_VECTOR );
        }
    }
    dataserver(key query_id, string data)
    {
        simGlobalCoords = (vector)data;
    }
    changed(integer change)
    {
        if (change & CHANGED_OWNER)
            llResetScript();
    }
}

The first time you use the object, whether you click on it or send it a chat message, it triggers the run_time_permissions event and gives you a dialog box.  After that, you never get the dialog box again.  And you don't get the "Sim not found" message because it either uses your startup default values or whatever you give it in a chat message.

  • Like 1
Link to comment
Share on other sites

I think the problem is that simName and simLocalCoords are declared twice, once as global variables (which they should be) and then again as local variables (which is makes them available only in the listen event).  

Anyway, try this, which works for me (NB that I've changed the value of the channel on which it listens):

string simName;// = "Sweet Serenity";//this temp to see what is doing what
vector simGlobalCoords;
vector simLocalCoords;// = <30.0, 90.0, 24.0>;//

key  agent;
key ownerid;


default
{
    state_entry()
    {
        ownerid = llGetOwner();
        llListen(5, "", ownerid, "");
    }
    listen(integer channel, string name, key id, string params)
    {
        list parameters = llParseString2List(params, ["|"], []);
        simName = (string)llList2String(parameters,0);
        simLocalCoords = (vector)llList2String(parameters, 1);
        //rotation rot = (rotation)llList2String(parameters, 2);
        llRequestSimulatorData( simName, DATA_SIM_POS );
    }
    touch_start( integer total_number )
    {
        if ( simGlobalCoords == ZERO_VECTOR )
        {
            llOwnerSay( "touch start event: Sim not found.");
            return;
        }
        agent = llDetectedKey(0);
        if(llGetPermissions() & PERMISSION_TELEPORT){
            llTeleportAgentGlobalCoords( agent, simGlobalCoords, simLocalCoords, ZERO_VECTOR );
        }
        else{
            llRequestPermissions( agent, PERMISSION_TELEPORT );
        }

    }
    run_time_permissions( integer perm )
    {
        if ( simGlobalCoords == ZERO_VECTOR )
        {
            llOwnerSay( "run time permissions event: Sim not found.");
            return;
        }
        else if ( PERMISSION_TELEPORT & perm )
        {
            llTeleportAgentGlobalCoords( agent, simGlobalCoords, simLocalCoords, ZERO_VECTOR );
        }
    }
    dataserver(key query_id, string data)
    {
        simGlobalCoords = (vector)data;
        llOwnerSay("simGlobalCoords is "+(string)simGlobalCoords);
    }
    changed(integer change)
    {
        if (change & CHANGED_OWNER)
            llResetScript();
    }
}

 

  • Like 1
Link to comment
Share on other sites

Code is fun. NOT when it does ones head in.

21 minutes ago, Innula Zenovka said:

 

 

27 minutes ago, Rolig Loon said:

 

 

Oh sorry Innula it came across as only Rolig. It was both of you. My deepest appologies for not making it clear.

Edited by steph Arnott
  • Like 1
Link to comment
Share on other sites

22 hours ago, Innula Zenovka said:

 


////////////////////////////////////////////////////////////////////////////////////////////////
//Steph Arnott, Rolig Loon and Innula Zenovka. This was created as a tri lateral team effort. //
//Tests inworld have proven code function.                                                    //
//This script is licenced using the Creative Commons Attribution-Share Alike 3. As such it    //
// can be used or modified as you wish. The creators must be acknoledged. In short do not     //
//claim it is your work.                                                                      //
////////////////////////////////////////////////////////////////////////////////////////////////                                                           



string simName = "name of sim"; //this temp to see what is doing what -- a default startup. Use a real sim name
vector simGlobalCoords;
vector simLocalCoords = <30.0, 90.0, 24.0>; // default startup value
//Please note that the above variables need to be undeclared if one intends to use a menu system. They are only declared
//for testing or for use as a one location inter-sim teleporter. The declared purpose was to simplify testing of the script.
//The listen event was included because i use a core menu location data script. The data stride splitter had to be included
//to verify that it was not adversly affecting the scripts function. Which it was and was rectified. If the core function of a
//script is flawed and not corrected at the onset then there is no point moving onto including a more complex menu script
//because that flaw will hit you back every time.  
key  agent;
key ownerid;


default
{
    state_entry()
    {
        ownerid = llGetOwner();
        llListen(-200600, "", ownerid, "");
	llRequestSimulatorData( simName, DATA_SIM_POS );
    }
    listen(integer channel, string name, key id, string params)
    {
        list parameters = llParseString2List(params, ["|"], []);
        string simName = (string)llList2String(parameters,0);
        vector simLocalCoords = (vector)llList2String(parameters, 1);
        //rotation rot = (rotation)llList2String(parameters, 2);
        llRequestSimulatorData( simName, DATA_SIM_POS );
    }
    touch_start( integer total_number )
    {
        agent = llDetectedKey(0);
        if(llGetPermissions() & PERMISSION_TELEPORT && agent == llGetPermissionsKey())//if script has permissions granted by this avatar to telport her
        {
            llTeleportAgentGlobalCoords( agent, simGlobalCoords, simLocalCoords, ZERO_VECTOR );
        }
        else
        {
            llRequestPermissions( agent, PERMISSION_TELEPORT );
        }
    }
    run_time_permissions( integer perm )
    {
        if ( simGlobalCoords == ZERO_VECTOR )
        {
            llOwnerSay( "Sim not found." );
            return;
        }
        else if ( PERMISSION_TELEPORT & perm )
        {
            llTeleportAgentGlobalCoords( agent, simGlobalCoords, simLocalCoords, ZERO_VECTOR );
        }
    }
    dataserver(key query_id, string data)
    {
        simGlobalCoords = (vector)data;
    }
    changed(integer change)
    {
        if (change & CHANGED_OWNER)
            llResetScript();
    }
}

 

 

Edited by steph Arnott
Different code styles, so made it one style.
  • Like 2
Link to comment
Share on other sites

I would normally filter for llGetOwner or llSameGroup or whatever in the listen event rather that making the llListen do it, but that's purely my personal preference. If you're having problems with the script written this way, you might try that, though.  Just a guess, but I suspect that you are sending the message with a separate box or HUD, so the UUID associated with the incoming message to this script will be the UUID of the HUD, not the owner.  If so,  you shouldn't expect llListen( -200600, "", ownerid, "" ) to work.

Link to comment
Share on other sites

1 minute ago, Rolig Loon said:

I would normally filter for llGetOwner or llSameGroup or whatever in the listen event rather that making the llListen do it, but that's purely my personal preference. If you're having problems with the script written this way, you might try that, though.  Just a guess, but I suspect that you are sending the message with a separate box or HUD, so the UUID associated with the incoming message to this script will be the UUID of the HUD, not the owner.  If so,  you shouldn't expect llListen( -200600, "", ownerid, "" ) to work.

The channel will be so high that it will mearly be an interesting work around at a later date. It did throw me off for awhile so i will keep it in mind for other projects.  BTW the message is from a HUD.

Link to comment
Share on other sites

Just now, Rolig Loon said:

So, then use llListen(-200600,"","","")  and then filter in the listen event with 

if( llGetOwnerKey(id) == ownerid )

That should work.

Tried that, it someting to do with the perms i think. The channel will be on 500 odd thousand so not really an issue. I will solve it over time. The main point was that i wanted to remove the RLV script which bound the teleporter to an RLV viewer. That script uses far to much memory as well for what it does.

Link to comment
Share on other sites

1 hour ago, steph Arnott said:

Tried that, it someting to do with the perms i think.

The code

        ownerid = llGetOwner();
        llListen(-200600, "", ownerid, "");

means it's listening to the owner on channel -200600.   The owner, not a HUD (or anything else) belonging to the owner.

That's why it should be llListen(-200600,"","","") and then, in the listen event, test for if(llGetOwnerKey(id) == ownerid).   That means "if the message is either from this object's owner or from an object belonging to this object's owner".

Edited by Innula Zenovka
Link to comment
Share on other sites

1 minute ago, steph Arnott said:

This does not work, I have already tried that. ' if(llGetOwnerKey(id) == ownerid) '..

No, 

        ownerid = llGetOwner();
        llListen(-200600, "", ownerid, "");

won't work.   

Rolig and I are suggesting

	state_entry()
	{
		ownerid = llGetOwner();
		llListen(-200600, "", "", "");

	}
	listen(integer channel, string name, key id, string message)
	{
		if(llGetOwnerKey(id)==ownerid)
		{
			//do stuff
		}
	}

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1944 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...