GloriaGlitter Posted March 15, 2020 Share Posted March 15, 2020 Hi there - I am writing a simple dialog menu that just has two buttons - one to display a link to a persons profile page and the other to send them an IM message. Where I'm tripping up is that the listener listens to the menu button label - in this case 'Send IM'. This opens up a textbox for the user to type their message - somehow within this listen event, I then need to listen to the typed message and then send that to the target avatar. Here is my script - getting a syntax error on the listen within the listen: ---------------------- string mainMenuDialog; list mainMenuButtons = ["Profile", "Send IM"]; string subMenu_01_Dialog; list subMenu_01_Buttons = []; key user_key="2d55c505-9530-40a9-a153-ce3878b0314b"; integer dialogChannel; integer dialogHandle; key toucher; open_menu(key inputKey, string inputString, list inputList) { dialogChannel = (integer)llFrand(DEBUG_CHANNEL)*-1; dialogHandle = llListen(dialogChannel, "", inputKey, ""); llDialog(inputKey, inputString, inputList, dialogChannel); llSetTimerEvent(60.0); } close_menu() { llSetTimerEvent(0.0);// you can use 0 as well to save memory llListenRemove(dialogHandle); } default { touch_start(integer total_number) { string name = llDetectedName(0); toucher = llDetectedKey(0); // Ensure any outstanding listener is removed before creating a new one close_menu(); mainMenuDialog = "\nProfile and Send IM for secondlife:///app/agent/" + (string)user_key + "/about"; open_menu(toucher, mainMenuDialog, mainMenuButtons); } listen(integer channel, string name, key toucher, string message) { if(channel != dialogChannel) return; close_menu(); if(message == "Profile") { subMenu_01_Dialog = "\nFor profile, click link: secondlife:///app/agent/" + (string)user_key + "/about"; open_menu (toucher, subMenu_01_Dialog, subMenu_01_Buttons); } else if(message == "Send IM") { llTextBox(toucher, "Write your message and click 'Submit' (max 512 chars", channel); } listen(integer channel, string name, key toucher, string IMmessage) { llInstantMessage (user_key, "Message from: " + name + " - '" + IMmessage + "'"); } } timer() { close_menu(); llWhisper(0, "Disabling Menu"); } } Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 15, 2020 Share Posted March 15, 2020 You cannot put one event inside another one, and you cannot have two instances of the same event in a state. Just listen for the text box message and send it along as an IM. else if(message == "Send IM") { llTextBox(toucher, "Write your message and click 'Submit' (max 512 chars)", channel); } else { llInstantMessage (user_key, "Message from: " + name + " - '" + message + "'"); } Link to comment Share on other sites More sharing options...
GloriaGlitter Posted March 15, 2020 Author Share Posted March 15, 2020 Thanks Rolig 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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