Jump to content
You are about to reply to a thread that has been inactive for 4270 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Posted

Hi, my name is Xero Westminster. I'm currently trying to put together an advanced menu-sensory system that can output two different strings using a single channel, but so far, I've had no luck in accomplishing this.

The basic framework is:
1) Click on a prim
2.1) Produce a Dialog for multiple options from list [options] on [channel] / llListen() assigned to a temporary integer
2.2) Assign string [chosen_option] based on msg;
3) Without regard to a specific option, perform a sensor sweep once for other avatars within 10m
4.1) Produce another Dialog listing avatars in range
4.2) Selected name of avatar assigned to string [target_av]

The desired output I'm trying to achieve is to have llOwnerSay( [option] + " for " + [target_av] ), using only one channel. Everything works fine, except for the output, because it returns [option] = [option] and [target_av] = [option], so the output comes out as llOwnerSay( [option] + " for " + [option] );

How can I remedy this?

Posted

Without seeing your code it's a bit difficult to make suggestions, but if you must only use the one channel, then how about having two lists, one liActions, which is hard-coded, and another, liNames, which is populated at run-time.

Then, when you hear back from the dialog, you say something like 

	if (~llListFindList(liActions,[message])){			option = message;		}		else if (~llListFindList(liNames,[message])){			target_av = message;			llOwnerSay(option+" for "+target_av);		}

 

Posted

The way I have it set up is so that there's an integer used for indexing to handle how the messages from llDialog are handled. Once one handler is fulfilled, the index changes, and the next llDialog right after is handled separately. And as it turns out, all I really needed to do was add in "return;" in the first if(condition) statement for the index. But I'll definitely keep your suggestion written down for the future Much appreciated!

Posted

You need to sequence the comportment of your script .

 

To sequence , use the states 

For instance :

one state ( the default ) to manage the touch

one state to manage the option menu

one state to manage the avatars menu

 

list listOptions = [ "banana", "egg", "cheese" , "pizza" ];list listAvatarsSensor;integer channelDialog ;integer handleListener;string choicedOption ;string avatarNameHavingMenu;key avatarKeyHavingMenu;float timerDialog = 15.0;float range = 10.0;default{    // We dont want several users using at the same time the menu    touch_end(integer total_number)    {        // lets s store the avatar havaing the menu to be able to dialog with him in teh other states        avatarNameHavingMenu = llDetectedName(0);        avatarKeyHavingMenu =llDetectedKey(0);        state firstDialog;     }}// This state starts to display the menu of option to the user // After his choice , this state will scan the avatars around the prim// and  go to the next state ( display the second menu )state firstDialog{    state_entry()    {        channelDialog= (integer)(llFrand(-1000000000.0) - 1000000000.0);        handleListener = llListen(channelDialog, avatarNameHavingMenu , avatarKeyHavingMenu  , "");        llDialog(avatarKeyHavingMenu, "Choose an option" , listOptions, channelDialog );        llSetTimerEvent(timerDialog);     }    listen( integer i, string n , key k, string m)    {        // the user having the menu has answered his choice of option .        // let s scan the avatars to be able to build the second menu        choicedOption = m;        llSensor("",NULL_KEY,AGENT,range,PI);    }    sensor(integer n)    {        integer i ;        listAvatarsSensor = [];        do        {            listAvatarsSensor += llGetSubString(llDetectedName(i), 0, 23) ;            i++;        } while ( i < n);        state secondDialog;    }    timer()    {        // the user doesn t answer . Ok . Let s give up and we return in the default state         state default;    }     state_exit()    {        // normally we don t need to release the listener . It s released automatically after change states        llListenRemove(handleListener);
llSetTimerEvent(0.0); }} state secondDialog{ state_entry() { channelDialog= (integer)(llFrand(-1000000000.0) - 1000000000.0); handleListener = llListen(channelDialog, avatarNameHavingMenu, avatarKeyHavingMenu , ""); llDialog( avatarKeyHavingMenu, "Choose an avatar" , listAvatarsSensor, channelDialog ); llSetTimerEvent(timerDialog); } listen( integer i, string n , key k, string m) { // the user having the menu has answered his choice of avatar . // let s do our action "llownerSay" and let s go back at the default state to be able to detect other touch events llOwnerSay( choicedOption + " for " + m ); state default; } timer() { // the user doesn t answer . Ok . Let s give up and we return in the default state state default; } state_exit() { // normally we don t needd to release the listener . It s released automatically after change states llListenRemove(handleListener);
llSetTimerEvent(0.0); } }

 

You are about to reply to a thread that has been inactive for 4270 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...