mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2015
Posts: 4
K
Self-satisified door
OP Offline
Self-satisified door
K
Joined: Apr 2015
Posts: 4
Hey everyone, sorry to bother you with a post this simple but I'm just starting out with mIRC scripts and I can't for the life of me figure out what is wrong here...

Code:
on *:text:!mcuser:#:{
  var %user = $readini(whitelist.ini, n, users, $nick)
  if (%user!=$null){
    msg $chan MC username for $nick is currently set as %user $+ .
  else
    msg $chan $nick has no MC username set.
  }
}
When the script is triggered via "!mcuser" an error appears, saying
Quote:
/if: insufficient parameters (line 3, mcUser)
with mcUser being the name of the script.
As far as I'm aware, the syntax is correct. Can anyone see what's wrong?

EDIT:

I'm still unsure as to what is wrong with the above text, but amending the text to this:
Code:
on *:text:!mcuser:#:{
  var %user = $readini(whitelist.ini, n, users, $nick)
  $iif(%user=!$null, msg $chan MC username for $nick is currently set as %user $+ ., msg $chan $nick has no MC username set.)
}
solved it.

Last edited by Konomira; 22/04/15 01:28 AM.
Joined: Jan 2004
Posts: 1,360
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,360
mIRC requires spacing and braces:

Code:
if (%user != $null) {
  msg $chan MC username for $nick is currently set as %user $+ .
}
else {
  msg $chan $nick has no MC username set.
}

Joined: Apr 2015
Posts: 4
K
Self-satisified door
OP Offline
Self-satisified door
K
Joined: Apr 2015
Posts: 4
Just ran the script with the code you gave and it works like a charm. I was running on the false thought that I had seen a script without braces.

Thanks!

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
A shorter form, if you know the user will never be the number zero '0', you could just use this.

if (!%user) { }
or
$iif(!%user,t,f)


Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Link Copied to Clipboard