script

  1. KakuniProject

    Please help, no able to create scripts

    Hello everyone, I'm quite new to game maker and into programming. I recently started a game and I'm on the first steps creating the collisions and movements, the collisions it was working fine when I inserted into step/Object, however now I tried to add into a script . I simply copied and pasted...
  2. UberhenriK

    SOLVED ds_grid_height argument 1 incorrect type (undefined) expecting a Number (YYGI32)

    Hello, I've created an inventory ds_grid for my game and a script that must get ds_grid as an argument, but it gives me an error: ds_grid_height argument 1 incorrect type (undefined) expecting a Number (YYGI32) at gml_GlobalScript_AddItem (line 18) - for (i = 0; i <...
  3. 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...
  4. DevilKap

    SOLVED ScriptExecuteArray new errors?

    /// @function ScriptExecuteArray(_func, _args); /// @returns any /// @param {function} _func The function to run /// @param {arguments} _args[] The arguments needed function ScriptExecuteArray(_func, _args) { var _func = argument0; var _args = argument1; switch...
  5. G

    what's wrong with my daily reward system?

    hello everyone!! so, i tried to make a daily reward system where if the gets 1000000 points daily once a day when the game starts and notice the day changed here is my code in load game script: function scr_loadgame(){ if (file_exists("User.sav")) { ini_open("User.sav") global.date =...
  6. Epicrex

    Windows Script suggestions don't work.

    The red bar at the bottom should say "ScreenShake(Magnitude,Frames)" as a suggestion. I closed and reopend the script and GML, but that didn't help.
  7. W

    Can't assign a return to a variable

    I made (borrowed) a script for drawing buttons to gui and it works perfectly, except I cannot seem to assign a variable to the returned value. Here is the script: /// @function draw_gui_button_sprite(sprite, index, x, y, width, height, main_view); /// @param {index} sprite The sprite to...
  8. erayzesen

    Simple Raycast Script

    Hi all. I released a raycast code to use your any projects; Note: It support Game Maker Studio v2.3 and new versions; Check it out: (with online demo): https://erayzesen.itch.io/simple-raycast The method; var...
  9. FrostyCat

    GMS 2.3+ IMPORTANT!!! GM 2.3 Users Please Read! Improper script usage generates undefined variable errors

    Symptoms to Look For Expand for screenshot: The error is in the Create Event for object <undefined>. The subject is <unknown object> with a variable name that's either built-in or known to be already declared. The stack trace shows the source as something starting with gml_GlobalScript. For...
  10. O

    Enemies are not working

    I'm watching Heartbeast's tutorial on eme,y states and I type in the code he typed, but the game keeps crashing every time I get near an enemy Code for the enemy wander state ///scr_enemy_wander_state() scr_check_for_player(); phy_position_x += sign(targetx - x) * spd; phy_position_y +=...
  11. W

    Can I draw_sprite from a script?

    Can I draw a sprite from within a script? I can't seem to get it to work. I know the script is running because I can get the messagebox to pop up. e.g ///@description Makes sprite hover on cursor for placement ///@arg sprite var sprite = argument0; var xx = mouse_x; var yy = mouse_y...
  12. gkri

    GML Advanced resolution manager (very mobile friendly)

    I wrote this (hopefully) handy script and I would love to share it with this wonderful community. The scripts has two primary uses: To help developers handling multi-resolution easier. To offer to mobile developers a couple of quality of life features. This script is heavily based on the...
  13. chabi

    GMS 2.3+ Convert script to GMS 2.3+ script

    How can i write and convert old script to gms 2.3+
  14. E

    GMS 2 GMS2 acceleration_to_point

    Alright, here's something I thought could be extremely useful IF I could ever figure out how to make it. A piece of code where an object moves from one point to another smoothly without just jumping to the co-ordinates. This is the base I'm working with. Any ideas on how to continue this? (I'm...
  15. A

    SOLVED Array out of bounds error

    got the error while executing my code for my card game code error: ___________________________________________ ############################################################################################ FATAL ERROR in action number 1 of Step Event0 for object obj_deck: Push :: Execution...
  16. William Garrison

    GMS 2 Different Fonts in same string?

    Hey guys and gals, Im trying to figure out how to possibly get two different fonts in the same string with a script. Below is the script I set up to try and accomplish this. But obviously doesnt work. How can I make this a thing? Why do I want to do this? Well I wanted whomever is talking...
  17. M

    How to script a smooth jump animation in a platformer?

    Hi! I was watching the tutorials for a 2d platformer. All of them were teaching simple jump animation with one or two static frames. one static frame for ascending and one for falling. It seems the tutorials areteaching 8-bit era jumping. I have no idea how to implement a 16-bit era jump...
  18. Binsk

    Asset - Scripts UBG Strings

    Yoyo Marketplace (coming at some point) Itch.IO Upset Baby Games View the online documentation to explore the available functions. Would you like to expand upon the available string functions included in GameMaker? This extension does just that. The added functionality ranges from small to...
  19. S

    GMS 2 GMS 2: cannot change local variable???

    I wrote some code for checking if a given location is valid for building things, using local variable "_output" as accumulator; however, my attempt to update the accumulator in a with() loop appeared to have no effect. ///@arg build_x ///@arg build_y var _output = true; _output = _output and...
  20. FoxyOfJungle

    SOLVED "for" statement problem... (trying to make a dialogbox)

    Hi. I have a ds_list, it contains dialogs for my dialogbox. How I make: CREATE: messagebox_list = ds_list_create(); messagebox_show = true; messagebox_n = 0; ds_list_add(messagebox_list,"The quick brown fox jumps over the lazy dog"); ds_list_add(messagebox_list,"This is a long history...")...
Top