mIRC Homepage
Posted By: 4ndr3w problem - 19/07/07 04:58 PM
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

Posted By: NightChillz Re: problem - 19/07/07 05:22 PM
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))

Posted By: 4ndr3w Re: problem - 19/07/07 05:32 PM
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.
Posted By: starbucks_mafia Re: problem - 19/07/07 05:45 PM
$duration() is reciprocal (converts in both directions), so you can do this:
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.
Posted By: 4ndr3w Re: problem - 19/07/07 06:10 PM
Works perfect thanks
© mIRC Discussion Forums