dennis Rexie Posted March 29, 2019 Share Posted March 29, 2019 (edited) Hello everybody, i hope some one can help me. I want to save a part message and then, display it on touch. Example in coming message : dial lookup|successful|18,14,27,37,9,31,30|1|Serenity Vista|<65.144257,22.223742,4072.729492> Example script: default { state_entry() { llListen(-805000, "", "", ""); llListen(-905000, "", "", ""); } listen(integer channel, string name, key id, string message) { list parse = llParseString2List(message, ["|"] ,[]); if(llList2String(parse, 0) == "dial lookup") { string message = llList2String(parse, 4); if (llGetListLength(parse) > 4){ llList2String(parse,4); } llSay(0,"" + message); in place of this, need to become on a touch and display the message got this working only wanted to on touch. I hope it is possible. thanks in advance Edited March 29, 2019 by dennis Rexie Link to comment Share on other sites More sharing options...
Fenix Eldritch Posted March 29, 2019 Share Posted March 29, 2019 You could define a global string variable and replace llSay(0,""+message); line with an assignment to the global variable. Then, in your new touch_start event, simply write the llSay command using the global variable. Link to comment Share on other sites More sharing options...
dennis Rexie Posted March 29, 2019 Author Share Posted March 29, 2019 10 minutes ago, Fenix Eldritch said: You could define a global string variable and replace llSay(0,""+message); line with an assignment to the global variable. Then, in your new touch_start event, simply write the llSay command using the global variable. Sorry my scripting is not that good. The message that will displayed in the incoming message = Serenity Vista (see example) Did try it with a touch, but the message is empty. On say it works good. Link to comment Share on other sites More sharing options...
Fenix Eldritch Posted March 29, 2019 Share Posted March 29, 2019 Show us what you tried with the touch event. Post the code and we'll have a look. Link to comment Share on other sites More sharing options...
Qie Niangao Posted March 29, 2019 Share Posted March 29, 2019 I'm guessing here, but it may be that "global variable" needs more explanation. You want the touch_start() event handler to reference the very same "message" as the one the listen() event handler received. To do that, both event handlers need to share a single variable declared at the top of the script, and they must not declare their own, private variable with the same name. 1 Link to comment Share on other sites More sharing options...
Rachel1206 Posted March 29, 2019 Share Posted March 29, 2019 A simple sample on how to: // Defined global string strMessageStored; default { state_entry() { llListen(-805000, "", "", ""); } listen(integer channel, string name, key id, string message) { list parse = llParseString2List(message, ["|"] ,[]); if(llList2String(parse, 0) == "dial lookup") strMessageStored = llList2String(parse, 4); // ... rest of handling } touch_start(integer total_number) { if (strMessageStored!="") llSay(0, "Displaying message: "+strMessageStored); else llSay(0, "No message"); } } Link to comment Share on other sites More sharing options...
dennis Rexie Posted March 29, 2019 Author Share Posted March 29, 2019 Did try this, that is of course not working. Really dont understand the logic of some scripting and some i can do default { state_entry() { llListen(-805000, "", "", ""); llListen(-905000, "", "", ""); } listen(integer channel, string name, key id, string message) { list parse = llParseString2List(message, ["|"] ,[]); if(llList2String(parse, 0) == "dial lookup") { string message = llList2String(parse, 4); if (llGetListLength(parse) > 4){ llList2String(parse,4); }} } touch_start(integer total_number) { llSay(0, "" + message); } } Link to comment Share on other sites More sharing options...
dennis Rexie Posted March 29, 2019 Author Share Posted March 29, 2019 6 minutes ago, Rachel1206 said: A simple sample on how to: // Defined global string strMessageStored; default { state_entry() { llListen(-805000, "", "", ""); } listen(integer channel, string name, key id, string message) { list parse = llParseString2List(message, ["|"] ,[]); if(llList2String(parse, 0) == "dial lookup") strMessageStored = llList2String(parse, 4); // ... rest of handling } touch_start(integer total_number) { if (strMessageStored!="") llSay(0, "Displaying message: "+strMessageStored); else llSay(0, "No message"); } } Very much thanks Rachel, it is perfect 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