mIRC Homepage
Posted By: Mary_juana dialog stuff - 17/10/05 06:24 PM
This line of code is part of an alias for an idle check

scon -at1 inc % $+ $(a |,0) if ($idle > 3600) inc % $+ b

thing is, i have made a dialog with a few options here and there, and have an editbox to place an idle time

ie; i put it in minutes, '60'

and a var will be set %idle 60 so this line will be

scon -at1 inc % $+ $(a |,0) if ($idle > %idle) inc % $+ b

but idle will now set me away after 60 seconds instead of 1 hour, how would i get around that?
thanks in advance
Posted By: FiberOPtics Re: dialog stuff - 17/10/05 06:28 PM
set %idle N * 60

That will set the %idle value to seconds instead of minutes.
Posted By: Mary_juana Re: dialog stuff - 17/10/05 06:34 PM
Hmm, i get * /if: invalid format now
Posted By: FiberOPtics Re: dialog stuff - 17/10/05 06:38 PM
You realise N is the number of minutes you should fill in, right?

//set -s %idle 10 * 60

That won't make any difference to your if statement in the scon code, if it errors now it must have errored before as well and you only notice it now.

Might I add that's a very nasty way of coding something, and is almost begging for bugs, the way you have your code in that scon. Granted, I've done it myself in the past, but looking back at it, it is a very crappy way of programming.

scon -at1 myalias

alias myalias {
; code
}

Will be much better to read, adapt, debug etc.

Btw just in case you're wondering why you get an error, is because you are not fully aware of the consequences of passing code to scon (double evaluation):

if ($idle > %idle) inc % $+ b
--> this evaluates to if ($idle > inc %b

It evalutes "%idle)" to $null since you don't have such variable. This is the perfect example of why you should use the "myalias" approach and not the one displayed here, unless you are 100% sure of what you're doing, as is the case with Iori and a couple of other scripters on these boards.

Posted By: Mary_juana Re: dialog stuff - 17/10/05 06:43 PM
I got it kind of sorted now

lol at the crappy code, i asked for that stuff over a year ago Iori was the one who gave it to me.

Code:
 alias idlecheck {
  var %a,%b
  scon -at1 inc % $+ $(a |,0) if ($idle > 1800) inc % $+ b
  if %a == %b { 
    ; Your away stuff here
  }
} 


I thought it was pretty good grin
Posted By: FiberOPtics Re: dialog stuff - 17/10/05 06:45 PM
Yes but Iori is a great scripter who's aware of the consequences of scon, you are not. Look at my last lines that I said in my other post, and you will see why Iori's works (it has a hardcoded value 1800) whereas you have a variable that evaluates to $null.
© mIRC Discussion Forums