mIRC Home    About    Download    Register    News    Help

Print Thread
#175748 27/04/07 08:00 PM
Joined: Mar 2007
Posts: 60
S
Babel fish
OP Offline
Babel fish
S
Joined: Mar 2007
Posts: 60
on *:VARIABLE:{

I think this would be a nice addition to the events.

The way this would work is that each time a variable was set $1 would be the item (variable name) and $2- would be its value or something similar. I will show you an example of how this is helpful.

Suppose you have variable %A in 10 scripts. Each one of the scripts triggers at different times. Suppose you wanted a command to trigger when the variable was at a certain value. Instead of adding a check feature to all 10 scripts you could add something like this:

on *:VARIABLE:{ if ($1 = A) && ($2 = 100) { /echo -a * Variable $1 is now at value $2) } }

If the item was A and the value of it was 100, it would trigger.

Thanks for your time.

-Andrew


"In order to succeed, your desire for success should be greater than your fear of failure."
Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
As a scripted solution, you could use a signal to do this, with the use of a couple of aliases for var and set.

alias var { var $1- | signal varchange var $1- }
alias set { set $1- | signal varchange set $1- }

Or something along those lines, parsing the data would be a little more work because of the various var/set formats that can be used, but it is certainly doable.


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Om3n #175769 28/04/07 09:28 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Aliasing var will break local variables, because the variable will be local to the /var alias.

Aliasing set will also break /var considering mIRC calls /set -l internally and it will thus be local to the /set alias.

hixxy #175810 28/04/07 10:20 PM
Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
Indeed, i guess i completely overlooked the behavior of local variables.


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Joined: Dec 2002
Posts: 580
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
There would be tremendous overhead to adding such a feature. It is also not very good programming. If you already have ten scripts modifying the same global variable, then why not create an eleventh that does this...
Code:
alias startChecks { .timerChecks 0 1 checkVariables }
alias checkVariables {
  if (%A > 100) { /echo -a * Variable $1 is now at value $2) }
  if (%Monkey > %Flying) { /echo -a * Cool Monkies can fly!! :) }
}



NaquadaBomb
www.mirc-dll.com
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Regarding performance, I get the same headache as NaquadaServ. Spiritfire3292 will not misuse such an event but, to be sure, many people out there will.
Think of While-Loops using global vars, or ppl not using a (fictive)
Code:
on *:var: {
 if (($1 == v.name) && ($2 > my.limit)) { stuff }
}

but
Code:
on *:var: {
 if (stuff isin $1) { triggering stuff }
}

or even
Code:
on *:var: {
 if (($hget(vars.to.watch,$1)) && ($2 // $ifmatch)) { stuff }
}

and what about things like
Code:
on *:var: {
 ...
 while ($2 > limit) { set $2 another lower value }
}

etc ? (just thinking aloud) Well, it might be a desirous event, anyway smile


Link Copied to Clipboard