Jump to content

Recommended Posts

Hi. I'm not a scripter. Just trying to edit and combine some codes from open sources. Basically what I'm trying to achieve is when the object is touched, a dialog will appear and when certain option / answer is clicked the Map Destination opens. I did not get any error message when I saved the script but the "llMapDestination" command is seemingly being ignored in the "if" clause. When I tried it with "llSay", it worked just fine. My scripting skills is very basic and limited to editing only so I definitely must be missing something.

 

* This one worked *

integer gListener;
 
default
{
    touch_start(integer total_number)
    {
        llListenRemove(gListener);
        key user = llDetectedKey(0);
        gListener = llListen(-99, "", user, "");
        llDialog(user, "\nDo you want to use the World Map?", ["Yes", "No" ] , -99);
        llSetTimerEvent(60.0);
    }
    listen(integer chan, string name, key id, string msg)
    {
        if (msg == "Yes")
        {
        llSay(0, "It worked!");
        }
        llSetTimerEvent(0.1);        
    }
    timer()
    {
        llListenRemove(gListener);
        llSetTimerEvent(0.0);
    }
}

image.png.26b86628584a335944055892b7269b77.png

-----------------------------------------------------

* This one didn't work, no error but world map doesn't open *

 
integer gListener;
 
default
{
    touch_start(integer total_number)
    {
        llListenRemove(gListener);
        key user = llDetectedKey(0);
        gListener = llListen(-99, "", user, "");
        llDialog(user, "\nDo you want to use the World Map?", ["Yes", "No" ] , -99);
        llSetTimerEvent(60.0);
    }
    listen(integer chan, string name, key id, string msg)
    {
        if (msg == "Yes")
        {
        llMapDestination("Perlanera", <248.0, 146.0, 3694.0>, ZERO_VECTOR);
        }
        llSetTimerEvent(0.1);        
    }
    timer()
    {
        llListenRemove(gListener);
        llSetTimerEvent(0.0);
    }
}

Edited by MonicaBahaghari
Repositioned some sentences and added tags.
Link to post
Share on other sites

According to the wiki entry for llMapDestination (http://wiki.secondlife.com/wiki/LlMapDestination) this function only works in touch events or if the script is attached to the avatar.

How about foregoing the Yes/No dialog, which doesn't really add anything to the interaction, and just opening the map when the avatar clicks on the object? Or, perhaps, using the viewer URI namespace thingy that'll chat a clickable link which opens the Place Details window with its map and teleport buttons:

llRegionSayTo (user, PUBLIC_CHANNEL, "Click: secondlife://Perlanera/248/146/3694");

or

(llGetOwner (), PUBLIC_CHANNEL, "Click: secondlife:///app/teleport/Perlanera/248/146/3694");

or

llRegionSayTo (llGetOwner (), PUBLIC_CHANNEL, "Click: secondlife:///app/worldmap/Perlanera/248/146/3694");

Edited by KT Kingsley
  • Like 1
Link to post
Share on other sites
18 minutes ago, KT Kingsley said:

According to the wiki entry for llMapDestination (http://wiki.secondlife.com/wiki/LlMapDestination) this function only works in touch events or if the script is attached to the avatar.

How about foregoing the Yes/No dialog, which doesn't really add anything to the interaction, and just opening the map when the avatar clicks on the object? Or, perhaps, using the viewer URI namespace thingy that'll chat a clickable link which opens the Place Details window with its map and teleport buttons:

llRegionSayTo (user, PUBLIC_CHANNEL, "Click: secondlife://Perlanera/248/146/3694");

or

(llGetOwner (), PUBLIC_CHANNEL, "Click: secondlife:///app/teleport/Perlanera/248/146/3694");

or

llRegionSayTo (llGetOwner (), PUBLIC_CHANNEL, "Click: secondlife:///app/worldmap/Perlanera/248/146/3694");

I see. I was planning to put this script in a rental vendor so that once they click it a dialog box with some brief text / information about what they on the vendor with 2 buttons at bottom area to teleport back to the office (option 1) or just close the dialog box with no further action (option 2) because the vendor itself immediately opens the world map once clicked. I'm just giving it a try if I can combine the 2 scripts from the open source but I guess this is too complicated for me given my very newbie level of scripting knowledge. Lol. Thanks for the reply.

Link to post
Share on other sites

You could include the information in chat that accompanies the clickable links (like where I put "Click: ", either before or after the links, or both), or you could both open a dialog with the information and post the links in chat.

(Incidentally, I see I used llGetOwner as the target in the llRegionSayTo functions; this was the result of a quick test to check I'd got the code right. If you do go this route, you'll want to replace that with the variable user which you've assigned the value of llDetectedKey (0), or with llDetectedKey (0) directly.)

 

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
×
×
  • Create New...