At some time when making your game you will need to use text.
Text in games is dealt with by using the string functions (a
string is just another way of saying a line of text) and
GameMaker: Studio has a complete set of functions that
permit you to manipulate strings in many ways, including the
insertion of one string in another, the copying of strings and the
ability to parse strings for the digits or the letters that they
contain.
It is worth noting that there are certain conventions that you can
use when creating strings. You can, for example, create a string
with quotes using the single quotation marks like this: "...and so
Sam said 'Hi there!'". You can also force a line break using the #
symbol or by adding a new line in the string creation like
this:
str = "Hello#World";
// or
str = "Hello
World";
If you need to actually draw the "#" symbol as part of the text, you can precede it using the "\" symbol like this:
str = "this will draw the \# symbol";
Another thing to note is that the unicode character 9647 (▯) is
used to substitute any missing glyphs that you may have in your
designated font when rendering it in the draw event. So if your
font doesn't have, for example, the ° symbol, then writing 90° will
actually produce 90▯.
The following list of functions are all for dealing with
strings:
- ansi_char
- chr
- ord
- real
- is_string
- string
- string_byte_at
- string_byte_length
- string_set_byte_at
- string_char_at
- string_ord_at
- string_copy
- string_count
- string_delete
- string_digits
- string_format
- string_insert
- string_length
- string_letters
- string_lettersdigits
- string_lower
- string_pos
- string_repeat
- string_replace
- string_replace_all
- string_upper
- string_height
- string_height_ext
- string_width
- string_width_ext
Other than those functions that relate specifically to strings, the Windows target also permits you to use access the clipboard to get and set text information: