This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Waiting A Few Seconds Before Getting A Value From A Proc

Old posts that have not been replied to for several years.
Locked
User avatar
CoMMy
Halfop
Posts: 99
Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus

Waiting A Few Seconds Before Getting A Value From A Proc

Post by CoMMy »

Hey Guys.
Im Stuck again.

I have a timer in a proc.

Code: Select all

utimer 10 "putlog {[Is:X:Alive]}"
Everything is ok. What i mean is that the [Is:X:Alive] Gets the return from that proc. But what i want is to wait 10 seconds BEFORE it captures the return from the [Is:X:Alive] proc and not immediatelly.

Can you help?

Thanks :)
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

I'm not sure what you mean. Do you mean that you want to call Is:X:Alive and then print the return value 10 seconds later? Or, you want to wait 10 seconds, then call Is:X:Alive and print the return value right away? Or...?
User avatar
CoMMy
Halfop
Posts: 99
Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus

Post by CoMMy »

stdragon said:
I'm not sure what you mean. Do you mean that you want to call Is:X:Alive and then print the return value 10 seconds later? Or, you want to wait 10 seconds, then call Is:X:Alive and print the return value right away? Or...?
I want the second one!!! I want to want to wait 10 seconds, then call Is:X:Alive and print the return value right away.
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Really, the best way to do a timer is to make a proc for it, not try to put a bunch of code in the timer command itself. So do something like this:

proc my_timer_func {} {
putlog [isxalive]
... other stuff if necessary ...
return 0
}

Then to call it, simply:

utimer 10 my_timer_func

The other way would be to do something like

utimer 10 {putlog [isxalive]}

But that's not as nice.

Yet another option is to modify the isxalive proc and add a putlog at the end to print out the value, and then your timer call would simply be

utimer 10 isxalive
User avatar
CoMMy
Halfop
Posts: 99
Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus

Post by CoMMy »

Thanks Man. U did it again! :mrgreen:
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
Locked