mIRC Homepage
Posted By: benjy355 Better Variable/Command locating - 27/10/05 12:52 AM
example, $iif(%x == 1, set user. [ $+ $nick ] 1)
that usually comes out as user. 1
no nickname (noooo)
i'm just guessing that the evaluation barrakets are the problem but... it wooould be usefull laugh
Posted By: FiberOPtics Re: Better Variable/Command locating - 27/10/05 01:13 AM
You're simply misusing the evaluation brackets, and ironically you don't even need them. Moreover you're trying to set something that's not even a variable (not prefixed with %)

Btw you realise $nick is only filled in certain events where a nickname caused the event to trigger, right?

Here's an example using $me instead of $nick, which is always filled:

; /saywhat?

alias saywhat? {
var %x = 1
$iif(%x == 1,set -s %user. $+ $me 1)
unset -s %user. [ $+ [ $me ] ]
}

Btw $iif is in general not to be used to let commands trigger in, although it's possible. If you want to execute commands use /if:

if (%x == 1) set -s %user. $+ $me 1

I think your explanation makes no sense really, since the way you use the evaluation brackets, $nick doesn' even evaluate to $null, it stays as "$nick".

Try this:

alias saywhat?? {
var %x = 1
$iif(%x == 1,set -s %user. [ $+ $nick ] 1)
unset -s %user. [ $+ $nick ]
}

/saywhat??
--> * Set %user.$nick to 1
--> * Unset %user.$nick

However remove the evaluation brackets to let everything evaluate properly and you get:

alias saywhat??? {
var %x = 1
$iif(%x == 1,set -s %user. $+ $nick 1)
unset -s %user. [ $+ [ $nick ] ]
}

/saywhat???
--> * Set %user. to 1
--> * Unset %user.

As you can see, $nick rightfully evaluated to $null, since $nick isn't filled if you call it from the commandline.

The only correct solution here is the first, so that's the one you should be using. It's also the one with the least heavy syntax, as you don't need evaluation brackets ever when setting a dynamic variable.


Posted By: benjy355 Re: Better Variable/Command locating - 27/10/05 01:18 AM
oh i'm well aware it would work that way, but it would be a usefull tool for some of the newer scripters =\
Posted By: FiberOPtics Re: Better Variable/Command locating - 27/10/05 01:21 AM
What would be a useful tool?

I just fully explained you how you will achieve the different results, if you are not getting the required result that's because you are not using it correctly.
Posted By: hixxy Re: Better Variable/Command locating - 27/10/05 01:27 AM
Quote:
What would be a useful tool?


I think he means he wants mIRC to read the users mind and fix incorrect syntax smirk
Posted By: FiberOPtics Re: Better Variable/Command locating - 27/10/05 01:48 AM
Hehe, that made me lol laugh
Posted By: benjy355 Re: Better Variable/Command locating - 27/10/05 01:52 AM
Gah, since we're pretty close to done that (I... Hope), and I don't want to make a new topic... I'll just post an idea I just thought of :P
Editing Scripts without actually loading/activiating them...
I've tried using notepad to edit 'em but of course I'm all aboot stynax and mIRC does that for you :P
Just a thought laugh
Posted By: mIRCManiac Re: Better Variable/Command locating - 27/10/05 02:55 AM
Clicky Clicky
Posted By: Mpdreamz Re: Better Variable/Command locating - 27/10/05 08:30 AM
using $+() to set dynamic variables is alot more tidy and easier to debug and less pain up your rectum. i.e
set $+(%,join.,$nick,.,$chan) 1
In my humble opinion you never have any need for evaluation brackets in mIRCscripting thanks to $+ and $eval() which look and work alot better.
Posted By: FiberOPtics Re: Better Variable/Command locating - 12/11/05 01:56 PM
There are always cases where evaluation brackets can come in handy, because they allow you to specify the order of evaluation:

//var %rgb = 1,1,1 | echo -a > $rgb( [ %rgb ] )
© mIRC Discussion Forums