Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Little Help :0

Jenn Yoshikawa
Registered User
Join date: 14 Nov 2007
Posts: 91
11-10-2008 12:08
Ok I'm working on some Restrained Life viewer scripts. I when I use the command get the list of worn clothes

The viewer send a list of 0s and 1s corresponds to : 00111000

gloves,jacket,pants,shirt,shoes,skirt,socks,underpants,undershirt,skin,eyes,hair,shape
in that order.

If a part is specified, answers a single 0 (empty) or 1 (occupied) corresponding to the part.

IE 00111000

chould some one show me how to set this up for a dialog. Lists ack bug me hehe. I know you would have to have 2 lists one to know the place of the 00111000 commands and the second one for dialog commands
gloves,jacket,pants,shirt,shoes,skirt,socks,underpants,undershirt,skin,eyes,hair,shape.

Jenn
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
11-10-2008 14:27
Not tested but something like this does the trick, call buildDialog with the string returned then call your lldialog using menu and text. It works well for garments because they are only one dialog, attachments are harder,

list WORN =["Gloves","Jacket","Pants","Shirt","Shoes","Skirt","Socks","Underpants","Undershirt"];

list menu;
string text;

buildDialog(string data)
{
integer i;
menu = [];
for(i = 0; i < 9; ++i)
{
if(llGetSubString(data, i, i) == "1";)
{
menu += llList2List(WORN, i, i);
}
else
{
menu += [" "];
}
}
text = "Select item to remove";
}
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-10-2008 16:17
CODE

list listClothes =["Gloves", "Jacket", "Pants", "Shirt", "Shoes", "Skirt", "Socks", "Underpants", "Undershirt"];
list listWorn;
string data = "00111000";
integer listenHandle;
integer listenChan = -983467;

buildDialog(){
integer i;
listWorn =[];
for (i = 0; i < llGetListLength(listClothes); ++i) {
if ((integer)llGetSubString(data, i, i)) {
//Since you just so happen to be using 0's & 1's which correspond to TRUE and FALSE
//You can use an if(TRUE test by casting the string to an integer
listWorn += llList2List(listClothes, i, i);
//Skipping the ellse test means you will only have as many buttons as worn items
}
}
}

default {
touch_start(integer n) {
key touchKey = llDetectedKey(n);
listenHandle = llListen(listenChan,"",touchKey,"");
llSetTimerEvent(30.0);
buildDialog();
llDialog(touchKey, "worn items", listWorn, listenChan);
}
listen(integer channel, string name, key id, string msg) {
llOwnerSay(msg);
llListenRemove(listenHandle);
}
timer() {
llListenRemove(listenHandle);
//nice and neat, This is a bcakup to remove the listen in case the user hits ignore instead
}
}
_____________________
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