XbabylonX Posted November 23, 2013 Share Posted November 23, 2013 Hello,Im trying for many days to do this, after gatting a callback from a webserver to assign a function on an object, with few words, its a simple prim with no function called when clicking on it, but after the callback it should have a function. With the same logic, depending on the callback value I would like to remove the function. Someone who is familiar with jquery would understand that as:$("#objectid").attr("onClick","newfunction()"); One more thing Im trying to achieve after the callback is to create a global variable, but again with no success.I would appreciate your help.Thank you for your time Link to comment Share on other sites More sharing options...
XbabylonX Posted November 24, 2013 Author Share Posted November 24, 2013 Please ignore everything than the way one can make the object lost its function on touch. Thank you. Link to comment Share on other sites More sharing options...
revochen Mayne Posted November 24, 2013 Share Posted November 24, 2013 There doesn't seems to be a native method available for this purpose. There is no such thing like injections or delegates in LSL. Some time ago scripts were able to do XML RPC calls but those got deprecated and the wiki sais: XML-RPC should not be used anymore. Use http-in instead http://wiki.secondlife.com/wiki/LlOpenRemoteDataChannel So you would need to predefine those methods and variables first in order to activate or initialize them through a http request. Link to comment Share on other sites More sharing options...
Cerise Sorbet Posted November 24, 2013 Share Posted November 24, 2013 On the LSL side, switch to a different state, one that does not have touch* events. Link to comment Share on other sites More sharing options...
XbabylonX Posted November 24, 2013 Author Share Posted November 24, 2013 Thank you for your answer. Even I found a different way of achieving the desired result, you mean that there is no a way to dynamically change the object's (on touch) function depending on some IF statetements? Link to comment Share on other sites More sharing options...
XbabylonX Posted November 24, 2013 Author Share Posted November 24, 2013 Thank you for your answer. Do I have to negate the touch_start? If yes, how this can be done? Link to comment Share on other sites More sharing options...
revochen Mayne Posted November 24, 2013 Share Posted November 24, 2013 Oh sure there is but there is no real native method to inject or delegate a function from an outside source. Your http event may check for certain responses and trigger specific functions or change its state then. Link to comment Share on other sites More sharing options...
Cerise Sorbet Posted November 24, 2013 Share Posted November 24, 2013 You might have two defaults, the usual default plus another state called, say. "active". Inside your default event you would not have any touch*events at all. In your "active" state, you would have the touch* events. You would have the HTTP communications events in both states, so that you can learn when it is time to switch modes. Link to comment Share on other sites More sharing options...
revochen Mayne Posted November 24, 2013 Share Posted November 24, 2013 Either that way or just within a single state which will avoid redundant code. Would look something like this: key requestid;string mode = "default";default{ state_entry() { requestid = llHTTPRequest("http://yourURL.com/interface.php?cmd=get_mode",[HTTP_METHOD,"GET"],""); } touch_start(integer num) { if(mode=="default") { // implement default behaviour } else if(mode=="mode_a") { // implement a custom behaviour } // implement more else if's if required } http_response(key request_id, integer status, list metadata, string body) { if(request_id==requestid) { mode = body; } }} Link to comment Share on other sites More sharing options...
XbabylonX Posted November 24, 2013 Author Share Posted November 24, 2013 Cerise, I have to init my object having the touch trigger and only in some cases (depending the callbacks) I need to cancel the trigger. So isnt possible to use your scenario up side down? Revochen, I didnt mean injecting a function from outside of sl, my server just sends 1 or 0, then the simple things happens: if callback=1 everything fine else if callback=0 remove the touch trigger of the object Maybe that example can point you to the right idea of what Im trying to make. But thanks again guys, I will read your responses tomorrow since I need to sleep Link to comment Share on other sites More sharing options...
XbabylonX Posted November 24, 2013 Author Share Posted November 24, 2013 Even on mouse over the cursor remains as saying "there is a clickable object", indeed the function is no longer available with this scenario. That works too Thank you both! Link to comment Share on other sites More sharing options...
PeterCanessa Oh Posted November 24, 2013 Share Posted November 24, 2013 You might wish to learn LSL at some point, instead of trying to write in a completely alien language. Once you know how it works and what it can do you'll no longer have to waste time hinking it's javascript. 1 Link to comment Share on other sites More sharing options...
revochen Mayne Posted November 26, 2013 Share Posted November 26, 2013 you also may change those mouse behaviour: llSetClickAction(CLICK_ACTION_NONE); // for default cursorllSetClickAction(CLICK_ACTION_TOUCH); // for touch cursor 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