mIRC Home    About    Download    Register    News    Help

Print Thread
problem #181191 19/07/07 04:58 PM
Joined: Jul 2007
Posts: 15
4
4ndr3w Offline OP
Pikka bird
OP Offline
Pikka bird
4
Joined: Jul 2007
Posts: 15
i have a problem, im trying to get something like this to work

if (1wk 4d 22hrs 10m 0s => %timehere) { return nooo!! }
else ( return yess!!! }

but i cant seem to get it working properly
btw the "1wk 4d 22hrs 10m 0s" could be anything

thanks

Re: problem [Re: 4ndr3w] #181192 19/07/07 05:22 PM
Joined: Dec 2002
Posts: 271
N
NightChillz Offline
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
just use the seconds value, i'm going to assume its ur uptime... either way this will work....

/help $uptime

then comepare it to see if its more then a week

if ($uptime >= $calc(60*60*24*7)) { noooo }
else { yesss }

60seconds*60minutes*24hours*7day = seconds in a week

test it: //echo -a $duration($calc(60*60*24*7))


Re: problem [Re: NightChillz] #181194 19/07/07 05:32 PM
Joined: Jul 2007
Posts: 15
4
4ndr3w Offline OP
Pikka bird
OP Offline
Pikka bird
4
Joined: Jul 2007
Posts: 15
Thanks for the reply, but thats kinda what im looking for but not with $uptime, its wierd what i want it for but let me try n explain a bit more.

if (%var >= 10m) { do }
elseif (%var <=) { dont }

but if %var has a day or something in there it dont work so how would it work.

Re: problem [Re: 4ndr3w] #181196 19/07/07 05:45 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
$duration() is reciprocal (converts in both directions), so you can do this:
Code:
if ($duration(%var) >= $duration(10m)) { do }
else { dont }


It will convert something like 1wk 4days 22hrs 10mins into a number of seconds and compare that with the number of seconds in 10m.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: problem [Re: 4ndr3w] #181199 19/07/07 06:10 PM
Joined: Jul 2007
Posts: 15
4
4ndr3w Offline OP
Pikka bird
OP Offline
Pikka bird
4
Joined: Jul 2007
Posts: 15
Works perfect thanks