Skip to content

Lesson 8: Convert a simple mIRC script

Goal: convert this mIRC script:

on *:TEXT:!hello*:#:{
msg $chan Hello, $nick! (you said: $1-)
}

Save it as a .mrc file. SwizzinIRC translates this pattern to SwizzScript when it loads and lists any problems with line numbers. It stays Off until you review it and approve its permissions. Edit the .mrc file, not the translation. See mIRC compatibility for the supported events, commands and identifiers.

--! name: Hello trigger
--! description: Answers !hello in channels
--! api: 1
--! permissions: send
swizzin.on("message", function(e)
local inChannel = string.sub(e.target, 1, 1) == "#"
if inChannel and swizzin.wildmatch("!hello*", e.text) then
swizzin.send(e.target, `Hello, {e.nick}! (you said: {string.sub(e.text, 1, 200)})`)
end
end)
mIRC SwizzScript
on *:TEXT:!hello*:#: swizzin.on("message", …) plus swizzin.wildmatch("!hello*", e.text) and a channel check
$chan e.target
$nick e.nick
$1- the message text, e.text
msg $chan … swizzin.send(e.target, …)

Someone typing !hello there in a channel gets Hello, <their nick>! (you said: !hello there).

  • Expecting mIRC variables, if/while, timer, files or sockets to translate: they are refused. Use Luau locals, swizzin.data, and swizzin.timer.
  • Forgetting the channel check: in mIRC the # in the event restricts it to channels.
  • The editor lists unsupported lines (up to 20) with line numbers. See Coming from mIRC.