View unanswered posts | View active topics It is currently Sun Apr 19, 2026 2:34 am



Reply to topic  [ 3 posts ] 
 Determining ANSI keycodes 
Author Message
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post 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

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Thu Nov 11, 2010 7:39 am
Profile WWW
Commander
User avatar

Joined: Wed May 03, 2006 2:00 am
Posts: 1722
Location: USA
Unread post Re: Determining ANSI keycodes
:start
settextouttrigger two :two
pause
:two
killtrigger two
getouttext $key
getCharCode $key $code
echo "*" & $key & $code
send #145
goto :start


Simpler and works with Swath

_________________
Coconut Telegraph (ICQ)#586137616
Team Speak3@ 220.244.125.70:9987
Founding Member -=[Team Kraaken]=- Winner of Gridwars 2010 - Ka Pla
Image
Jesus wounldn't Subspace Crawl


Thu Nov 11, 2010 3:51 pm
Profile ICQ YIM
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post Re: Determining ANSI keycodes
That is fine if you want a simple keycode like A, but it will not work for batch codes like F5.

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Fri Nov 19, 2010 11:26 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: Bing [Bot] and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by wSTSoftware.