Jump to content

Paused Timer


DarkEmperor13
 Share

You are about to reply to a thread that has been inactive for 932 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

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.

  • Like 1
Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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

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.
      }
}

 

  • Thanks 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 932 days.

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
 Share

×
×
  • Create New...