The Dink Network

Reply to Re: What are all the keys that can be used in scripts?

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
June 11th 2024, 10:16 AM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
Oh, NOW YOU'VE DONE IT! 
There's also the consideration that these may only apply to US keyboard layouts. I believe Scratcher had trouble with that in the past. In general however, I find that alphabetical key codes work best, and usually correspond to their uppercase ASCII value meaning values below 32 probably aren't useful.

I decided to write a Python3 program that does what you describe in case it's hard for anyone:

for i in range(256):
    with open("key-" + str(i) + ".c", "w") as f:
        f.write("void main()\n{\nint &key = " + str(i) + "\nsay(\"Key &key\", 1)\n}")


If you save it in STORY as keycodegen.py and run it with python3 keycodegen.py (py -3 on windows), it'll generate a bunch of key-*.c files to test with. Preferably use your designated testmod, as it'll overwrite existing key scripts. It might be worth posting our findings if the spreadsheet's out of date.

edit: more complete revision which doesn't overwrite existing key scripts and cleans up script slot afterwards