mIRC Home    About    Download    Register    News    Help

Print Thread
#268313 02/01/21 09:06 PM
Joined: Jan 2021
Posts: 1
B
Baeyens Offline OP
Mostly harmless
OP Offline
Mostly harmless
B
Joined: Jan 2021
Posts: 1
Hey mIRC team and Users,

is was wondering if anyone could help me and if the developers could check this out.
the if, elseif and else statement.
I've got some issues with it.
On the help page the first thing i read is
Quote

Basic format
if (v1 operator v2) { commands }
elseif (v1 operator v2) { commands }
else { commands }


So i tried
Quote

on *:TEXT:*:#: {
if ($1 === Yo){/msg $chan hi}
elseif ($1 === That){/msg $chan ok}
else {/msg $chan forget it}
}


But that failed.
While reading further and experimenting
i found the bottom partial script code to be working.
Can someone explain this to me, why this difference in statement?

Joined: Oct 2017
Posts: 47
D
Ameglian cow
Offline
Ameglian cow
D
Joined: Oct 2017
Posts: 47
You need to add a space on
Code
){/msg $chan hi }


So use:

Code
) { /msg $chan hi }


Check and use the format as you see in the examples exactly, you can see more examples in the online wiki https://en.wikichip.org/wiki/mirc

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
You need space around { and } (though } don't need a space on it's right if it terminates the line/file)


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

Link Copied to Clipboard