This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Listionary(_object) { | |
static __Value = function(_pos) { | |
if (argument_count > 1) { | |
struct_set_from_hash(list[_pos], hash, argument[1]); | |
return; | |
} | |
return struct_get_from_hash(list[_pos], hash); | |
} | |
static __ListGet = function(_pos) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function array_to_struct(_array) { | |
var _struct = {}; | |
var _i = 0; | |
repeat(array_length(_array)) { | |
if (is_array(_array[_i]) || is_struct(_array[_i])) { | |
show_error("Cannot convert array or struct to key", true); | |
} | |
_struct[$ string(_array[_i])] = _array[_i]; | |
++_i; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Scope Rules: | |
Caller == Whoever calls this method/function, is scoped to the caller. This is dependent on if there's an lvalue (lvalue.func()) or not. (for methods, the scope will be undefined). | |
Instance == Regardless of whoever calls this method/function, it's scoped to the instance that declared it and not the caller. (Or if using method, whatever instance that was passed in the scope that's not "undefined") | |
*/ | |
// Declared in a script | |
// Scope == Caller, global (Will work no matter where you call it) | |
function myFunction() { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @func function_execute( function/method, [arguments_in_array]) | |
/// @desc Executes a runtime function, GML function or method, respecting method rules. | |
/// @param function/method | |
/// @param [arguments_in_array] | |
function function_execute(_funcMethod, _args = undefined) { | |
gml_pragma("forceinline"); | |
if (is_undefined(_args)) return _funcMethod(); | |
var _func = _funcMethod; | |
var _self = self; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YYdebug - Whether you're using debugger or not | |
YYoutputFolder - The output folder of where your game compiled contents are stored | |
YYprojectDir - Project Directory | |
YYprojectName - Project Name | |
YYprojectPath - Path to your .yyp | |
YYruntimeLocation - The runtime location | |
YYSteamIDE - Is using Steam version | |
YYsteamOptions - Steam Options (mostly SDK) | |
YYconfig - What kind of Configuration you're using | |
YYTARGET_runtime - VM or YYC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* TabularElf made this! | |
Use case: | |
Insert fpsClock().tick(); within the begin step event of your game management object. (And never in a loop) | |
You may retrieve the FPS value by calling fpsClock() anytime to return a string value of the FPS. | |
*/ | |
function __getFPSClockSingleton() { | |
static _clockStruct = new (function() constructor { | |
static __FPSMain = game_get_speed(gamespeed_fps); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Created by: TabularElf. https://tabularelf.com/ | |
Clarification: This is a set of scripts that allow you to convert ds_maps, ds_lists and ds_grids into structs/arrays and vice versa. | |
Addtionally, ds_maps and ds_lists will automatically convert ds_map/ds_list children into structs/arrays, and vice versa. | |
You can disable this by assigning the optional argument [convert_children] to false when calling the function. | |
Note: This does not convert any data structures that are stored within or as ds_grids and vice versa. | |
Also to access a cell from an array2D of a ds_grid, you will do the following. | |
grid[cell_x][cell_y] | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function __func_array_insert(_array) { | |
var _length = argument_count-2; | |
var _index = argument[1]-1; | |
var _i = 1; | |
array_copy(_array,_index+_length, _array, _index, _length); | |
repeat(_length) { | |
_array[@ ++_index] = argument[++_i]; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Made by TabularElf | |
/// @func array_2d_height | |
/// @param 2DArray | |
function array_2d_height(_array) { | |
return array_length(_array); | |
} | |
/// @func array_2d_length | |
/// @param 2DArray |