From 1fe5f730861bccc82f94acd79f189cc096cdeb73 Mon Sep 17 00:00:00 2001 From: YYBartT Date: Tue, 3 Oct 2023 10:52:37 +0200 Subject: [PATCH 001/116] [Feature]Feature Request #1318 * Added new function page using batch script and added item to ToC, updated links * Added new See Also that lists all functions that add assets at runtime and linked it on the page --- .../Assets_And_Tags/Assets_And_Tags.htm | 37 +++++----- .../Assets_And_Tags/asset_get_ids.htm | 72 +++++++++++++++++++ .../Assets_And_Tags/asset_get_index.htm | 8 +-- .../Assets_And_Tags/asset_get_tags.htm | 4 +- .../Assets_And_Tags/tag_get_assets.htm | 12 ++-- .../Object_Properties/Parent_Objects.htm | 60 +++++----------- Manual/contents/assets/scripts/gml.js | 2 + Manual/seealso/keywords.seealso | 2 +- Manual/toc/Default.toc | 1 + 9 files changed, 123 insertions(+), 75 deletions(-) create mode 100644 Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Assets_And_Tags/asset_get_ids.htm diff --git a/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Assets_And_Tags/Assets_And_Tags.htm b/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Assets_And_Tags/Assets_And_Tags.htm index 7da4edc34..9eb716dfa 100644 --- a/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Assets_And_Tags/Assets_And_Tags.htm +++ b/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Assets_And_Tags/Assets_And_Tags.htm @@ -4,7 +4,7 @@ Assets And Tags - + @@ -15,32 +15,33 @@

Assets And Tags

-

The functions listed here are specifically designed for getting information from any of the assets defined in the Asset Browser, as well as the tags that have been assigned to them. Tags are a very powerful tool, both in the Asset Browser and in your actual game code, as they can be read and created at run time, giving you additional ways to filter assets when your game is running and create conditional checks or "parent"-type systems outside of the object-based system.

-

For assets in general we have the following functions:

+

The functions listed here are specifically designed for getting information from any of the assets defined in The Asset Browser, as well as the tags that have been assigned to them.

+

Tags are a very powerful tool, both in The Asset Browser and in your actual game code, as they can be read and created at runtime, giving you additional ways to filter assets when your game is running and create conditional checks or "parent"-type systems outside of the object-based system.

+

Function Reference

+

General

-

 

-

For dealing with the Asset browser "tags" system, we have the following functions:

+

Tags

 

 

-

 

buffer_base64_decode_ext

-

With this function you can decode a base64 encoded string (created using the buffer_base64_encode() function) into a buffer. Unlike the function buffer_base64_decode(), - this will not create a buffer for you, but rather you should already have created the buffer (see buffer_create()), the id of which you would then use with this function. The "offset" is the - position within the buffer to decode the given string (in bytes).

+

With this function you can decode a base64 encoded string (created using the buffer_base64_encode() function) into a buffer. Unlike the function buffer_base64_decode(), this will not create a buffer for you, but rather you should already have created the buffer (see buffer_create()), the id of which you would then use with this function. The "offset" is the position within the buffer to decode the given string (in bytes).

 

Syntax:

buffer_base64_decode_ext(buffer, string, offset);

- + + - + - + + - + - + + - + - + + - +
ArgumentTypeArgumentType Description
bufferbufferBuffer ID The index of the buffer to decode the string into.
stringstringString The base64 encoded string to decode.
offsetoffsetReal The data offset value.

 

Returns:

-

+

N/A

 

Example:

-

buff = buffer_create(16384, buffer_grow, 2);
ini_open("Save.ini"); -
var str = ini_read_string("Save", "Slot1", "");
buffer_base64_decode_ext(buff, str, 0);
ini_close(); -

-

The above code will create a buffer and store the unique id for it in the variable "buff", then open an ini file and read a string from it into the local variable "str". This string is then decoded into the newly created buffer before - closing the ini file again.

+

buff = buffer_create(16384, buffer_grow, 2);
+ ini_open("Save.ini");
+ var str = ini_read_string("Save", "Slot1", "");
+ buffer_base64_decode_ext(buff, str, 0);
+ ini_close();

+

The above code will create a buffer and store the unique id for it in the variable "buff", then open an ini file and read a string from it into the local variable "str". This string is then decoded into the newly created buffer before closing the ini file again.

 

 

 

@@ -59,10 +62,10 @@

Example:

-
© Copyright YoYo Games Ltd. 2021 All Rights Reserved
+
© Copyright YoYo Games Ltd. 2023 All Rights Reserved
+ + + \ No newline at end of file diff --git a/Manual/contents/GameMaker_Language/GML_Reference/Buffers/buffer_get_size.htm b/Manual/contents/GameMaker_Language/GML_Reference/Buffers/buffer_get_size.htm index f9d7fec4e..12511612b 100644 --- a/Manual/contents/GameMaker_Language/GML_Reference/Buffers/buffer_get_size.htm +++ b/Manual/contents/GameMaker_Language/GML_Reference/Buffers/buffer_get_size.htm @@ -4,7 +4,7 @@ buffer_get_size - + @@ -29,14 +29,14 @@

Syntax:

buffer - Buffer ID + Buffer ID The index of the buffer to get the size of.

 

Returns:

-

Real

+

Real

 

Example:

var _size = buffer_get_size(player_data);
@@ -49,10 +49,10 @@

Example:

Back: Buffers
-
Next: buffer_get_surface
+
Next: buffer_resize
-
© Copyright YoYo Games Ltd. 2022 All Rights Reserved
+
© Copyright YoYo Games Ltd. 2023 All Rights Reserved

buffer_set_used_size

This function is primarily for use within extensions, and allows you to set the "used" size of the given buffer, which is the number of bytes that have been written to it.

-

When you write data to a buffer from an extension, GameMaker does not know how much of the buffer was filled by the extension code and is not able to read that data. This function can be called by the extension to tell the engine how many bytes of data - was written to the buffer, so the engine can read that data.

+

When you write data to a buffer from an extension, GameMaker does not know how much of the buffer was filled by the extension code and is not able to read that data. This function can be called by the extension to tell the engine how many bytes of data was written to the buffer, so the engine can read that data.

 

Syntax:

buffer_set_used_size(buffer, size);

- + + - + - + + - + - + + - +
ArgumentTypeArgumentType Description
bufferbufferBuffer ID The index of the buffer to use.
sizesizeReal The number of bytes to set as the "used" size.

 

Returns:

-

+

N/A

 

Example:

-

buffer_write(_bufferAddress, buffer_u8, 1);
buffer_write(_bufferAddress, buffer_u8, 2);
buffer_write(_bufferAddress, buffer_u16, 400);
-
buffer_set_used_size(_bufferAddress, 4);

+

buffer_write(_bufferAddress, buffer_u8, 1);
+ buffer_write(_bufferAddress, buffer_u8, 2);
+ buffer_write(_bufferAddress, buffer_u16, 400);
+
+ buffer_set_used_size(_bufferAddress, 4); +

The above functions would be called in an extension to write some data to a GameMaker buffer (through its memory address), and then set the number of bytes that were written to it so the engine can read that data.

 

 

@@ -51,10 +57,10 @@

Example:

Back: Buffers
-
Next: buffer_exists
+
Next: buffer_copy
-
© Copyright YoYo Games Ltd. 2021 All Rights Reserved
+
© Copyright YoYo Games Ltd. 2023 All Rights Reserved

buffer_sizeof

-

This function will return the size (in bytes) of the given Buffer Data Type Constant (listed here).

+

This function will return the size (in bytes) of the given Buffer Data Type Constant (listed here).

 

Syntax:

buffer_sizeof(type);

@@ -29,14 +29,14 @@

Syntax:

type - Buffer Data Type Constant + Buffer Data Type Constant The type of data that is to be checked (see the list of constants here).

 

Returns:

-

Real

+

Real

 

Example:

var b = 12 * buffer_sizeof(buffer_u8);
@@ -49,10 +49,10 @@

Example:

Back: Buffers
-
Next: buffer_md5
+
Next: buffer_set_used_size
-
© Copyright YoYo Games Ltd. 2022 All Rights Reserved
+
© Copyright YoYo Games Ltd. 2023 All Rights Reserved
-

Asset Management

-

The following sections explain the functions and variables that you have available to you for manipulating the different assets used in your project, including creating new dynamic assets or editing and changing those that are added into your game through the Asset Browser in the room editor or sequence editor.

+

Asset Management

+

The following sections explain the functions and variables that you have available to you for manipulating the different assets used in your project, including creating new dynamic assets or editing and changing those that are added into your game through The Asset Browser in The Room Editor or The Sequence Editor.

-

 

+

Dynamically Added Assets

+

Functions for Particle Systems can be found here: Particle Systems

There are also extra functions related to the handling of game assets and tags added from the Asset Browser. These functions can be found in the following section:

You get a handle when you create a new resource (with a _create() function) or reference an existing resource in your code (like referencing an object, getting an instance through a function, etc.).

diff --git a/Manual/contents/GameMaker_Language/GML_Reference/Buffers/Buffers.htm b/Manual/contents/GameMaker_Language/GML_Reference/Buffers/Buffers.htm index bf15a1258..735975e91 100644 --- a/Manual/contents/GameMaker_Language/GML_Reference/Buffers/Buffers.htm +++ b/Manual/contents/GameMaker_Language/GML_Reference/Buffers/Buffers.htm @@ -24,14 +24,14 @@

Usage Notes

  • The "alignment" argument refers to how data is stored within a buffer. If your alignment is set to say, 4, and you write a single piece of data which is 1 byte in size then do a buffer_tell, you'll get an offset of 1. However, if you write another piece of data, also 1 byte in size, then do a buffer_tell, you'll get an offset of 5 as the alignment has "padded" the data to that size. Alignment only affects where things are written to, so if you do a buffer_tell after you write something, it'll return the current write position which immediately follows the data you've written. Note, however, that if you then write another piece of data, internally the buffer will move the write position along to the next multiple of the alignment size before actually writing the piece of data.
  • When dealing with "offset", this is the value in bytes to offset the data by within the given buffer. So if your buffer is 2 byte aligned and you want to skip the first 4 aligned places, you would have an offset of 2 * 4 bytes.
  • Some of the buffer functions also create a new buffer (like buffer_load for example). Remember that these buffers will also need to be removed from memory when not in use using the buffer_delete function.
  • -
  • The memory used for creating buffers is system memory so even when the game doesn't have focus, any data stored in a buffer should be safe, however if the app is closed or re-started then it will be lost.
  • +
  • The memory used for creating buffers is system memory so even when the game doesn't have focus, any data stored in a buffer should be safe, however if the app is closed or restarted then it will be lost.
  • The following pages explain how buffers work within the context of GameMaker and contain a couple of code examples for those users that are unsure of how to use them:

    -

    When you create a buffer, the index value used to identify it is an integer value starting at 0. These indices are re-used by GameMaker, so a destroyed buffer index value may be used by a newly created one afterwards, and we recommend that you set any variable that holds a buffer index to -1 after having destroyed the buffer.

    +

    When you create a buffer, a reference to the new buffer is returned. After the buffer is destroyed, we recommend that you set the variable that holds a buffer reference to -1.

    Function Reference

    General