NikosFevara 0 Posted February 25, 2019 Share Posted February 25, 2019 Hey guys. Been working on this little PA script and im stuck at this point. Everything works except for displaying in the above avatar text who clicked it. It's picking up the owner perfectly fine but not who's clicking it (I'm working on the bite option ATM) . Its probably something simple but any help is appreciated. list buttons = ["Lick", "Rub", "Bite", "Suck On", "-"]; string dialogInfo = "\nHow do you want to tease them?."; key avatar; string OWNER; string OWNERNAME; string touchername; key toucher; integer dialogChannel; integer listenHandle; default { state_entry() { dialogChannel = -1 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) ); avatar = llKey2Name(OWNER = llGetOwner()); OWNERNAME = llGetDisplayName(OWNER = llGetOwner()); } touch_start(integer num_detected) { key toucher = llDetectedKey(0); string touchername = llGetDisplayName(toucher); llListenRemove(listenHandle); listenHandle = llListen(dialogChannel, "", toucher, ""); llDialog(toucher, dialogInfo, buttons, dialogChannel); llSetTimerEvent(60.0); } listen(integer channel, string name, key id, string message) { if (message == "-") { llDialog(toucher, dialogInfo, buttons, dialogChannel); return; } llListenRemove(listenHandle); llSetTimerEvent(0); if (message == "Lick") { llMessageLinked(LINK_SET,0,"arousalClearText|"+OWNER, ""); llMessageLinked(LINK_SET,0,"arousalSetText|"+OWNER+"|"+"1"+"| "+touchername+" Text Here ", ""); llMessageLinked(LINK_SET,0,"caeilarousalup|"+OWNER+"|35" + "|" , ""); } else if (message == "Bite") { llMessageLinked(LINK_SET,0,"arousalClearText|"+OWNER, ""); llMessageLinked(LINK_SET,0,"arousalSetText|"+OWNER+"|"+"2"+"| "+touchername+" text here "+OWNERNAME+" text here ", ""); llMessageLinked(LINK_SET,0,"caeilarousalup|"+OWNER+"|75" + "|" , ""); } else if (message == "Suck On") { //action } else if (message == "Rub") { //action } else { //action } } timer() { // stop timer llSetTimerEvent(0); llListenRemove(listenHandle); } } Link to post Share on other sites
Rolig Loon 26,622 Posted February 25, 2019 Share Posted February 25, 2019 You redefined the variable touchername in the touch_start event, creating a second, local variable with the same name as your global variable. The global variable never collects the toucher's name because you never use it. 2 Link to post Share on other sites
NikosFevara 0 Posted February 25, 2019 Author Share Posted February 25, 2019 37 minutes ago, Rolig Loon said: You redefined the variable touchername in the touch_start event, creating a second, local variable with the same name as your global variable. The global variable never collects the toucher's name because you never use it. OMG thankyou, i knew it would be something as simple as that. Your help is greatly appreciated Link to post Share on other sites
Profaitchikenz Haiku 677 Posted February 25, 2019 Share Posted February 25, 2019 Also, in the listen event, you are trying to dialog "toucher", when you should be using "id", because "toucher" is only known to the touch event. 1 Link to post Share on other sites
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now