The following functions exist that deal with Strings.

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

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:

  1. ansi_char
  2. chr
  3. ord
  4. real
  5. is_string
  6. string
  7. string_byte_at
  8. string_byte_length
  9. string_set_byte_at
  10. string_char_at
  11. string_ord_at
  12. string_copy
  13. string_count
  14. string_delete
  15. string_digits
  16. string_format
  17. string_insert
  18. string_length
  19. string_letters
  20. string_lettersdigits
  21. string_lower
  22. string_pos
  23. string_repeat
  24. string_replace
  25. string_replace_all
  26. string_upper
  27. string_height
  28. string_height_ext
  29. string_width
  30. 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:

  1. clipboard_has_text
  2. clipboard_get_text
  3. clipboard_set_text

Back: Reference
© Copyright YoYo Games Ltd. 2018 All Rights Reserved