DarkEmperor13 Posted December 9, 2021 Share Posted December 9, 2021 Is it possible to stop a timer when an attached object is detatched? Im trying to make a demo script Link to comment Share on other sites More sharing options...
Profaitchikenz Haiku Posted December 9, 2021 Share Posted December 9, 2021 (edited) In the attach event, test for the key attach value, if it is NULL_KEY, (meaning it has just been detached or isn't worn but rezzed) use llSetTimerEvent(0.0); Edited December 9, 2021 by Profaitchikenz Haiku Link to comment Share on other sites More sharing options...
Quistess Alpha Posted December 9, 2021 Share Posted December 9, 2021 10 minutes ago, DarkEmperor13 said: Is it possible to stop a timer when an attached object is detatched? Im trying to make a demo script Timer events don't trigger when an object is not in-world to receive them. if you stop the timer when detached, and restart it when attached, it won't have any noticeable effect from what would happen normally. 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted December 9, 2021 Share Posted December 9, 2021 27 minutes ago, Quistess Alpha said: Timer events don't trigger when an object is not in-world to receive them. if you stop the timer when detached, and restart it when attached, it won't have any noticeable effect from what would happen normally. That's another way of saying that scripts do not run while they are in your inventory. As soon as you detach a scripted object. its timer automatically stops. If you have any doubts about whether a timer is OFF when you rez or attach an object from inventory, include llSetTimer(0.0) in your startup sequence. 2 Link to comment Share on other sites More sharing options...
bobsknief Orsini Posted December 9, 2021 Share Posted December 9, 2021 3 hours ago, DarkEmperor13 said: Is it possible to stop a timer when an attached object is detatched? Im trying to make a demo script No, instead you want to run a timer and use llGetTimeStamp(); Inside your timer you compare a stored timestamp to the current timestamp to determent how many seconds have passed. Link to comment Share on other sites More sharing options...
Ariu Arai Posted December 10, 2021 Share Posted December 10, 2021 5 hours ago, bobsknief Orsini said: No, instead you want to run a timer and use llGetTimeStamp(); Inside your timer you compare a stored timestamp to the current timestamp to determent how many seconds have passed. llGetUnixTime is easier to implement as it doesn't require parsing a string. The example below sets an integer variable to the time that the script will do its thing (IE: Delete/detach the product). You would probably want to check the time in the on_rez event, but keep in mind that on_rez triggers before changed does. changed(integer change) { if(change & CHANGED_OWNER)//New owner, set a new time limit. { time_limit = llGetUnixTime() + 300;//300 seconds = 5 minutes. } } timer() { if(llGetUnixTime() > time_limit) { //Do stuff here. } } 1 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