functions

  1. 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...
  2. B

    GMS 2.3+ Code Copying, Deleting, and Pasting in Scripts

    Recently I updated to the most recent part of GameMaker. Before this problem occurred, I already had 2.3, but the most recent update caused this error to happen. Basically, whenever I go into my code the functions within my code duplicate themselves and cause compile errors due to code...
  3. P

    GMS 2.3+ Array not set before reading (Bug?)

    Hi GMC! I have a question about arrays that I'm not getting and I think it's best explained with a demonstration. Consider the following code in the Create Event of a newly created object called objArrayTester: //Example #1 function addOne(array) { array[0] += 1; } a = array_create(1, 0)...
  4. Cofefe

    GMS 2.3+ Inputting Methods Into Scripts

    Hello forums! Long time no see. I have a quick question that I need answered, and I know somebody here can do it for me. The question is: Is it possible to input method variables into script functions? Here's an example of what I'm trying to do, but which doesn't work: // Step Event: Test =...
  5. zendraw

    GMS 2 [SOLVED] custom camera

    im not sure if im doing somthing wrong, but camera/view functions dont seem to work. i have this code that runs in the first room, then we go to 2nd room in the project with 0 effect. /// @desc scrstart(); camera_destroy(view_camera[0]); show_debug_message(111111111111111111); if...
  6. elsemeow

    SOLVED Which way to call a function is more robust?

    Hello! Please, help me with this: What is the difference between these two approaches? Which of these ways will be less likely to change in future updates? Context: Eg. fn_foo function in script scr_script function fn_foo(_arg) { show_debug_message(_arg); } Arbitrary place in the object...
  7. xDGameStudios

    Asset - Scripts [BUFFERS] xBufferViewer is a GUI for buffers (v1.0.1) (FREE)

    [LINKS] https://marketplace.yoyogames.com/assets/9617/xbufferviewer https://xdstudios.itch.io/xbufferviewer [SCREENSHOTS] [INFORMATION] This asset is composed by a BufferViewer structure (new in GMS2.3) that allow for visualising/selecting/copying buffer contents. The viewer GUI is fully...
  8. FoxyOfJungle

    GMS 2.3+ Why use "static function()" inside a struct function??

    I tried to look in the manual but I couldn't find exactly what I wanted, it's because I'm using structs and I ended up in a situation where I need to use one function inside the other, but I saw people using static, but I don't know what the function is, I click on the function and it doesn't...
  9. Wonsubon

    SOLVED Using functions in switch statements?

    Is it possible to use functions in a switch statement? I have an object that, when destroyed, will destroy another object with it, but there are multiple security camera objects and only one can exist at a time. if(instance_exists(obj_camera01)) instance_destroy()...
  10. P

    SOLVED How to Update Function Description and Arguments???

    Hello Everybody, I have met the problem while trying to remake some of my functions in GMS 2.3 . I had 6 different scripts for converting coordinates to isometric like in Shaun Spalding's tutorial. Then I decided to use new feature of GMS 2.3 and collect functions from those 6 scripts into 1...
  11. P

    GMS 2 Help with angles maths

    Hello everybody. I need help in making my cursor (which is an aim of the player) move randomly around the real cursor(mouse x and y). The problem is I don't know how to create the function of the x and y coordinates of the cursor (which is actually just a point with sprite) the way that it moves...
  12. Cupid Stunt

    GML [Solved] Data structures of objects, message passing, and multiple collisions

    I'm new to GMS2, but I have 34 years programming experience, including 4 years video game programming. IDE v2.2.4.474 Runtime v2.2.4.374 I watched all 4 of the 1st game gml videos on youtube and made the game along with them. I've been searching the forums and the docs on yoyogames. I've...
  13. P

    Passing 2 argument with one DS

    Hello Everybody! Im new to Gamemaker 2 so and programming at all so i dont know if there was a way to pass 2 arguments in function with ONE data structure(of any type). I mean imagine for example that you have to create an object with fixed X and Y coordinates that are always same, but is there...
  14. Kezarus

    Asset - Project Free Asset - Monastery Framework

    Monastery Framework OBJECTIVE Create a framework project on GM2 that have some useful functions, GUI elements (buttons, panels, containers), basic Options menu, start Ini files that houses preferences, the basic setup for music, sound and particles. DESCRIPTION Ok, I will have to do something...
  15. S

    GML A way to extract all GML (builtin) functions' metadata?

    Hello, I have been working out on the SDK for Windows DLL extensions... It is going great. But, I do have a question, is there a function in GML which would return a (big) map data-structure, a value containing all builtin GML functions' metadata (information about the function signature...
  16. Fixer90

    GMS 2 Script with Unlimited Arguments?

    I am mostly aware of how GML's script system works — with arguments and whatnot. However, I am curious as to if there is a way to make a script with no limit to arguments, similar to some built-in functions in GML (ex. ds_list_add). Is this possible?
  17. Suzaku

    GMS 2 Useful functions for the Draw Event

    Im starting to learn how to use the draw event to draw everything in the game and I would like to know some of the most common and useful functions that are helpful to work with the draw event, not only "draw_" functions, I want functions like something to get the borders of the drawn sprites to...
  18. EvanSki

    Why is there not a font_get_range?

    Why is there not a function that gets the available range of a font? For example, you have a font (fnt_arial), with a range of 65 - 68 so the available characters from the font is A,B,C,D Now imagine your making a user text input system or just want to see if a font has the character in it So...
  19. T

    GML Functions within script

    Hi all, Is it possible to split your GML scripts into functions? for example I have a piece of code like this: // Jumping if (place_meeting(x, y+1, obj_wall)) && (jump_key) { vrt_speed = jump_power; } // Horizontal Collision checking if (place_meeting(x+hoz_speed, y, obj_wall)) {...
  20. A

    Buffer confussion

    Hello! I've been using buffers to save / load huge amounts of data, to cut the long story short this is the save code: var _cmp = buffer_compress(_data_level, 0, mw * mh * REGION_SIZE); buffer_save(_cmp, string(level_name))//+ "|*.mle")...
Top