XbabylonX Posted March 11, 2014 Share Posted March 11, 2014 default { on_rez(integer start_param) { llResetScript(); } changed(integer change) { if (change & (CHANGED_OWNER | CHANGED_INVENTORY)) llResetScript(); } state_entry() { state First; } } state First { state_entry() { llSetText("Please wait...", <1.000, 0.863, 0.000>, 1.0 ); //HERE CODE FOR COMMUNICATING WITH A WEBSERVER } http_response(key request_id, integer status, list metadata, string body) { if (request_id==myRequest) { //THE RESPONSE OF THE WEBSERVER IS BEING SET AS TEXT ON THE PRIM llSetText(body, <1.000, 0.863, 0.000>, 1.0 ); } } }Hello, I have a problem with the script above.When I rez a prim with this script in it for the first time, everything goes as it should.The problem is when I take back the rezed prim in my inventory and then re-rez it again. It has as a text the webserver's response it took when it was rezzed for the first time.Shouldnt the llResetScript() solve this issue and force the script to run from the beggining when rezed for the second time?Thank you for your time. Link to comment Share on other sites More sharing options...
Freya Mokusei Posted March 11, 2014 Share Posted March 11, 2014 No, because state 'First' does not have an on_rez event. on_rez and changed, as written, will only fire while the script is in the default state. Move them into the state First or consolidate First into default (since right now, one of your states is serving no function). Link to comment Share on other sites More sharing options...
XbabylonX Posted March 11, 2014 Author Share Posted March 11, 2014 Before splitting the script in 2 states, the whole code was only in the default state. Doesnt work either. Link to comment Share on other sites More sharing options...
Freya Mokusei Posted March 11, 2014 Share Posted March 11, 2014 default{ state_entry() { llSetText("Please wait...", <1.000, 0.863, 0.000>, 1.0 ); llSleep(10.0); //Sleep mostly for fun, but also to demonstrate reset state more visibly. //HERE CODE FOR COMMUNICATING WITH A WEBSERVER } http_response(key request_id, integer status, list metadata, string body) { if (request_id==myRequest) { //THE RESPONSE OF THE WEBSERVER IS BEING SET AS TEXT ON THE PRIM llSetText(body, <1.000, 0.863, 0.000>, 1.0 ); } } on_rez(integer start_param) { llResetScript(); } changed(integer change) { if (change & (CHANGED_OWNER | CHANGED_INVENTORY)) { llResetScript(); } }} This won't compile by copy/pasting, I assume you've reduced it (at least by removing initialisation of request_id). Bear this in mind when testing - aside from this, it's perfectly valid LSL. If you're having further problems, please expand. Link to comment Share on other sites More sharing options...
XbabylonX Posted March 11, 2014 Author Share Posted March 11, 2014 Nope, even the logic of pausing the script for few seconds (its just a visually solution*), the text is still there. *That made the first rez just to be delayed 10 seconds, it doesnt fix the second rez. Link to comment Share on other sites More sharing options...
Freya Mokusei Posted March 11, 2014 Share Posted March 11, 2014 o_O Weird. I am unable to debug further, sorry. Link to comment Share on other sites More sharing options...
XbabylonX Posted March 11, 2014 Author Share Posted March 11, 2014 Thank you anyway Link to comment Share on other sites More sharing options...
XbabylonX Posted March 11, 2014 Author Share Posted March 11, 2014 Ok I found it. The on_rez is needed in every state the script contains... Link to comment Share on other sites More sharing options...
Freya Mokusei Posted March 12, 2014 Share Posted March 12, 2014 Yeah, if you want an event to fire guaranteed - you should either consolidate your states or copy the event into each state. Since you weren't using on_rez or changed in multiple ways I suggested consolidation. Glad to hear you got it 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