mIRC Home    About    Download    Register    News    Help

Print Thread
#47337 05/09/03 07:58 AM
Joined: Aug 2003
Posts: 37
R
rbhibbs Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2003
Posts: 37
tested with version 6.03

there have been several posts over the past year about lilne length problems with $iif -- in this example I'll illustrate that line length alone may not be the source of the "Invalid Format" messages.

First, a code snippet (from my nicklist popup) that generates an "Invalid Format" error:

.Temp Ban, Kick (why?):$iif((PonyTrainer ison $chan), .msg $chan !ktban $$?="Time in Seconds:" $$1 $$?="Reason for Kick:", /ban -u $+ $$?="Time in Seconds:" # $$1 8 | /timer 1 3 /kick # $$1 $$?="Reason for Kick:" )

clearly a very long line for a popup, but if I recode it like this, it works just fine:

.Temp Ban, Kick (why?):{
$iif((PonyTrainer ison $chan), .msg $chan !ktban $$?="Time in Seconds:" $$1 $$?="Reason for Kick:", $&
/ban -u $+ $$?="Time in Seconds:" # $$1 8 | /timer 1 3 /kick # $$1 $$?="Reason for Kick:" )
}

consider this second example, also from my nicklist popup, which also generates an error:

.Ban, Kick:$iif((PonyTrainer ison $chan), .msg $chan !kban $$1, /ban # $$1 8 | /timer 1 3 /kick # $$1 )

this snippet is less than 100 characters long and it is an error, but recode it like this, and it works:

.Ban, Kick:{
$iif((PonyTrainer ison $chan), .msg $chan !kban $$1, $&
/ban # $$1 8 | /timer 1 3 /kick # $$1 )
}

I think that it's the complexity of the $iif arguments that causes the "Invalid Format" error, not [just] the line length -- in fact, I'm going to go out on a limb and claim that it's the "|" character that is the source of the problem. I've tried other, even longer lines in the popup (168 characters) that do NOT have the "|" character and they do NOT generate an "Invalid Format" error.

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
I would agree that putting a pipe inside an $iif() is causing the errors. Try using this way
Code:
.Ban, Kick:{
  if PonyTrainer ison # { .msg # !kban $$1 }
  else { ban # $$1 8 | .timer 1 3 kick # $1 }
}

Joined: Aug 2003
Posts: 37
R
rbhibbs Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2003
Posts: 37

yeah -- in the future I'll restrict the use of $iif() to circumstances where it is required for such things as creating popup menus


Link Copied to Clipboard