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.

Looping of script

Old posts that have not been replied to for several years.
Locked
p
phreako
Voice
Posts: 8
Joined: Wed Jul 20, 2005 7:16 pm

Looping of script

Post by phreako »

Looping with numbers

Lets say $variable is 5.

So I want a command to set a timer 5 times according to $variable and it goes something like this,

1st time: utimer 5 doproc
2nd time: utimer 10 doproc
3rd time: utimer 15 doproc
4th time: utimer 20 doproc
5th time: utimer 25 doproc

So it could be like $variable is 10 times and it can go on to 10th time, each time increasing 5 seconds. How do I go about coding it?
d
dwickie
Halfop
Posts: 76
Joined: Sat Aug 21, 2004 8:53 am
Location: /pub/beer

Post by dwickie »

Code: Select all

set variable 5

for {set i 1} {$i <= $variable} {incr i} {
  utimer [expr 5*$i] doproc 
}
this should work, if i get what you want

edit: you probably wanted to do 5min steps $variable times, so i edited
Last edited by dwickie on Mon Aug 01, 2005 8:01 pm, edited 2 times in total.
p
phreako
Voice
Posts: 8
Joined: Wed Jul 20, 2005 7:16 pm

Re: Looping of script

Post by phreako »

Ok thanks a lot!
Locked