|
|
Line 58: |
Line 58: |
| '''Generic Key References''' | | '''Generic Key References''' |
| | | |
− | Anything you see between quotes is a valid scripting reference tag. You are looking at the keyTranslator.cpp file which literally interprets scripting key calls and returns their SDLK counterparts.
| + | Here is a complete list of scripting key bindings: |
| | | |
| <pre> | | <pre> |
− | #include "keyTranslator.h"
| + | backspace |
− | 3
| + | tab |
− | 4 SDLKey keyToSDL(const std::string &s)
| + | clear |
− | 5 {
| + | return |
− | 6 if (s == "backspace")
| + | pause |
− | 7 return SDLK_BACKSPACE;
| + | esc |
− | 8 if (s == "tab")
| + | space |
− | 9 return SDLK_TAB;
| + | ! |
− | 10 if (s == "clear")
| + | " |
− | 11 return SDLK_CLEAR;
| + | # |
− | 12 if (s == "return")
| + | $ |
− | 13 return SDLK_RETURN;
| + | & |
− | 14 if (s == "pause")
| + | ' |
− | 15 return SDLK_PAUSE;
| + | ( |
− | 16 if (s == "esc")
| + | ) |
− | 17 return SDLK_ESCAPE;
| + | * |
− | 18 if (s == "space")
| + | + |
− | 19 return SDLK_SPACE;
| + | , |
− | 20 if (s == "!")
| + | - |
− | 21 return SDLK_EXCLAIM;
| + | . |
− | 22 if (s == "\"")
| + | / |
− | 23 return SDLK_QUOTEDBL;
| + | 0 |
− | 24 if (s == "#")
| + | 1 |
− | 25 return SDLK_HASH;
| + | 2 |
− | 26 if (s == "$")
| + | 3 |
− | 27 return SDLK_DOLLAR;
| + | 4 |
− | 28 if (s == "&")
| + | 5 |
− | 29 return SDLK_AMPERSAND;
| + | 6 |
− | 30 if (s == "\'")
| + | 7 |
− | 31 return SDLK_QUOTE;
| + | 8 |
− | 32 if (s == "(")
| + | 9 |
− | 33 return SDLK_LEFTPAREN;
| + | : |
− | 34 if (s == ")")
| + | ; |
− | 35 return SDLK_RIGHTPAREN;
| + | < |
− | 36 if (s == "*")
| + | = |
− | 37 return SDLK_ASTERISK;
| + | > |
− | 38 if (s == "+")
| + | ? |
− | 39 return SDLK_PLUS;
| + | @ |
− | 40 if (s == ",")
| + | [ |
− | 41 return SDLK_COMMA;
| + | \\ |
− | 42 if (s == "-")
| + | ] |
− | 43 return SDLK_MINUS;
| + | ^ |
− | 44 if (s == ".")
| + | _ |
− | 45 return SDLK_PERIOD;
| + | ` |
− | 46 if (s == "/")
| + | a |
− | 47 return SDLK_SLASH;
| + | b |
− | 48 if (s == "0")
| + | c |
− | 49 return SDLK_0;
| + | d |
− | 50 if (s == "1")
| + | e |
− | 51 return SDLK_1;
| + | f |
− | 52 if (s == "2")
| + | g |
− | 53 return SDLK_2;
| + | h |
− | 54 if (s == "3")
| + | i |
− | 55 return SDLK_3;
| + | j |
− | 56 if (s == "4")
| + | k |
− | 57 return SDLK_4;
| + | l |
− | 58 if (s == "5")
| + | m |
− | 59 return SDLK_5;
| + | n |
− | 60 if (s == "6")
| + | o |
− | 61 return SDLK_6;
| + | p |
− | 62 if (s == "7")
| + | q |
− | 63 return SDLK_7;
| + | r |
− | 64 if (s == "8")
| + | s |
− | 65 return SDLK_8;
| + | t |
− | 66 if (s == "9")
| + | u |
− | 67 return SDLK_9;
| + | v |
− | 68 if (s == ":")
| + | w |
− | 69 return SDLK_COLON;
| + | x |
− | 70 if (s == ";")
| + | y |
− | 71 return SDLK_SEMICOLON;
| + | z |
− | 72 if (s == "<")
| + | delete |
− | 73 return SDLK_LESS;
| + | keypad0 |
− | 74 if (s == "=")
| + | keypad1 |
− | 75 return SDLK_EQUALS;
| + | keypad2 |
− | 76 if (s == ">")
| + | keypad3 |
− | 77 return SDLK_GREATER;
| + | keypad4 |
− | 78 if (s == "?")
| + | keypad5 |
− | 79 return SDLK_QUESTION;
| + | keypad6 |
− | 80 if (s == "@")
| + | keypad7 |
− | 81 return SDLK_AT;
| + | keypad8 |
− | 82 if (s == "[")
| + | keypad9 |
− | 83 return SDLK_LEFTBRACKET;
| + | keypad. |
− | 84 if (s == "\\")
| + | keypad/ |
− | 85 return SDLK_BACKSLASH;
| + | keypad* |
− | 86 if (s == "]")
| + | keypad- |
− | 87 return SDLK_RIGHTBRACKET;
| + | keypad+ |
− | 88 if (s == "^")
| + | keypadenter |
− | 89 return SDLK_CARET;
| + | keypad= |
− | 90 if (s == "_")
| + | up |
− | 91 return SDLK_UNDERSCORE;
| + | down |
− | 92 if (s == "`")
| + | right |
− | 93 return SDLK_BACKQUOTE;
| + | left |
− | 94 if (s == "a")
| + | insert |
− | 95 return SDLK_a;
| + | home |
− | 96 if (s == "b")
| + | end |
− | 97 return SDLK_b;
| + | pageup |
− | 98 if (s == "c")
| + | pagedown |
− | 99 return SDLK_c;
| + | f1 |
− | 100 if (s == "d")
| + | f2 |
− | 101 return SDLK_d;
| + | f3 |
− | 102 if (s == "e")
| + | f4 |
− | 103 return SDLK_e;
| + | f5 |
− | 104 if (s == "f")
| + | f6 |
− | 105 return SDLK_f;
| + | f7 |
− | 106 if (s == "g")
| + | f8 |
− | 107 return SDLK_g;
| + | f9 |
− | 108 if (s == "h")
| + | f10 |
− | 109 return SDLK_h;
| + | f11 |
− | 110 if (s == "i")
| + | f12 |
− | 111 return SDLK_i;
| + | f13 |
− | 112 if (s == "j")
| + | f14 |
− | 113 return SDLK_j;
| + | f15 |
− | 114 if (s == "k")
| + | numlock |
− | 115 return SDLK_k;
| + | capslock |
− | 116 if (s == "l")
| + | scrollock |
− | 117 return SDLK_l;
| + | rshift |
− | 118 if (s == "m")
| + | lshift |
− | 119 return SDLK_m;
| + | rctrl |
− | 120 if (s == "n")
| + | lctrl |
− | 121 return SDLK_n;
| + | ralt |
− | 122 if (s == "o")
| + | lalt |
− | 123 return SDLK_o;
| + | rmeta |
− | 124 if (s == "p")
| + | lmeta |
− | 125 return SDLK_p;
| + | lsuper |
− | 126 if (s == "q")
| + | rsuper |
− | 127 return SDLK_q;
| + | mode |
− | 128 if (s == "r")
| + | compose |
− | 129 return SDLK_r;
| + | help |
− | 130 if (s == "s")
| + | print |
− | 131 return SDLK_s;
| + | sysreq |
− | 132 if (s == "t")
| + | break |
− | 133 return SDLK_t;
| + | menu |
− | 134 if (s == "u")
| + | power |
− | 135 return SDLK_u;
| + | euro</pre> |
− | 136 if (s == "v")
| |
− | 137 return SDLK_v;
| |
− | 138 if (s == "w")
| |
− | 139 return SDLK_w;
| |
− | 140 if (s == "x")
| |
− | 141 return SDLK_x;
| |
− | 142 if (s == "y")
| |
− | 143 return SDLK_y;
| |
− | 144 if (s == "z")
| |
− | 145 return SDLK_z;
| |
− | 146 if (s == "delete")
| |
− | 147 return SDLK_DELETE;
| |
− | 148 if (s == "keypad0")
| |
− | 149 return SDLK_KP0;
| |
− | 150 if (s == "keypad1")
| |
− | 151 return SDLK_KP1;
| |
− | 152 if (s == "keypad2")
| |
− | 153 return SDLK_KP2;
| |
− | 154 if (s == "keypad3")
| |
− | 155 return SDLK_KP3;
| |
− | 156 if (s == "keypad4")
| |
− | 157 return SDLK_KP4;
| |
− | 158 if (s == "keypad5")
| |
− | 159 return SDLK_KP5;
| |
− | 160 if (s == "keypad6")
| |
− | 161 return SDLK_KP6;
| |
− | 162 if (s == "keypad7")
| |
− | 163 return SDLK_KP7;
| |
− | 164 if (s == "keypad8")
| |
− | 165 return SDLK_KP8;
| |
− | 166 if (s == "keypad9")
| |
− | 167 return SDLK_KP9;
| |
− | 168 if (s == "keypad.")
| |
− | 169 return SDLK_KP_PERIOD;
| |
− | 170 if (s == "keypad/")
| |
− | 171 return SDLK_KP_DIVIDE;
| |
− | 172 if (s == "keypad*")
| |
− | 173 return SDLK_KP_MULTIPLY;
| |
− | 174 if (s == "keypad-")
| |
− | 175 return SDLK_KP_MINUS;
| |
− | 176 if (s == "keypad+")
| |
− | 177 return SDLK_KP_PLUS;
| |
− | 178 if (s == "keypadenter")
| |
− | 179 return SDLK_KP_ENTER;
| |
− | 180 if (s == "keypad=")
| |
− | 181 return SDLK_KP_EQUALS;
| |
− | 182 if (s == "up")
| |
− | 183 return SDLK_UP;
| |
− | 184 if (s == "down")
| |
− | 185 return SDLK_DOWN;
| |
− | 186 if (s == "right")
| |
− | 187 return SDLK_RIGHT;
| |
− | 188 if (s == "left")
| |
− | 189 return SDLK_LEFT;
| |
− | 190 if (s == "insert")
| |
− | 191 return SDLK_INSERT;
| |
− | 192 if (s == "home")
| |
− | 193 return SDLK_HOME;
| |
− | 194 if (s == "end")
| |
− | 195 return SDLK_END;
| |
− | 196 if (s == "pageup")
| |
− | 197 return SDLK_PAGEUP;
| |
− | 198 if (s == "pagedown")
| |
− | 199 return SDLK_PAGEDOWN;
| |
− | 200 if (s == "f1")
| |
− | 201 return SDLK_F1;
| |
− | 202 if (s == "f2")
| |
− | 203 return SDLK_F2;
| |
− | 204 if (s == "f3")
| |
− | 205 return SDLK_F3;
| |
− | 206 if (s == "f4")
| |
− | 207 return SDLK_F4;
| |
− | 208 if (s == "f5")
| |
− | 209 return SDLK_F5;
| |
− | 210 if (s == "f6")
| |
− | 211 return SDLK_F6;
| |
− | 212 if (s == "f7")
| |
− | 213 return SDLK_F7;
| |
− | 214 if (s == "f8")
| |
− | 215 return SDLK_F8;
| |
− | 216 if (s == "f9")
| |
− | 217 return SDLK_F9;
| |
− | 218 if (s == "f10")
| |
− | 219 return SDLK_F10;
| |
− | 220 if (s == "f11")
| |
− | 221 return SDLK_F11;
| |
− | 222 if (s == "f12")
| |
− | 223 return SDLK_F12;
| |
− | 224 if (s == "f13")
| |
− | 225 return SDLK_F13;
| |
− | 226 if (s == "f14")
| |
− | 227 return SDLK_F14;
| |
− | 228 if (s == "f15")
| |
− | 229 return SDLK_F15;
| |
− | 230 if (s == "numlock")
| |
− | 231 return SDLK_NUMLOCK;
| |
− | 232 if (s == "capslock")
| |
− | 233 return SDLK_CAPSLOCK;
| |
− | 234 if (s == "scrollock")
| |
− | 235 return SDLK_SCROLLOCK;
| |
− | 236 if (s == "rshift")
| |
− | 237 return SDLK_RSHIFT;
| |
− | 238 if (s == "lshift")
| |
− | 239 return SDLK_LSHIFT;
| |
− | 240 if (s == "rctrl")
| |
− | 241 return SDLK_RCTRL;
| |
− | 242 if (s == "lctrl")
| |
− | 243 return SDLK_LCTRL;
| |
− | 244 if (s == "ralt")
| |
− | 245 return SDLK_RALT;
| |
− | 246 if (s == "lalt")
| |
− | 247 return SDLK_LALT;
| |
− | 248 if (s == "rmeta")
| |
− | 249 return SDLK_RMETA;
| |
− | 250 if (s == "lmeta")
| |
− | 251 return SDLK_LMETA;
| |
− | 252 if (s == "lsuper")
| |
− | 253 return SDLK_LSUPER;
| |
− | 254 if (s == "rsuper")
| |
− | 255 return SDLK_RSUPER;
| |
− | 256 if (s == "mode")
| |
− | 257 return SDLK_MODE;
| |
− | 258 if (s == "compose")
| |
− | 259 return SDLK_COMPOSE;
| |
− | 260 if (s == "help")
| |
− | 261 return SDLK_HELP;
| |
− | 262 if (s == "print")
| |
− | 263 return SDLK_PRINT;
| |
− | 264 if (s == "sysreq")
| |
− | 265 return SDLK_SYSREQ;
| |
− | 266 if (s == "break")
| |
− | 267 return SDLK_BREAK;
| |
− | 268 if (s == "menu")
| |
− | 269 return SDLK_MENU;
| |
− | 270 if (s == "power")
| |
− | 271 return SDLK_POWER;
| |
− | 272 if (s == "euro")
| |
− | 273 return SDLK_EURO;
| |
− | 274
| |
− | 275 return (SDLKey)SDLK_SYSREQ;
| |
− | 276 }
| |
− | </pre> | |
| | | |
| | | |
| | | |
| [[Category:Overgrowth]] | | [[Category:Overgrowth]] |
Revision as of 20:07, 25 February 2010
Overgrowth is using AngelScript as its core scripting language. The best AngelScript reference is here: [1]
Checking for Keypresses:
You can check for keypresses by using the boolean check function GetInputDown():
Syntax examples:
GetInputDown("a")
|
returns true if the 'a' key is being pressed, returns false if not
|
GetInputDown("attack")
|
returns true if the left mouse button is being pressed, returns false if not
|
GetInputDown("move_left")
|
returns true if the "left key" is being pressed, returns false if not (by default this key is defined in the config.txt to be the 'a' key)
|
The following controls are designed to be relative to the player's preferences and are given a binding in the config.txt file.
Config.txt Dependent References
Predefined Term
|
Default binding in Config.txt
|
Scripting Reference Name
|
Left Key
|
a
|
move_left
|
Right Key
|
d
|
move_right
|
Up Key
|
w
|
move_up
|
Down Key
|
s
|
move_down
|
Crouch Key
|
left shift
|
crouch
|
Jump Key
|
space
|
jump
|
Generic Key References
Here is a complete list of scripting key bindings:
backspace
tab
clear
return
pause
esc
space
!
"
#
$
&
'
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
[
\\
]
^
_
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
delete
keypad0
keypad1
keypad2
keypad3
keypad4
keypad5
keypad6
keypad7
keypad8
keypad9
keypad.
keypad/
keypad*
keypad-
keypad+
keypadenter
keypad=
up
down
right
left
insert
home
end
pageup
pagedown
f1
f2
f3
f4
f5
f6
f7
f8
f9
f10
f11
f12
f13
f14
f15
numlock
capslock
scrollock
rshift
lshift
rctrl
lctrl
ralt
lalt
rmeta
lmeta
lsuper
rsuper
mode
compose
help
print
sysreq
break
menu
power
euro