mIRC Homepage
Posted By: Dingo setting variables. - 27/10/03 04:22 PM
not sure how to word this,m but I need to have a script set a unuiqe variable, such as %idNick1 %idnick2 etc when particular nicks joins the channel. I've seen it in a few scripts but it doesn't make any sense to me.

Thanks smile
Posted By: Collective Re: setting variables. - 27/10/03 04:28 PM
Code:
on *:JOIN:#:{
  set % $+ $nick 1
}
on *:PART:#:{
  unset % $+ $nick
}

Sets %nick to 1 when they join a channel and unsets it when they part.
Posted By: Dingo Re: setting variables. - 27/10/03 04:32 PM
Thanks Collevtive & EVH. The solution was far to easy i see. but it helps ALOT
Posted By: EVH Re: setting variables. - 27/10/03 04:33 PM
Sorry man .. didn't mean to step on your toes smile
Posted By: Dingo Re: setting variables. - 27/10/03 04:34 PM
I've found you can never have too much help wink
Posted By: Dingo Re: setting variables. - 27/10/03 04:49 PM
another question:

once the variable has been set ( /set %id +$nick ), is there a way to make the script know what the variable ends up as so something more can be done to its contents?
Posted By: theRat Re: setting variables. - 27/10/03 05:44 PM
$var might be useful?
Posted By: Raccoon Re: setting variables. - 28/10/03 07:16 AM
___ Dynamic Variables 101: ___

[Setting your dynamic variable]
mIRC 5.x: /set %MyVar. [ $+ [ $nick ] ] DATA
mIRC 5.x: /var % [ $+ [ $me ] $+ . $+ [ $ctime ] ] = DATA
mIRC 5.x: /set %MyArray. [ $+ [ %x ] $+ . $+ [ %y ] $+ . $+ [ %z ] ] DATA
mIRC 6.x: /var $+(%,MyVar.,$nick) = DATA
mIRC 6.x: /set $+(%,%xyzzy,.,%yatta,.,%zig) DATA
mIRC 6.1x: /var %MyVar. $+ $active = DATA
mIRC 6.1x: /set % $+ $network $+ . $+ $chan DATA

Those last two may also work in earlier versions of 6.x, though personally I prefer using $+(x,y,z)

[Reading your dynamic variable]
mIRC 5.x: /echo -a %MyVar. [ $+ [ $nick ] ]
mIRC 5.x: /echo -a % [ $+ [ $me ] $+ . $+ [ $ctime ] ]
mIRC 6.x: /echo -a $eval($+(%,MyVar.,$nick),2)
mIRC 6.x: /echo -a $($+(%,%xyzzy,.,%yatta,.,%zig),2)

Note that $(...,2) is short for $eval(...,2)
And $+(...) is the same as using many $+ 's

I'm sure there are other methods, but these are the most commonly applied.

- Raccoon
Posted By: qwerty Re: setting variables. - 28/10/03 10:14 AM
Actually the /set %blah $+ $ident <value> format works since as long as I can remember myself using dynamic variables (about 5.5 and later).
Posted By: Raccoon Re: setting variables. - 28/10/03 10:13 PM
Really? I've always found myself using brackets even though they do seem unnecessary for /setting a var. Some reason I was certain %blah tried evaluating prematurely if brackets weren't used.

* Raccoon learns something new.
© mIRC Discussion Forums