mIRC Home    About    Download    Register    News    Help

Print Thread
#133150 17/10/05 06:24 PM
Joined: May 2005
Posts: 79
M
Babel fish
OP Offline
Babel fish
M
Joined: May 2005
Posts: 79
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

#133151 17/10/05 06:28 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
set %idle N * 60

That will set the %idle value to seconds instead of minutes.


Gone.
#133152 17/10/05 06:34 PM
Joined: May 2005
Posts: 79
M
Babel fish
OP Offline
Babel fish
M
Joined: May 2005
Posts: 79
Hmm, i get * /if: invalid format now

#133153 17/10/05 06:38 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.



Gone.
#133154 17/10/05 06:43 PM
Joined: May 2005
Posts: 79
M
Babel fish
OP Offline
Babel fish
M
Joined: May 2005
Posts: 79
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

#133155 17/10/05 06:45 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.


Gone.

Link Copied to Clipboard