Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

space between two words screws up my list???

Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-05-2006 14:21
A list with 3 element strides [sim name, destination, vector]. The destination is copied from the destination list and put into llDialog. But when I push the llDialog button with that name nothing happens. I did an llOwnerSay and the string confirms that the Dialog does say the destination correctly. For example "test test". But when I use two words it will not work. Is there anything about lists to Dialog and back that screws up with a space??? Is there anyway to remove the space if necessary?


This works fine:

CODE

Sesia , testtest = <47.718494, 248.091583, 64.292633>

But if I enter two words into it like this:
CODE

Sesia , test test = <47.718494, 248.091583, 64.292633>

Then it will not work. What it strange is that if the sim name is two words then that will still work.

errrr sorry I do hope someone can understand this. I don;t think I explained myself clearly.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
10-05-2006 14:38
Can you post the script, and step by step instructions of what you did and what's not working? I don't fully understand if the error happens when building the list, when creating the dialog button from the list, when trying to pick up the dialog chat in the listen handler... ?

Off the top of my head... is there any place in the script where you're using a space as a delimiter, to parse strings or anything like that?
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-05-2006 14:44
ooooo Okay here goes. I am going to add this to library anyway. But you are going to have to look through my version of coding which heehee is self taught. Script works fine thou, runs under 1 ms and holds a butt load of destinations 60+

CODE

//Menu Driven Teleport HUD by Jesse Barnett
//A significant thanks to Teneo Hopes wonderful Teleport Script


list main_menu;
list options = ["Options"];//to be added to main menu to call options menu
list bubble = ["Bubble TP"];
list instantly = ["Instant TP"];
list sims;///list of sims
list dest;//List of Destinations
list menu_options=["Add", "Remove", "Back", "List", "Instant TP"]; //menu options
list sim_test;//used to get location of current sim in both dest and sims list
list next_test;//used ot get location of next sim in dest list
integer chan;//listen channel
integer current_sim_loc;//used to find location of current sim in list
integer current_sim_loc2;//Location of the next sim name in sims list
integer next_sim_loc;//Location of the next sim in dest list
string next_sim_name;//name of next sim in list
integer dest_length;//Destinations list length
string sim;//The current sim
string object = "bubble"; // Name of object to rez that will teleport the avatar
default
{
state_entry()
{
main_menu = [];//Clears the main menu
llListenRemove(chan);//remove all listens
}

touch_start(integer num_detected)
{
chan = -8173;//listen channel
main_menu = [];//Clears the main menu
sim = llGetRegionName();//Use this to limit menu to local destinations
sim_test = [sim];//The name of the current sim changed to list
dest_length = llGetListLength(dest);
dest = llListSort(dest, 3, TRUE);//returns a lsorted list according to sim name
sims = llListSort(sims, 1, TRUE);//sorts the sims list
current_sim_loc = llListFindList(dest, sim_test);//position of first current sim in the dest list
current_sim_loc2 = llListFindList(sims, sim_test);//Postion of current sim in sims list
next_sim_name = llList2String(sims, (current_sim_loc2 + 1));//Now I have the name of the next sim
next_test = [next_sim_name];//Changes string to List
next_sim_loc = (llListFindList(dest, next_test) - 1);//Postion of the next sim sim in dest list
main_menu = llList2ListStrided(llDeleteSubList(dest, 0, 0),current_sim_loc, next_sim_loc, 3);//unsorted main menu
main_menu = llListSort(main_menu, 1, TRUE);//Buttons sorted by name
main_menu = (main_menu=[]) + options + main_menu;//Inserts "Options" button before sorted name buttons
llListen(chan,"",llGetOwner(),"");
llSetTimerEvent(20);
llDialog(llDetectedKey(0), "Choose destination in this sim or Options to add/remove destinations", main_menu, chan);//displays main menu
}

listen(integer channel, string lm, key id, string message)
{
list params = llParseString2List(message,[" "],[]);
if (llListFindList(main_menu + menu_options, [message]) != -1)
{
if (message == "Options")
{
llDialog(id, "Pick an option!", menu_options, chan);
}

else if (message == "Back")
{
llDialog(id, "Where in this sim do you want to go?", main_menu, chan);
}

else if (message == "Instant TP")
{
object = "tpobject";
menu_options = llListReplaceList(menu_options, bubble, 4, 4);
llDialog(id, "Where in this sim do you want to go?", main_menu, chan);
}

else if (message == "Bubble TP")
{
object = "bubble";
menu_options = llListReplaceList(menu_options, instantly, 4, 4);
llDialog(id, "Where in this sim do you want to go?", main_menu, chan);
}

else if (message == "Add")
{
integer b = TRUE;
integer m = TRUE;
b = ((llGetListLength(main_menu)) <= 11); //Checks to see if there are 11 destinations in this sim
m = (llGetFreeMemory() >= 1000);//Checks for available memory
if( !b || !m ) // Tests to see if either statement is true
{
llOwnerSay("You can not add any more destinations");
}
else
{
llOwnerSay("What do you want to name this destination?");
state adddest;
}
}

else if (message == "Remove")
{
llDialog(id, "Which desination do you want to remove?", main_menu, chan);
state remdest;
}

else if (message == "List")
{
integer i;
if(llGetListLength(dest) > 0)
{
for (i = 0; i < llGetListLength(dest); i+=3)
{
string sim = llList2String(dest, i);
string places = llList2String(dest, i+1);
string loc= llList2String(dest, i+2);
llOwnerSay(sim + " , " + places + " = " + loc);
}
}

else
{
llOwnerSay("No Destinations Available.");
}
}
else if(llListFindList(dest,[message]) != -1)
{
llOwnerSay("button said " + (string)message);
integer index = llListFindList(dest, [llList2String(params,0)]);
if(index != -1)
{
vector target = (vector)llList2String(dest, index+1);
integer chanfran = (integer)llFrand(9999999 - 9000000) + 9000000;
vector pos = llGetPos();
llSay(0,"Touch the pumpkin to teleport");
llRezObject(object, (pos + llRot2Fwd(llGetRot()) + <1.2,1.2,0>), ZERO_VECTOR, ZERO_ROTATION, chanfran);
llWhisper(chanfran, (string)target);
}
}
}
}
timer()
{
llSetTimerEvent( 0 );
llListenRemove(chan);
return;
}
}
state adddest
{
state_entry()
{
chan = 0;
llSetTimerEvent(20);
llListen(chan,"",llGetOwner(),"");
}
listen(integer chan, string name, key id, string newdest)
{
integer e = llListFindList(sims, [sim]);
if(e != -1)
{
vector pos = llGetPos();
dest = (dest=[]) + dest + [sim, newdest, pos];
llOwnerSay("Added : " + sim + " , " + newdest + " = " + (string)pos);
state default;
}
else
{
vector pos = llGetPos();
dest = (dest=[]) + dest + [sim, newdest, pos];
llOwnerSay("Added : " + sim + " , " + newdest + " = " + (string)pos);
sims = (sims=[]) + sims +[sim];
state default;
}
}
timer()
{
llListenRemove(chan);
llOwnerSay("Timeout. Click TP HUD to start again");
state default;
}
}

state remdest
{
state_entry()
{

chan = -8173;
llSetTimerEvent(20);
llListen(chan,"",llGetOwner(),"");
}
listen(integer chan, string name, key id, string remdest)
{
integer d = llListFindList(dest, [remdest]);
if(d != -1)
{
dest = llDeleteSubList(dest, d - 1, d + 1);
llOwnerSay("Removed : " + remdest);
state default;
}
}
timer()
{
llListenRemove(chan);
llOwnerSay("Timeout. Click TP HUD to start again");
state default;
}
}


My apologies before hand to the families of any professional scripters that have a heart attack after laying thier eyes on this script :=)
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-05-2006 14:48
You add destinations and buttons to the menu from the "Options" menu and the "Add" button. It will prompt you to type the name of the destination.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-05-2006 14:59
If all else fails then simplify. I stripped alot out of the script and still have the failure. It will be easier to look through:

CODE

//Menu Driven Teleport HUD by Jesse Barnett
//A significant thanks to Teneo Hopes wonderful Teleport Script


list main_menu;
list options = ["Options"];//to be added to main menu to call options menu
list bubble = ["Bubble TP"];
list instantly = ["Instant TP"];
list sims;///list of sims
list dest;//List of Destinations
list menu_options=["Add"]; //menu options
list sim_test;//used to get location of current sim in both dest and sims list
list next_test;//used ot get location of next sim in dest list
integer chan;//listen channel
integer current_sim_loc;//used to find location of current sim in list
integer current_sim_loc2;//Location of the next sim name in sims list
integer next_sim_loc;//Location of the next sim in dest list
string next_sim_name;//name of next sim in list
integer dest_length;//Destinations list length
string sim;//The current sim
string object = "bubble"; // Name of object to rez that will teleport the avatar
default
{
state_entry()
{
main_menu = [];//Clears the main menu
llListenRemove(chan);//remove all listens
}

touch_start(integer num_detected)
{
chan = -8173;//listen channel
main_menu = [];//Clears the main menu
sim = llGetRegionName();//Use this to limit menu to local destinations
sim_test = [sim];//The name of the current sim changed to list
dest_length = llGetListLength(dest);
dest = llListSort(dest, 3, TRUE);//returns a lsorted list according to sim name
sims = llListSort(sims, 1, TRUE);//sorts the sims list
current_sim_loc = llListFindList(dest, sim_test);//position of first current sim in the dest list
current_sim_loc2 = llListFindList(sims, sim_test);//Postion of current sim in sims list
next_sim_name = llList2String(sims, (current_sim_loc2 + 1));//Now I have the name of the next sim
next_test = [next_sim_name];//Changes string to List
next_sim_loc = (llListFindList(dest, next_test) - 1);//Postion of the next sim sim in dest list
main_menu = llList2ListStrided(llDeleteSubList(dest, 0, 0),current_sim_loc, next_sim_loc, 3);//unsorted main menu
main_menu = llListSort(main_menu, 1, TRUE);//Buttons sorted by name
main_menu = (main_menu=[]) + options + main_menu;//Inserts "Options" button before sorted name buttons
llListen(chan,"",llGetOwner(),"");
llSetTimerEvent(20);
llDialog(llDetectedKey(0), "Choose destination in this sim or Options to add/remove destinations", main_menu, chan);//displays main menu
}

listen(integer channel, string lm, key id, string message)
{
list params = llParseString2List(message,[" "],[]);
if (llListFindList(main_menu + menu_options, [message]) != -1)
{
if (message == "Options")
{
llDialog(id, "Pick an option!", menu_options, chan);
}

else if (message == "Add")
{
integer b = TRUE;
integer m = TRUE;
b = ((llGetListLength(main_menu)) <= 11); //Checks to see if there are 11 destinations in this sim
m = (llGetFreeMemory() >= 1000);//Checks for available memory
if( !b || !m ) // Tests to see if either statement is true
{
llOwnerSay("You can not add any more destinations");
}
else
{
llOwnerSay("What do you want to name this destination?");
state adddest;
}
}

else if(llListFindList(dest,[message]) != -1)
{
llOwnerSay("button said " + (string)message);
integer index = llListFindList(dest, [llList2String(params,0)]);
if(index != -1)
{
vector target = (vector)llList2String(dest, index+1);
integer chanfran = (integer)llFrand(9999999 - 9000000) + 9000000;
vector pos = llGetPos();
llSay(0,"Touch the pumpkin to teleport");
llRezObject(object, (pos + llRot2Fwd(llGetRot()) + <1.2,1.2,0>), ZERO_VECTOR, ZERO_ROTATION, chanfran);
llWhisper(chanfran, (string)target);
}
}
}
}
timer()
{
llSetTimerEvent( 0 );
llListenRemove(chan);
return;
}
}
state adddest
{
state_entry()
{
chan = 0;
llSetTimerEvent(20);
llListen(chan,"",llGetOwner(),"");
}
listen(integer chan, string name, key id, string newdest)
{
integer e = llListFindList(sims, [sim]);
if(e != -1)
{
vector pos = llGetPos();
dest = (dest=[]) + dest + [sim, newdest, pos];
llOwnerSay("Added : " + sim + " , " + newdest + " = " + (string)pos);
state default;
}
else
{
vector pos = llGetPos();
dest = (dest=[]) + dest + [sim, newdest, pos];
llOwnerSay("Added : " + sim + " , " + newdest + " = " + (string)pos);
sims = (sims=[]) + sims +[sim];
state default;
}
}
timer()
{
llListenRemove(chan);
llOwnerSay("Timeout. Click TP HUD to start again");
state default;
}
}

_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
10-05-2006 15:19
Here's your problem:

CODE

list params = llParseString2List(message,[" "],[]);


That's the first line in your listen handler. That will take a 2-word name and make a list out of it. Then later you do:

CODE

else if(llListFindList(dest,[message]) != -1)
{
llOwnerSay("button said " + (string)message);
integer index = llListFindList(dest, [llList2String(params,0)]);


So message is "test test", which is fine, and then you print that in the owner say, and that says "test test". But you use params[0] in the next line for the lookup, not message. And params is a list now, because you split message using spaces as delimiters, so params is [test, test]. I.e. params[0] is "test". And that's your problem. Try adding:

CODE

llOwnerSay(llList2String(params,0));


... in there, and you'll probably see it say "test".

I think something like this would work. Throw away params, and use message directly in the check. So:

CODE

integer index = llListFindList(dest, [message]);


Try that, or something along those lines.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-05-2006 15:27
errrrrrr yep you were right on all counts!!!!! It work fine now.

The really scary part is I understaood what you were saying now and I wouldn't have two weeks ago.

Thank you Ziggy!!!!!!!!!!!!!!!!!!!!!!
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum