mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2018
Posts: 23
R
Ryntovy Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Jan 2018
Posts: 23
Hello everyone,

mIRC gives me this error:
* /inc: invalid parameters (line 13, script1.ini)

And this is line 13:
Code:
inc -eu $+ $iif(%d,$v1,10) %flood_ $+ $chan $+ _ $+ $nick $+ _spam 1


What exactly is wrong with it?

With kind regards,
Ry

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
It needs square braces, to override the order of evaluation. %flood_ is likely $null, so you end up with several strings joined together into a string that doesn't begin with a percent, followed by a 1. You would need to do something like:

Code:
//inc -eu $+ $iif(%d,100,10) % $+ flood_ [ $+ [ $me ] $+ _ $+ [ $me ] $+ _spam  ] 1


When you do square-brace evaluation, it helps to check the variables tab of alt-r to see exactly which string is being created, as it's possible to have a variable named %flood_$chan_$nick_spam instead of evaluating the channel name and nick before using it.

If you use hash tables, you can avoid the need to use square braces entirely

Code:
//hinc -mu $+ $iif(%d,$v1,10) tablename flood_ $+ $chan $+ _ $+ $nick $+ _spam 1
//echo -a $hget(tablename,flood_ $+ $chan $+ _ $+ $nick $+ _spam)


Hash tables look intimidating to use at first, but they're actually quite simple. https://en.wikichip.org/wiki/mirc/hash_tables

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
This is a known quirk https://en.wikichip.org/wiki/mirc/variables#Special_behaviors_.26_quirks

The workaround is to preevaluate the first variable name as well

inc -eu $+ $iif(%d,$v1,10) % $+ flood_ $+ $chan $+ _ $+ $nick $+ _spam 1


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard