
Determining ANSI keycodes
I wrote this quick code snippet the other day to share with a player who was looking to find additional keyboard triggers for launching scripts and such. This is a complete script that can help you determine the ANSI code for SHIFT+Q or F5 for example.
I wrote a more complex version years ago, primarily for the purposes of decoding the ANSI codes coming from the server, but this one is much simpler for the above tasks.
+EP+
Code:
echo "*Text Out Echo running. Press ESC to exit.*"
setTextOutTrigger tot1 :tot1 ""
pause
:tot1
getOutText $out
getLength $out $length
setVar $keycodes ""
setVar $i 1
while ($i <= $length)
cutText $out $char $i 1
getCharCode $char $code
setVar $keycodes $keycodes & "#" & $code
add $i 1
end
echo "*Keycodes: " $keycodes "*"
# Now see if ESC was pressed
if ($length = 1) and ($out = #27)
echo "*ESC detected, script exiting.*"
halt
end
setTextOutTrigger tot1 :tot1 ""
pause