|
Dnali Anabuki
Still Crazy
Join date: 17 Oct 2006
Posts: 1,633
|
11-18-2007 10:19
Very very new to scripting who loves to build. I am making some items that have several options in terms of SetParameters and wonder if I should have the object listen on an obscure channel to its owner or provide a menu?
For some reason, I have the idea that the menu is less laggy. Is this true? And does a menu have to have a timer event to work properly?
And is setting up a menu way past a beginner?
Thanks for any help.
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
11-18-2007 10:46
Welcome!  I really wouldn't worry about the lag effects in this case because (as I understand the application) with either the dialog or the chat command interface, the script will be listening to only one agent: the owner. (Scripts use the same llListen() function to get responses from llDialog menus as they do for listening to chat.) It's moderately naughty to have it listen for commands on channel 0, even if the listen is filtered to the owner, but really that concern is trumped by the question of which is the more convenient user interface. (If the scripted item can be conveniently touched and if it's not used very frequently, it's generally better to use a dialog, just because recognition is so much better than recall: I can remember which button to press because they're all out there to choose from, but can't remember what command to say because it could be anything.) About the timer: Not usually necessary, especially if there's only one person who can be interacting with the script at any time, and if the script can just leave everything "as-is" unless or until it gets a response. A dialog isn't out of the range of a beginner, but it probably will help to glance at the Scripting Library or Examples. And if you have questions, come back and ask. 
|
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
11-18-2007 11:08
You can do both. llDialog doesn't need to be set to an obscure channel, although as Oie noted it is best to avoid channel 0. llDialog 'talks' on behalf of the user. So '/1 hide' will work both as a spoken command and an llDialog command. If you've already scripted an object for typed commands it is perfectly possible to add the dialog interface on top without having to change the listen Event Handler code. At a minimum it should simply be a case of adding llDialog to the touch_start Event Handler. As for lag there's not a huge amount of difference, although it is possible to remove and add listens with llDialog in a way that's not really practical with typed commands. Rest assured that one listen to just the owner is going to be insignificant by comparison to all the other nonsense going on in SL . 
|
|
Dnali Anabuki
Still Crazy
Join date: 17 Oct 2006
Posts: 1,633
|
11-18-2007 11:32
Thanks Qui and Pale. I feel quite encouraged to continue. Thanks for answering my question without dimming my enthusiasm. Just lovely.
I find the wiki very difficult but it is what got me to llDialogue so it has helped a bit.
Programmers see the world differently than us non programmers. You are lucky to be able to do what you do.
Thanks again.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-18-2007 18:21
the only major benifit to llDialog in this case is that it will allow the use of negative channels, which can be less crowded sometimes, as the only way for an av to speak on a negative channel normally is through a dialog.... this will prevent using /# commands though and force reliance on the dialog... but has the benifit of not having to check for case, or ignoring mispelled commands (since they'll match the button) there is only one other drawback and that's the amount of text that's readable on a button.... if you are parsing chained commands, the text may not all be visible (or fit) on a button
_____________________
| | . "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... | - 
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-18-2007 19:08
From: Dnali Anabuki Thanks Qui and Pale. I feel quite encouraged to continue. Thanks for answering my question without dimming my enthusiasm. Just lovely.
I find the wiki very difficult but it is what got me to llDialogue so it has helped a bit.
Programmers see the world differently than us non programmers. You are lucky to be able to do what you do.
Thanks again. I was a non programmer when I started. You know now what llSay and llDialog means. This little pool of previously unknown words will grow, one word at a time. In a surprisingly short amount of time you will get where you can consistently write more advanced scripts. But then again you will also find that you will also be learning little nuances to make your code better for a very long time. Also don't just rely on one wiki, each has different comments and examples. Sometimes it becomes clear when you find the right one. http://wiki.secondlife.com/wiki/Main_Pagehttp://lslwiki.net/lslwiki/wakka.php?wakka=HomePagehttp://rpgstats.com/wiki/index.php?title=Main_PageI also use Osgeld's downloadable version which comes in very handy or conversely you can just download LSLEditor. It now gives you your choice of which wiki to use or it has it own built in one which used Osgeld's.
_____________________
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
|
11-18-2007 19:48
I am a big proponent of dialog menus for commands that are going to be used multiple times. Don't really understand why they aren't used more. Absolutely hate typing stuff like /99 ao off etc. The other big thing was pointed out but is worth expanding on; If you have an object that 99% of the time is just going to be sitting there processing an open listen and not doing anything then either change it to a touch on/off or put in a dialog menu with a handle in the listen to remove it if not in use. OK, I know, that was a huge sentence without a comma or period  Not gonna re-type it. If you need some basic menu script examples and can't find any then please let us know. Here is one to start you off with: integer CHANNEL = 42; list MENU_MAIN = ["Hi", "Bye"];// main menu list MENU_OPTIONS = ["English", "Spanish", "Finished"]; // a submenu string message2;
default { state_entry() { llListen(CHANNEL, "", NULL_KEY, ""); }
touch_start(integer total_number) { llDialog(llDetectedKey(0), "What Do you want to say?", MENU_MAIN, CHANNEL); }
listen(integer channel, string name, key id, string message) { if (llListFindList(MENU_MAIN + MENU_OPTIONS, [message]) != -1) { llSay(0, name + " picked the option '" + message + "'."); if (message == "Hi" | message == "Bye") { llDialog(id, "Which Language!", MENU_OPTIONS, CHANNEL); message2 = message; } else if (message == "Finished") { } else { if(message2 == "Hi") { if(message == "English") { llSay(0, "Hello"); llDialog(id, "What Do you want to say?", MENU_MAIN, CHANNEL); } else { llSay(0, "Hola"); llDialog(id, "What Do you want to say?", MENU_MAIN, CHANNEL); } } else { if(message == "English") { llSay(0, "Goodbye"); llDialog(id, "What Do you want to say?", MENU_MAIN, CHANNEL); } else { llSay(0, "Hasta luego"); llDialog(id, "What Do you want to say?", MENU_MAIN, CHANNEL); }
} message2 = ""; } } } }
If it is too confusing then I'll break it down to one simple menu without a submenu.
_____________________
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
|