GetKeyString

From Spheriki

Jump to: navigation, search

GetKeyString() can be used to make a string out of the current pressed key. For example, when pressing the a key Sphere will return "a" (or "A" if the shift parameter is set to true).


Contents

Usage

functionGetKeyString(key, shift);
  • key The key value to make a string out of.
  • shift True/false parameter. If it's set to true, Sphere will return the uppercase character for that key (A for a, ! for 1 and so on).


Examples

var TheKey = GetKey();
var string = GetKeyString(TheKey, false);
Abort("The following key was pressed: " + string)

This calls GetKey() and stores the result in the variable TheKey. Then a variable called 'string' is made and the key string of the key value in TheKey is stored. Then Sphere aborts with the message which key was pressed.


Notes

  • The function returns an empty string "" for control keys (ctrl, alt, shift, enter, etcetera).


See also

Personal tools