on *:input:#: {
if !$ctrlenter {
;If there is already a input queue for this window, simply add one additional line.
if $hget(input, lines) {
haltdef
hinc input lines 1
hadd input $+(line, $hget(input, lines)) $1-
}
;If the primary editbox is empty, recall the last line for the primary editbox.
elseif $editbox($active) == $null {
haltdef
hinc input lines 1
hadd input $+(line, $hget(input, lines)) $1-
editbox -afn /
.timergrabinput 1 0 grabinput 1
}
;If the primary editbox is not empty, but the secondary editbox is, recall the last line for the secondary editbox.
elseif $editbox($active, 1) == $null {
haltdef
hinc input lines 1
hadd input $+(line, $hget(input, lines)) $1-
editbox -afno /
.timergrabinput 1 0 grabinput
}
;Catch the error in case the secondary editbox is unavailable.
:error
reseterror
}
}
;Grab the input entries.
alias -l grabinput {
;Compare the value with a tokenized version of the editbox, to see if they match.
if $1 {
tokenize 32 $editbox($active)
if $hget(input, $+(line, $hget(input, lines))) == $1- {
hadd input $+(line, $hget(input, lines)) $hardspace($editbox($active))
hdec input lines 1
;If there are more lines in queue, request the next editbox line.
if $hget(input, lines) {
editbox -afn /
.timergrabinput 1 0 grabinput 1
return
}
;Clear the editbox.
editbox -a
}
else {
editbox -a
;If the primary editbox does not match, but the secondary editbox is empty, recall the last line for the secondary editbox.
if $editbox($active, 1) == $null {
editbox -afno /
.timergrabinput 1 0 grabinput
return
}
}
}
else {
tokenize 32 $editbox($active, 1)
if $hget(input, $+(line, $hget(input, lines))) == $1- {
hadd input $+(line, $hget(input, lines)) $hardspace($editbox($active, 1))
hdec input lines 1
;If there are more lines in queue, request the next editbox line.
if $hget(input, lines) {
editbox -afno /
.timergrabinput 1 0 grabinput
return
}
}
;If the result does not match, and the first editbox is empty, return the focus to the first editbox.
elseif $editbox($active) == $null {
editbox -af
}
;Clear the editbox.
editbox -ao
}
;Catch the error in case the secondary editbox is unavailable.
:error
reseterror
hdel input lines
evalinput
}
;Evaluate the input entries.
alias -l evalinput {
var %count 1
while $hget(input, $+(line, %count)) != $null {
tokenize 32 $hget(input, $+(line, %count))
;If the first parameter does not start with /, say the line in the channel.
if $left($remove($1, $chr(160)), 1) != / && $left($remove($1, $chr(160)), 1) != $readini($mircini,text,commandchar) {
say $1-
}
;If the first parameter equals /me, emote the remaining line in the channel.
elseif $right($remove($1, $chr(160)), -1) == me {
me $2-
}
;Remove the $chr(160) signs and execute the line.
else {
$remove($1-, $chr(160))
;Include an errorcatcher, to allow further lines to execute.
:error
}
hdel input $+(line, %count)
var %count $calc(%count + 1)
}
}
alias -l hardspace return $replace($+($chr(32), $1-), $+($chr(32), $chr(32)), $+($chr(32), $chr(160)), $+($chr(160), $chr(32)), $+($chr(160), $chr(160)))