Scan Codes

Verge doesn't use ASCII for reading and comparing keyboard input, but instead uses the keyboard scan codes instead. You will generally only use the scan codes when reading lastpressed or the key array.
EX:

if(key[SCAN_ESC]) exit("");
else if(key[SCAN_ENTER]) map("town.map");

or

switch(lastpressed){
case SCAN_EXIT: exit("");
case SCAN_ENTER: map("town.map");
}

from vergec.txt:
{"SCAN_ESC", "01" }
{"SCAN_1", "02" }
{"SCAN_2", "03" }
{"SCAN_3", "04" }
{"SCAN_4", "05" }
{"SCAN_5", "06" }
{"SCAN_6", "07" }
{"SCAN_7", "08" }
{"SCAN_8", "09" }
{"SCAN_9", "10" }
{"SCAN_0", "11" }
{"SCAN_MINUS", "12" }
{"SCAN_EQUALS", "13" }
{"SCAN_BACKSP", "14" }
{"SCAN_TAB", "15" }
{"SCAN_Q", "16" }
{"SCAN_W", "17" }
{"SCAN_E", "18" }
{"SCAN_R", "19" }
{"SCAN_T", "20" }
{"SCAN_Y", "21" }
{"SCAN_U", "22" }
{"SCAN_I", "23" }
{"SCAN_O", "24" }
{"SCAN_P", "25" }
{"SCAN_LANGLE", "26" }
{"SCAN_RANGLE", "27" }
{"SCAN_ENTER", "28" }
{"SCAN_CTRL", "29" }
{"SCAN_A", "30" }
{"SCAN_S", "31" }
{"SCAN_D", "32" }
{"SCAN_F", "33" }
{"SCAN_G", "34" }
{"SCAN_H", "35" }
{"SCAN_J", "36" }
{"SCAN_K", "37" }
{"SCAN_L", "38" }
{"SCAN_SCOLON", "39" }
{"SCAN_QUOTA", "40" }
{"SCAN_RQUOTA", "41" }
{"SCAN_LSHIFT", "42" }
{"SCAN_BSLASH", "43" }
{"SCAN_Z", "44" }
{"SCAN_X", "45" }
{"SCAN_C", "46" }
{"SCAN_V", "47" }
{"SCAN_B", "48" }
{"SCAN_N", "49" }
{"SCAN_M", "50" }
{"SCAN_COMMA", "51" }
{"SCAN_DOT", "52" }
{"SCAN_SLASH", "53" }
{"SCAN_RSHIFT", "54" }
{"SCAN_STAR", "55" }
{"SCAN_ALT", "56" }
{"SCAN_SPACE", "57" }
{"SCAN_CAPS", "58" }
{"SCAN_F1", "59" }
{"SCAN_F2", "60" }
{"SCAN_F3", "61" }
{"SCAN_F4", "62" }
{"SCAN_F5", "63" }
{"SCAN_F6", "64" }
{"SCAN_F7", "65" }
{"SCAN_F8", "66" }
{"SCAN_F9", "67" }
{"SCAN_F10", "68" }
{"SCAN_NUMLOCK","69" }
{"SCAN_SCRLOCK","70" }
{"SCAN_HOME", "71" }
{"SCAN_UP", "72" }
{"SCAN_PGUP", "73" }
{"SCAN_GMINUS", "74" }
{"SCAN_LEFT", "75" }
{"SCAN_PAD_5", "76" }
{"SCAN_RIGHT", "77" }
{"SCAN_GPLUS", "78" }
{"SCAN_END", "79" }
{"SCAN_DOWN", "80" }
{"SCAN_PGDN", "81" }
{"SCAN_INSERT", "82" }
{"SCAN_DEL", "83" }
{"SCAN_F11", "87" }
{"SCAN_F12", "88" }


Be warned that the values for Insert, Delete, Home, End, PgUp and PgDown listed here are for the numpad keys. The "real" versions are 210 (INSERT), 211 (DELETE), 199 (HOME), 207 (END), 201 (PGUP), and 209 (PGDN). You will need to define these yourself if you want to use them without entering the values directly.
Talkback

There are no talkbacks on this documentation page yet. Post the first?

Post a new comment?

Doc Nav

Your docs
View All Docs

If you log in, you can edit the documentation, or create your own documents and tutorials!

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.