1. X

    Functions Cause Memory Leak?

    I've created a set of functions inside a script, but using those functions seem to cause a memory leak. I saw a thread talking about this on the forum, but it was posted in October 2020, and I just found the leak now. I don't know if this helps, but here is my function inside of my script...
  2. D

    SOLVED room_get_width and room_get_height??

    Is there no way to get the current width and height of a room we're not occupying? I can clearly set the width and height of another room but how can there be no accompanying get functions? 🤯
  3. Misael644

    GMS 2 Parts of a string not being removed

    I am creating a function that serves as a textbox generator. The function works like this: //the function dialogue_create("Hello,/60 /03this is a test!","character",0,"left",3); //description /// dialogue_create(text,character,expression,pos,speed) /// @arg text /// @arg character /// @arg...
  4. pikachurian

    GMS 2.3+ [Solved] Function/Script Executes Twice Help

    I'm making a turn based battle system. I have a battle manager object with a switch state machine. Each state has code that executes for the first frame in that state. The enemies in the battle are stored in an array in the battle manager. During the first frame in the enemy turn state, the...
  5. FoxyOfJungle

    SOLVED How many times can I call gml_pragma("global")?

    Hi! I have a question, can I assign a function to run in gml_pragma("global", ...) more than once? Example: gml_pragma("global", "init_global_variables();"); gml_pragma("global", "init_shader_uniforms();"); Will this work? Thanks! Edit: fixed typo.
  6. FoxyOfJungle

    SOLVED Unable to get object for index 100001 ???

    Hi! It's the first time I've seen this error specifically. I'm starting to think it's a bug (or I don't understand this behavior), but I'll try to explain: #1 - I have this code in a script file (GML): Code 1: enum ENUM { ITEM1, ITEM2 } function ftr_setup() { global.list_of_itens...
  7. Joe_La_Bricole

    Asign funtions in structs

    Hello ! I would like to declare a function in a script and then assign this funtion to a variable in a struct to call that function. Is that possible and if yes how ? Here is a little example : function message() { show_debug_message("this is a message"); } function struct_with_message()...
  8. Gunnar the Clovis

    SOLVED [SOLVED] Passing object_index to function instead of one instance / Making functions work like with (kinda)

    Howdy, I assumed this would be an easy issue / have tons of similar threads on it already, but I can't seem to find any. What I'm trying to do I thought would be very simple, but it's proving to be troubling for me. Hopefully I'm just being stupid and there is an easy solution: I want to...
  9. N

    SOLVED Easy way to clamp to 0 after a certain number has been reached?

    Hi, I have the variable speed = 8 In my step its: speed *= 0.9; and I want it to jump to 0 after its below 1. Do I always have to write if (speed < 1) speed = 0; ? or is there an easy function like clamp, min, max etc.
  10. Misael644

    SOLVED Any function or code that works like "draw a line for the instance whose variable is x?

    Hello! So, basically I want to make a code that is like: "draw a line for the instance whose variable is x". I thought about using instance_find to do this, but it only works like "I will only draw a line if the instance id is x". I wanted to use such a function to make "line graphics", which...
  11. xDGameStudios

    GMS 2.3+ [TEXT TUTORIAL] Keyword "function" & Methods Explained

    GM Version: Studio 2.3+ Target Platform: Windows / All Download: n/a Links: n/a [THEME] Today we will be talking about functions, so this tutorial will be about the function keyword and the method() function. In the in-betweens, I will also talk about binding. What is it and why is it important...
  12. G

    Windows Upgrade function issues | Store Variable in Variable

    Hello, I have been working on my second game for a month now and wanted to add a series of upgrade Buttons to give the Player the ability to improve their stats (walking speed, mining speed etc.). I wrote a function that is supposed to be triggered if my button gets pressed. That works perfectly...
  13. T

    GMS 2.3+ Strange struct variable behavior

    I have seen an strange behavior when declaring variables inside structs. The following code returns the x value of the instance that creates the struct even though it should return an error. I discovered this tracing a bug for a much bigger struct that I'm using and I really don't understand it...
  14. S

    GMS 2 Function in diffrent object event

    Is it possible for example to call a function in a step event, that is inside the draw event of that object? Like : Step event : DrawShadow() Draw event : function DrawShadow() { ...... }
  15. L

    GMS 2.3+ How to create private function?

    I didn't find the way to approach it. All functions are global whether they are in script or in obj. when project gets bigger, it will be very terrible... (the "private" means non-global)
  16. Misael644

    SOLVED Any string function that works in a similar way to "string_format"?

    So, suppose I have a string of numbers whose value is "1234". I want only the first two digits, "12". Or another string whose value is 6. I want it to be 06. I thought about using the "string_format" function, but it's not exactly what I want. I want to use to make timers in the hh:mm:ss format...
  17. X

    GMS 2.3+ Override a function of a parent object in the child object.

    Hello everybody, I've quite a little diffculty on something. Here is the recap : I have an object obj_aaa_par with a function in his create event : function generic_func(_var) constructor { obj_idx = _var.object_index; x = _var.x; y = _var.y; name =; } This...
  18. itarkytec

    Windows Need help making a string

    Hola comunidad, estoy necesitando un poco de ayuda, agradecería que las respuestas a este post estén preferiblemente en español, aunque si es de ayuda no me molestaría en recibirla de todas maneras. Contexto: estoy intentando hacer un cuadro de texto que solo acepte números como entrada...
  19. xDGameStudios

    Asset - Scripts [BUFFERS] xBufferFunctions is a collection of advanced buffer functions (FREE)

    [LINKS] [INFORMATION] This asset is composed by a set of buffer functions that allow for complex buffer parsing. Functions allow to seek and match patterns, copy regions (using read...
  20. Arilyn

    Variable <unknown_object>.instance_create() not set before reading it.

    Hello, I'm pretty new to game maker but I've messed around with Unity a lot in the past. I've hit a roadblock and haven't been able to figure out why I'm getting errors despite researching and reading the documentation, but it's probably because I don't quite understand how GML and scripts...