TrinityReclusive Posted November 14, 2019 Share Posted November 14, 2019 Well this script does what it should but i can not seem to get it for owner only. The script runs fine but still anyone can use it. Do I have something in the Dialog listen area wrong or left out? ist buttons = ["-", "Red", "White", "Blue"]; string dialogInfo = "\nPlease make a choice."; key ToucherID; key ToucherOwner; integer dialogChannel; integer listenHandle; default { state_entry() { dialogChannel = 2 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) ); } touch_start(integer num_detected) { ToucherID = llDetectedKey(0); ToucherOwner = llGetOwner(); llListenRemove(listenHandle); listenHandle = llListen(dialogChannel, "", ToucherID, ""); llDialog(ToucherID, dialogInfo, buttons, dialogChannel); llSetTimerEvent(60.0); // Here we set a time limit for responses } listen(integer channel, string name, key id, string message) { if (message == "-") { llDialog(ToucherID, dialogInfo, buttons, dialogChannel); return; } llListenRemove(listenHandle); // stop timer since the menu was clicked llSetTimerEvent(0); if (message == "Red") { llSay(2,"Red"); // process Red here } else if (message == "White") { llSay(2,"White"); // process Green here } else { llSay(2,"Blue"); // do any other action here } } timer() { // stop timer llSetTimerEvent(0); llListenRemove(listenHandle); llWhisper(0, "Sorry. You snooze; you lose."); } } I hope some one can notice what i have wrong of missed. Thank you for your help Link to comment Share on other sites More sharing options...
KT Kingsley Posted November 14, 2019 Share Posted November 14, 2019 In the touch_start event you're collecting two ids, that of the toucher and that of the owner. So to make things owner only you should check that the toucher is the owner before going on to open the dialog. if (ToucherID == ToucherOwner) { //open the dialog } Link to comment Share on other sites More sharing options...
TrinityReclusive Posted November 14, 2019 Author Share Posted November 14, 2019 Ok i changed it to this still runs but not for owner only. So i must have it still not correct. list buttons = ["-", "Red", "White", "Blue"]; string dialogInfo = "\nPlease make a choice."; key ToucherID; key ToucherOwner; integer dialogChannel; integer listenHandle; default { state_entry() { dialogChannel = 2 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) ); } touch_start(integer num_detected) {if (ToucherID == ToucherOwner) { //open the dialog } ToucherID = llDetectedKey(0); llListenRemove(listenHandle); listenHandle = llListen(dialogChannel, "", ToucherID, ""); llDialog(ToucherID, dialogInfo, buttons, dialogChannel); llSetTimerEvent(60.0); // Here we set a time limit for responses } listen(integer channel, string name, key id, string message) { if (message == "-") { llDialog(ToucherID, dialogInfo, buttons, dialogChannel); return; } llListenRemove(listenHandle); // stop timer since the menu was clicked llSetTimerEvent(0); if (message == "Red") { llSay(2,"Red"); // process Red here } else if (message == "White") { llSay(2,"White"); // process Green here } else { llSay(2,"Blue"); // do any other action here } } timer() { // stop timer llSetTimerEvent(0); llListenRemove(listenHandle); llWhisper(0, "Sorry. You snooze; you lose."); } } Link to comment Share on other sites More sharing options...
KT Kingsley Posted November 14, 2019 Share Posted November 14, 2019 2 minutes ago, TrinityReclusive said: touch_start(integer num_detected) {if (ToucherID == ToucherOwner) { //open the dialog } ToucherID = llDetectedKey(0); llListenRemove(listenHandle); listenHandle = llListen(dialogChannel, "", ToucherID, ""); llDialog(ToucherID, dialogInfo, buttons, dialogChannel); llSetTimerEvent(60.0); // Here we set a time limit for responses } touch_start(integer num_detected) { ToucherID = llDetectedKey(0); ToucherOwner = llGetOwner(); if (ToucherID == ToucherOwner) { llListenRemove(listenHandle); listenHandle = llListen(dialogChannel, "", ToucherID, ""); llDialog(ToucherID, dialogInfo, buttons, dialogChannel); llSetTimerEvent(60.0); // Here we set a time limit for responses } } Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 14, 2019 Share Posted November 14, 2019 That's because you left two extra curly brackets in.. Get rid of them: touch_start(integer num_detected) { if (ToucherID == ToucherOwner) { ToucherID = llDetectedKey(0); llListenRemove(listenHandle); listenHandle = llListen(dialogChannel, "", ToucherID, ""); llDialog(ToucherID, dialogInfo, buttons, dialogChannel); llSetTimerEvent(60.0); // Here we set a time limit for responses } } Link to comment Share on other sites More sharing options...
TrinityReclusive Posted November 14, 2019 Author Share Posted November 14, 2019 Thanks it works now.. I always seem to get brackets wrong but getting better, Thank you all for your help. I would go nuts if it where not for your help on this thank you so much. 1 Link to comment Share on other sites More sharing options...
TrinityReclusive Posted March 25, 2023 Author Share Posted March 25, 2023 Resolved 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