Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Teleporter based on llMapDestination - help!

Rock Ryder
Registered User
Join date: 6 Oct 2006
Posts: 384
04-07-2008 16:10
Hi guys,

I know WHY this script I wrote is not working for me, I just need a suggestion or two on how to fix it. First, the script (still very much work-in-progress):

[CODE}

// menu items
list Menu = ["Serapis", "Baths", "Ankh", "Djed", "Ma'at", "Scarab", "Quay", "Beach", "Palace of Joy"];

//destinations and their vectors now follow
string dest = "Sukka Mire";
vector v00 = <223,38,29>;
vector v01 = <223,38,29>;
vector v02 = <223,38,29>;
vector v03 = <223,38,29>;
vector v04 = <223,38,29>;
vector v05 = <223,38,29>;
vector v06 = <223,38,29>;
vector v07 = <223,38,29>;
vector v08 = <223,38,29>;

//other variables
integer handle;

default
{

state_entry()
{
llSetText("Palace Teleporter",<0.875,0.746,0.547>,1);
}

touch_start(integer num)
{
key id = llDetectedKey(0); //get id of person touching
handle = llListen(45, "", id, "";);
llDialog(id, "Select destination -", Menu, 45);
llSetTimerEvent(30);
}
listen(integer channel, string name, key id, string message)
{
llListenRemove(handle);
llSetTimerEvent(0);
integer index = llListFindList(Menu, [ message]);
llSay(0, (string) index); //for debug only

if(index == 2); //tp code here
{
llMapDestination(dest, v02, v02);
}
}

timer()
{
llListenRemove(handle);
llSetTimerEvent(0);
llWhisper(0, "Menu timeout.";);
}
}
[/CODE]

The user touches the prim. A menu appears containing the destinations to choose from. A series of 'if' statements then follows, based on the index number of the destination chosen from the menu. In this example I am using index number 2, in other words, if the user chooses 'Ankh' the index would be equal to 2, and at this point I want the llMapDestination command to present the user with the World Map in order for him to teleport (after pressing the teleport button).

The problem is that llMapDestination only works inside a touch event, and I have mine inside the listen event, and it is ignored. But I need the touch event to trigger the menu, so how can I have the map appear based on the choice?

Rock
_____________________
If Jimmy cracked corn, and I don't care, why did I write a song about it??
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
04-07-2008 17:23
Best recommendation? redesign your prims so that the Teleport button is an actual prim you touch to teleport.

Someone else also asked this same question, and the scripting gurus answered thusly:

/54/fc/222677/1.html
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
04-07-2008 20:04
If object is not attached llMapDestination works only on touch.

But if object is attached llMapDestination can be triggered from any event.

http://lslwiki.net/lslwiki/wakka.php?wakka=llMapDestination
Rock Ryder
Registered User
Join date: 6 Oct 2006
Posts: 384
04-08-2008 08:39
From: Talarus Luan
Best recommendation? redesign your prims so that the Teleport button is an actual prim you touch to teleport.

Someone else also asked this same question, and the scripting gurus answered thusly:

/54/fc/222677/1.html


Thanks Talarus. It appears from that thread that it is NOT possible to use both a Menu system and bring up the world map with only ONE touch event in the code. There was nothing in the thread which offered to facilitate a one-touch solution.

The whole point of my Menu-driven solution was to avoid the growing number of single prim teleport orbs I have on my Palace walls, and replace them all with one.

There MUST be a solution to this, mmmm....

Rock
_____________________
If Jimmy cracked corn, and I don't care, why did I write a song about it??
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
04-08-2008 09:01
Unfortunately the poster used his signature to answer and the signature has since changed. Lesson to posters everywhere.

While it isn't PRETTY to do it this way, it IS possible to map the destination from a single touch/dialog. What you need is for one script to loop infinitely in the 'touch(_start)' event handler, polling for a dialog answer from a second script. The usual way to do this is to use the prim name or description, but you could also use any persistent prim property such as hollow or a face texture. Note that this WILL tie the teleporter up for the user who clicked, so you'll want some kind of timeout in there just in case the resident walks away without making a dialog choice. I'm also not entirely sure what's going to happen if multiple users touched the prim in the same server frame. If you pick the first one, hope that the order of touches is the same between the scripts. Otherwise, one user's choice might pop up their selection on all users' maps.
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
04-09-2008 01:38
Just thoughts here, but rather than have the map come up, why not have the menu spit out an SURL via IM. The user can then click the SURL to TP. The down side I suppose is that it would be about 4 clicks, object, menu, surl, tp but would overcome the limitations of llmapdestination.

I have modified your code to show what I mean.

CODE

// menu items
list Menu = ["Serapis", "Baths", "Ankh", "Djed", "Ma'at", "Scarab", "Quay", "Beach", "Palace of Joy"];

//destinations and their vectors now follow
string dest = "Sukka Mire";
list targ = ["223/38/29","223/38/29","223/38/29","223/38/29","223/38/29","223/38/29","223/38/29","223/38/29","223/38/29"];

//other variables
integer handle;
key id;

default
{

state_entry()
{
llSetText("Palace Teleporter",<0.875,0.746,0.547>,1);
}

touch_start(integer num)
{
id = llDetectedKey(0); //get id of person touching
handle = llListen(45, "", id, "");
llDialog(id, "Select destination -", Menu, 45);
llSetTimerEvent(30);
}
listen(integer channel, string name, key id, string message)
{
llListenRemove(handle);
llSetTimerEvent(0);
integer index = llListFindList(Menu, [ message]);
llSay(0, (string) index); //for debug only

if(index == 2); //tp code here
{
llInstantMessage(id,"http://slurl.com/secondlife/Sukka%20Mire/"+llList2String(targ,index));
}
}

timer()
{
llListenRemove(handle);
llSetTimerEvent(0);
llWhisper(0, "Menu timeout.");
}
}