ord

Returns the Unicode value code of the first character in the given string.

Syntax:

ord(str);


Argument Description
str The string with which to find the Unicode code.


Returns: Real


Description

This function takes a string (of a single character only) and returns the Unicode value for that character. In this way you can, for example, store as integers individual key presses, and it is most commonly used by the keyboard_check() functions.


Example:

if keyboard_check(ord("W"))
   {
   y -= 4;
   }

This will move the calling instance four pixels upwards if the key W is held down.


Back: Strings
Next: real
© Copyright YoYo Games Ltd. 2018 All Rights Reserved