mIRC Home    About    Download    Register    News    Help

Print Thread
Better Variable/Command locating #133950 27/10/05 12:52 AM
Joined: Oct 2005
Posts: 54
B
benjy355 Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Oct 2005
Posts: 54
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
Re: Better Variable/Command locating #133951 27/10/05 01:13 AM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.
Re: Better Variable/Command locating #133952 27/10/05 01:18 AM
Joined: Oct 2005
Posts: 54
B
benjy355 Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Oct 2005
Posts: 54
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
Re: Better Variable/Command locating #133953 27/10/05 01:21 AM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.
Re: Better Variable/Command locating #133954 27/10/05 01:27 AM
Joined: Sep 2005
Posts: 2,877
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,877
Quote:
What would be a useful tool?


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

Re: Better Variable/Command locating #133955 27/10/05 01:48 AM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hehe, that made me lol laugh


Gone.
Re: Better Variable/Command locating #133956 27/10/05 01:52 AM
Joined: Oct 2005
Posts: 54
B
benjy355 Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Oct 2005
Posts: 54
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
Re: Better Variable/Command locating #133957 27/10/05 02:55 AM
Joined: Feb 2005
Posts: 681
M
mIRCManiac Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681

Re: Better Variable/Command locating #133958 27/10/05 08:30 AM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
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
Re: Better Variable/Command locating #133959 12/11/05 01:56 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.