another titler
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
08-04-2009 03:32
Hi me again.  i'm looking to make a titler that can use up to 3 different notecards to get it's data. eg. title = Location + Role + Sub-Role title = "Dark Alley - Police - Chief" one or all of these could be used. (for those of you that visit the Dark Alley you know the one's i'm talking about) if you could point me to any forum posts with code snippets and could provide any help. i can mostly piece code together to get it to work i just need a starting point.
|
Vance Adder
Registered User
Join date: 29 Jan 2009
Posts: 402
|
08-04-2009 05:01
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
08-04-2009 16:37
i have read both of those and have a basic understanding of them. (notecard one. set text is a piece of cake) i think i should have been clearer in my first post. a menu/hud driven titler that can change up to 3 different parts of a single line title. either taking the data from a single/multiple notecard or chat. i'm just looking for snippets of code for some parts. mostly the menu & picking a single line from a notecard.
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
Bump For Pedro
08-06-2009 03:42
guys i'm just looking for some help to bridge the scripts.
1. select specific lines in a note card 2. menu system to do the above.
|
Vance Adder
Registered User
Join date: 29 Jan 2009
Posts: 402
|
08-06-2009 07:14
Would it be easier to just make one notecard? You could format it like: LOCATION Dark Alley ROLE Police SUBROLE Chief SUBROLE Detective ROLE CompanyXYZ SUBROLE CEO SUBROLE Accountant SUBROLE Lawyer SUBROLE Secretary ... etc Then you could create a notecard for each location you want in your titler gadget. http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetNotecardLinehttp://www.lslwiki.net/lslwiki/wakka.php?wakka=llDialogUse llGetNotecardLine to iterate through the notecard and find the keyword "ROLE" and then make a list of those items and present them in the menu using llDialog. Then if they click on the "Police" button, you'd iterate through the SUBROLES under police, put em in a list, and display those on the menu. There are code snippets on using all of that in the links.
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
08-09-2009 18:26
From: Vance Adder Would it be easier to just make one notecard? You could format it like: LOCATION Dark Alley ROLE Police SUBROLE Chief SUBROLE Detective ROLE CompanyXYZ SUBROLE CEO SUBROLE Accountant SUBROLE Lawyer SUBROLE Secretary ... etc Then you could create a notecard for each location you want in your titler gadget. http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetNotecardLinehttp://www.lslwiki.net/lslwiki/wakka.php?wakka=llDialogUse llGetNotecardLine to iterate through the notecard and find the keyword "ROLE" and then make a list of those items and present them in the menu using llDialog. Then if they click on the "Police" button, you'd iterate through the SUBROLES under police, put em in a list, and display those on the menu. There are code snippets on using all of that in the links. i've looked at both of those and can get the Notecard one working (read notecard spits out lines) and the Dialog one (the one copied + pasted off wiki) i've looked all over the forums for "nested menus" and found a few but they are for static options only. this is the basic tree i am trying for : Location | __ Role (police) | ___Sub role (Officer) some of the nested ones on the forums look promising but i don't know how to link a notecard into them.
|
Vance Adder
Registered User
Join date: 29 Jan 2009
Posts: 402
|
08-10-2009 09:56
In regards to nested menus, you might find this informative: /15/a1/282167/1.htmlIf you can get a list from reading your notecard, then you can use that list in llDialog. like.... list lstRoles = [];
// do some code to read the notecard into the list
...
// later on call llDialog like so llDialog(llDetectedKey(0), "Pick a role", lstRoles, CHANNEL);
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
08-10-2009 14:36
From: Vance Adder In regards to nested menus, you might find this informative: /15/a1/282167/1.htmlIf you can get a list from reading your notecard, then you can use that list in llDialog. like.... list lstRoles = [];
// do some code to read the notecard into the list
...
// later on call llDialog like so llDialog(llDetectedKey(0), "Pick a role", lstRoles, CHANNEL);
ty Vance, i read that one and i flew right over my head (like a jet doing mach 9) i'll keep looking. EDIT see below: had another idea. would it be easier to have 2 menu scripts? 1st one an inventory based one, listing the names of notecards. 2nd one performing the menu functions based on the choice made in the first. would that be easier?
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
08-10-2009 22:51
one note card, three lists (easy to follow style) //globals list gLstLoc; list gLstRol; list gLstSub; //in dataserver if (! llSubStringIndex( data, "LOCATION="  { gLstLoc += (list)llStringTrim( llGetSubString( data, 9, -1 ), STRING_TRIM ); gLstLoc += llGetListLength( gLstRol ); }else if (! llSubStringIndex( data, "ROLE="  { gLstRol += (list)llStringTrim( llGetSubString( data, 5, -1 ), STRING_TRIM ); gLstRol += llGetListLength( gLstSub ); }else if (! llSubStringIndex( data, "SUB_ROLE="  { gLstSub += (list)llStringTrim( llGetSubString( data, 9, -1 ), STRING_TRIM ); } //-- when you get EOL gLstLoc += ["END", llGetListLength( gLstRol )]; gLstRol += ["END", llGetListLength( gLstSub )]; locations are llList2ListStrided( gLstLoc, 0, -3, 2 ); roles within a particular location are llList2ListStrided( gLstRol, llList2Integer( LocIndex + 1 ), llList2Integer( LocIndex + 3 ) - 1, 2 ) sub roles within a particular role are llList2ListStrided( gLstSub, llList2Integer( RolIndex + 1 ), llList2Integer( RolIndex + 3 ) - 1, 2 ) this method assumes that there will always be at least one role per location, and at least one sub role per role... order the notecard in the logical order LOCATION= ROLE= SUB_ROLE= SUB_ROLE= ROLE= SUB_ROLE= LOCATION= ROLE= SUB_ROLE= ... etc
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
08-11-2009 19:28
Ty Void (/me gets on hands and knees and bows down.)
i am having some problems making it work, before you say NOT COMPLETE SCRIPT, i know that.
this is the error i'm getting in LsLeditor "No overload for method 'llList2Integer' takes '1' arguments" referring to this line and the other one like it
llList2ListStrided( gLstRol, llList2Integer( LocIndex + 1 ), llList2Integer( LocIndex + 3 ) - 1, 2 );
any ideas??
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
08-11-2009 21:43
From: Tabris Daxter Ty Void (/me gets on hands and knees and bows down.)
i am having some problems making it work, before you say NOT COMPLETE SCRIPT, i know that.
this is the error i'm getting in LsLeditor "No overload for method 'llList2Integer' takes '1' arguments" referring to this line and the other one like it
llList2ListStrided( gLstRol, llList2Integer( LocIndex + 1 ), llList2Integer( LocIndex + 3 ) - 1, 2 );
any ideas?? Whenever you come up with an error like that you can mouse click the function name in LSLEditor (in this case llList2Integer) and hit F1, which will bring up the wiki entry on it. That will show this: "llList2Integer(list src, integer index)" You were telling it the index but forgot to mention the list it should reference Hang in there Tabris! The first script always seems the worst. That is, until you get into a really complex script or start messing with rotations and then you will understand the meaning of the word; "frustration" 
_____________________
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
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
08-12-2009 07:45
jesse got it... should've been llList2Integer( gLst*, *Index + * )
with the appropriate fill-ins for *
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
08-12-2009 10:38
Nice. Gotta love data structures in LSL. LOL.
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
08-12-2009 15:01
Thanks guys, sorry for late reply (time delay I'm in GMT +10) i fixed it & it runs (yay) but i now got a new problem. i'll post the whole script, debug info & notecard. Script:
//globals list gLstLoc; list gLstRol; list gLstSub; string gName; // name of a notecard in the object's inventory integer gLine = 0; integer LocIndex = 0; integer RolIndex = 0; // current line number key gQueryID; // id used to identify dataserver queries integer CHANNEL = 0;
default { state_entry() { //llListen(CHANNEL, "", NULL_KEY, ""); // listen for dialog answers (from multiple users) gName = llGetInventoryName(INVENTORY_NOTECARD, 0); // select the first notecard in the object's inventory gQueryID = llGetNotecardLine(gName, gLine); // request first line }
dataserver(key query_id, string data) { if (query_id == gQueryID) { //if (data != EOF) //in dataserver if (! llSubStringIndex( data, "LOCATION=")) { gLstLoc += (list)llStringTrim( llGetSubString( data, 9, -1 ), STRING_TRIM ); gLstLoc += llGetListLength( gLstRol ); } else if (! llSubStringIndex( data, "ROLE=")) { gLstRol += (list)llStringTrim( llGetSubString( data, 5, -1 ), STRING_TRIM ); gLstRol += llGetListLength( gLstSub ); } else if (! llSubStringIndex( data, "SUB_ROLE=")) { gLstSub += (list)llStringTrim( llGetSubString( data, 9, -1 ), STRING_TRIM ); }
//-- when you get EOL gLstLoc += ["END", llGetListLength( gLstRol )]; gLstRol += ["END", llGetListLength( gLstSub )];
//locations are llList2ListStrided( gLstLoc, 0, -3, 2 ); //roles within a particular location are llList2ListStrided( gLstRol, llList2Integer( gLstRol, LocIndex + 1 ), llList2Integer( gLstRol, LocIndex + 3 ) - 1, 2 ); //sub roles within a particular role are llList2ListStrided( gLstSub, llList2Integer( gLstSub, RolIndex + 1 ), llList2Integer( gLstSub, RolIndex + 3 ) - 1, 2 ); } } touch_start(integer total_number) { llDialog(llDetectedKey(0), "Where Are You?", gLstLoc, CHANNEL); // present dialog on click }
listen(integer channel, string name, key id, string message) { if (llListFindList(gLstLoc + gLstRol, [message]))// != -1) // verify dialog choice { llSay(0, name + " picked the option '" + message + "'."); // output the answer if (message == "Options...") llDialog(id, "Pick an option!", gLstRol, CHANNEL); // present submenu on request else if (message == "...Back") llDialog(id, "What do you want to do?", gLstLoc, CHANNEL); // present main menu on request to go back // here you have the name and key of the user and can easily verify if they have the permission to use that option or not else if (message == "Sit") llSay(0, "This is where stuff would happen if this wasn't just an example"); } else llSay(0, name + " picked invalid option '" + llToLower(message) + "'."); // not a valid dialog choice } }
Debug: *** state_entry() GetInventoryName(7,0)=NoteCard.txt GetNotecardLine("NoteCard.txt",0)=ad67101f-7e73-4eff-891e-adaa566ff5ed *** dataserver(ad67101f-7e73-4eff-891e-adaa566ff5ed,LOCATION= Dark Alley) <-- SubStringIndex(LOCATION= Dark Alley,LOCATION=)=0 <-- GetSubString("LOCATION= Dark Alley",9,-1)=" Dark Alley" <-- llStringTrim(" Dark Alley",3)="Dark Alley" <-- GetListLength([])=0 GetListLength([])=0 GetListLength([])=0 List2ListStrided([Dark Alley,0,END,0],0,1,2)=[Dark Alley] List2Integer([END,0],1)=0 List2Integer([END,0],3)=0 List2ListStrided([END,0],0,1,2)=[END] List2Integer([],1)=0 List2Integer([],3)=0 List2ListStrided([],0,-1,2)=[] Note Card: LOCATION= Dark Alley ROLE= Police SUBROLE= Chief SUBROLE= Detective ROLE= CompanyXYZ SUBROLE= CEO SUBROLE= Accountant SUBROLE= Lawyer SUBROLE= Secretary LOCATION= Yo Mommas ROLE= Big Daddy SUBROLE= _ //End script and related stuff Ok the problem is it's only reading the first line of the notecard. i know it's probably some really stupid thing like a commented out line or something.
|
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
|
08-13-2009 17:31
You must include another call to llGetNotecardLine () inside the dataserver event to get the next line. And you will need to un-comment the if (data != EOF) test to avoid an infinite loop.
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
08-13-2009 18:45
From: EF Klaar You must include another call to llGetNotecardLine () inside the dataserver event to get the next line. And you will need to un-comment the if (data != EOF) test to avoid an infinite loop. Does that mean that i have to put a llGetNotecardLine () for each one of these ** with new variables? ** if (! llSubStringIndex( data, "LOCATION=")) { gLstLoc += (list)llStringTrim( llGetSubString( data, 9, -1 ), STRING_TRIM ); gLstLoc += llGetListLength( gLstRol );
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
08-13-2009 19:33
//globals list gLstLoc; list gLstRol; list gLstSub; string gName; // name of a notecard in the object's inventory integer gLine = 0; integer LocIndex = 0; integer RolIndex = 0; // current line number key gQueryID; // id used to identify dataserver queries integer CHANNEL = 0;
default { state_entry() { //llListen(CHANNEL, "", NULL_KEY, ""); // listen for dialog answers (from multiple users) gName = llGetInventoryName(INVENTORY_NOTECARD, 0); // select the first notecard in the object's inventory gQueryID = llGetNotecardLine(gName, gLine); // request first line }
dataserver(key query_id, string data) { if (query_id == gQueryID) { if (data != EOF) { //in dataserver if (!llSubStringIndex(data, "LOCATION=")) { gLstLoc += (list) llStringTrim(llGetSubString(data, 9, -1), STRING_TRIM); gLstLoc += llGetListLength(gLstRol); } else if (!llSubStringIndex(data, "ROLE=")) { gLstRol += (list) llStringTrim(llGetSubString(data, 5, -1), STRING_TRIM); gLstRol += llGetListLength(gLstSub); } else if (!llSubStringIndex(data, "SUB_ROLE=")) { gLstSub += (list) llStringTrim(llGetSubString(data, 9, -1), STRING_TRIM); }
//-- when you get EOL gLstLoc +=["END", llGetListLength(gLstRol)]; gLstRol +=["END", llGetListLength(gLstSub)];
//locations are llList2ListStrided(gLstLoc, 0, -3, 2); //roles within a particular location are llList2ListStrided(gLstRol, llList2Integer(gLstRol, LocIndex + 1), llList2Integer(gLstRol, LocIndex + 3) - 1, 2); //sub roles within a particular role are llList2ListStrided(gLstSub, llList2Integer(gLstSub, RolIndex + 1), llList2Integer(gLstSub, RolIndex + 3) - 1, 2); ++gLine; gQueryID = llGetNotecardLine(gName, gLine); } } } touch_start(integer total_number) { llDialog(llDetectedKey(0), "Where Are You?", gLstLoc, CHANNEL); // present dialog on click }
listen(integer channel, string name, key id, string message) { if (llListFindList(gLstLoc + gLstRol,[message])) // != -1) // verify dialog choice { llSay(0, name + " picked the option '" + message + "'."); // output the answer if (message == "Options...") llDialog(id, "Pick an option!", gLstRol, CHANNEL); // present submenu on request else if (message == "...Back") llDialog(id, "What do you want to do?", gLstLoc, CHANNEL); // present main menu on request to go back // here you have the name and key of the user and can easily verify if they have the permission to use that option or not else if (message == "Sit") llSay(0, "This is where stuff would happen if this wasn't just an example"); } else llSay(0, name + " picked invalid option '" + llToLower(message) + "'."); // not a valid dialog choice } }
But your logic is not right parsing the data out. You end up with a lot of trash in the dialog menu.
_____________________
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
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
08-13-2009 22:12
From: Jesse Barnett But your logic is not right parsing the data out. You end up with a lot of trash in the dialog menu.
most of that lldialog stuff is cut & paste from http://lslwiki.net/lslwiki/wakka.php?wakka=llDialogat the moment I'm concentrating on getting the notecard to read, then i can work on the rest.
|
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
|
08-14-2009 00:06
You must call llGetNoteCardLine for each line of the notecard: key query_id; integer notecard_line = 0; default { state_entry () { query_id = llGetNotecardLine ("notecard", notecard_line); } dataserver (key id, string data) { if (id == query_id) { if (data != EOF) { //process data query_id = llGetNotecardLine ("notecard", ++notecard_line); } } } }
|
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
|
09-07-2009 18:25
Hey all. just getting back to this script after a bit of a break. i have it reading all the notecard lines now and loading them into lists like it should. the problem now is the dialogue. // Read out a complete notecard from the object's inventory. string gName; // name of a notecard in the object's inventory integer gLine = 0; // current line number key gQueryID; // id used to identify dataserver queries list gLstLoc; list gLstRol; list gLstSub; integer LocIndex = 0; integer RolIndex = 0;
integer CHANNEL = 1;
default { state_entry() { gName = llGetInventoryName(INVENTORY_NOTECARD, 0); // select the first notecard in the object's inventory gQueryID = llGetNotecardLine(gName, gLine); // request first line }
dataserver(key query_id, string data) { if (query_id == gQueryID) { if (data != EOF) { // not at the end of the notecard llSay(0, (string)gLine+": "+data); // output the line ++gLine; // increase line count gQueryID = llGetNotecardLine(gName, gLine); // request next line if (! llSubStringIndex( data, "LOCATION=")) { gLstLoc += (list)llStringTrim( llGetSubString( data, 9, -1 ), STRING_TRIM );
} else if (! llSubStringIndex( data, "ROLE=")) { gLstRol += (list)llStringTrim( llGetSubString( data, 5, -1 ), STRING_TRIM ); gLstRol += llGetListLength( gLstSub ); } else if (! llSubStringIndex( data, "SUB_ROLE=")) { gLstSub += (list)llStringTrim( llGetSubString( data, 9, -1 ), STRING_TRIM ); }
//gLstLoc += [" ", llGetListLength( gLstRol )]; //gLstRol += [" ", llGetListLength( gLstSub )];
//locations are llList2ListStrided( gLstLoc, 0, -3, 2 ); //roles within a particular location are llList2ListStrided( gLstRol, llList2Integer( gLstRol, LocIndex + 1 ), llList2Integer( gLstRol, LocIndex + 3 ) - 1, 2 ); //sub roles within a particular role are llList2ListStrided( gLstSub, llList2Integer( gLstSub, RolIndex + 1 ), llList2Integer( gLstSub, RolIndex + 3 ) - 1, 2 );
} } } touch_start(integer total_number) { llDialog(llDetectedKey(0), "Where Are You?", gLstLoc + gLstRol, CHANNEL); // present dialog on click //llSay(0,(string) gLstLoc); }
listen(integer channel, string name, key id, string message) { if (llListFindList(gLstLoc, [message]) != -1) // verify dialog choice { //llSay(0, name + " picked the option '" + message + "'."); // output the answer if (message == (string)gLstLoc) llDialog(id, "Pick an option!", gLstRol, CHANNEL); // present submenu on request else if (message == "...Back") llDialog(id, "What do you want to do?", gLstSub, CHANNEL); // present main menu on request to go back // here you have the name and key of the user and can easily verify if they have the permission to use that option or not else if (message == "Sit") llSay(0, "This is where stuff would happen if this wasn't just an example"); }// else //llSay(0, name + " picked invalid option '" + llToLower(message) + "'."); // not a valid dialog choice } }
[NOTECARD] LOCATION= Dark Alley ROLE= Police SUBROLE= Chief SUBROLE= Detective ROLE= CompanyXYZ SUBROLE= CEO SUBROLE= Accountant SUBROLE= Lawyer SUBROLE= Secretary LOCATION= Yo Mommas ROLE= Big Daddy SUBROLE= Pimp END [/NOTECARD] if i take out the List "gLstRol" in the top level of the menu it works fine. if it's in the data for both are added and a bunch of 0 (zeros) fill the spaces.
|
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
|
09-08-2009 00:40
This line
gLstRol += (list)llStringTrim( llGetSubString( data, 5, -1 ), STRING_TRIM );
will be conributing to at least part of the problem as the -1 parameter in the llGetSubString call is out of bounds, you should be using llStringLength (data) - 1.
|
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
|
09-08-2009 02:31
gLstRol += llGetListLength( gLstSub );
adds an integer to the list gLstRol.
llDialog(llDetectedKey(0), "Where Are You?", gLstLoc + gLstRol, CHANNEL); // present dialog on click
tries to use this list as labels for dialog buttons, resulting in the error message:
[2:23] Object: llDialog: button list must contain only strings
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-08-2009 04:55
didn't read the whole script, but in this line you're inserting integers into the list which is why you're getting that error
//gLstLoc += [" ", llGetListLength( gLstRol )]; //gLstRol += [" ", llGetListLength( gLstSub )];
if you need the number in the list, then you need to cast it to a string //gLstLoc += [" ", (string)llGetListLength( gLstRol )]; //gLstRol += [" ", (string)llGetListLength( gLstSub )];
|