mIRC Home    About    Download    Register    News    Help

Topic Options
#133950 - 27/10/05 01:52 AM Better Variable/Command locating
benjy355 Offline
Babel fish

Registered: 27/10/05
Posts: 54
Loc: Canada eh?
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
_________________________
Chat NSN
My Server: sleepystickman.ircxpro.com

Top
#133951 - 27/10/05 02:13 AM Re: Better Variable/Command locating
FiberOPtics Offline
Hoopy frood

Registered: 05/02/04
Posts: 2019
Loc: Leuven, Belgium
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.


_________________________
Gone.

Top
#133952 - 27/10/05 02:18 AM Re: Better Variable/Command locating
benjy355 Offline
Babel fish

Registered: 27/10/05
Posts: 54
Loc: Canada eh?
oh i'm well aware it would work that way, but it would be a usefull tool for some of the newer scripters =\
_________________________
Chat NSN
My Server: sleepystickman.ircxpro.com

Top
#133953 - 27/10/05 02:21 AM Re: Better Variable/Command locating
FiberOPtics Offline
Hoopy frood

Registered: 05/02/04
Posts: 2019
Loc: Leuven, Belgium
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.
_________________________
Gone.

Top
#133954 - 27/10/05 02:27 AM Re: Better Variable/Command locating
hixxy Offline
Hoopy frood

Registered: 06/09/05
Posts: 2876
Quote:
What would be a useful tool?


I think he means he wants mIRC to read the users mind and fix incorrect syntax smirk

Top
#133955 - 27/10/05 02:48 AM Re: Better Variable/Command locating
FiberOPtics Offline
Hoopy frood

Registered: 05/02/04
Posts: 2019
Loc: Leuven, Belgium
Hehe, that made me lol laugh
_________________________
Gone.

Top
#133956 - 27/10/05 02:52 AM Re: Better Variable/Command locating
benjy355 Offline
Babel fish

Registered: 27/10/05
Posts: 54
Loc: Canada eh?
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
_________________________
Chat NSN
My Server: sleepystickman.ircxpro.com

Top
#133957 - 27/10/05 03:55 AM Re: Better Variable/Command locating
mIRCManiac Offline
Hoopy frood

Registered: 05/02/05
Posts: 681
Loc: Your dreams ;)
_________________________
mIRCManiac

Top
#133958 - 27/10/05 09:30 AM Re: Better Variable/Command locating
Mpdreamz Offline
Hoopy frood

Registered: 27/04/04
Posts: 759
Loc: Arnhem, The Netherlands
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.
_________________________
$maybe

Top
#133959 - 12/11/05 01:56 PM Re: Better Variable/Command locating
FiberOPtics Offline
Hoopy frood

Registered: 05/02/04
Posts: 2019
Loc: Leuven, Belgium
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 ] )
_________________________
Gone.

Top