• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

scope

  1. A Random Creator

    SOLVED Defining functions in a struct and calling them as an instance?

    Hey everyone! So maybe I'm just using structs wrong I'm not really sure, but essentially what I'm trying to do is give my NPC different personality profiles - something like this: BehaviorProfiles = { Aggressive: { Weight:7, //Used for calculating rarity. weight/totalweight =...
  2. G

    Help differentiating objects for RPG dialogue

    Hello! I'm working on an RPG right now, and have multiple identical npc objects i've placed in a scene, using the Variable Definitions tab to give them each a unique ID. However, whenever I try and interact with either NPC #1 or #2, the dialogue for #2 is all that appears. I've messed with the...
  3. FeetUpGaming

    check if code is global or instance scope

    So i'm having an issue with a debug function i made that just gets a simple suffix of the name of the instance running the code using "id". However i'm running my debug function through gml_pragma() at some point so it's trying to find undefined.id which obviously doesn't exists. So i need a way...
  4. B

    GameMaker Methods Inside Struct Not Working Properly

    I'm working on a player state machine. I want to create movement states based on smaller predefined movements (so that I can mix and match to create those movement states). For example, rather than just have a default player state that contains all the code for that state, I would like to...
  5. Lumenflower

    SOLVED Arguments when defining method variables within a function

    Hello, I have been working on a little text-based project recently based on an unfinished entry into one of the jams a few months back. Instead of typing in commands and having it be interpreted by a parser, certain words are highlighted in colour so the player can click them and choose from a...
  6. 2

    Is It Bug/Error: 2 Vars Same Name One Script Scope, Other Object Scope?

    If you use var to designate a variable is only being used in that script, but someone adds a variable with the same name to the same object (or a child object) that's visible to the rest of the object will there be any bugs? eg. possibly the script wrongly using the variable that's visible...
  7. xDGameStudios

    [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...
  8. C

    DS_LIST Scope

    Hello everyone, I've been searching for some info regarding variable scope for DS Lists. I'm sort of under the impression they are global. My scenario is that I have a number of instances in a room that are from the same object. I am setting them up so that they monitor a circle around...
  9. L

    Legacy GM using buffer with var scope

    let say i put var some_buffer = ds_map_find_value(async_load,"buffer"); in network async event, should i delete the some_buffer variable everytime at the end of network async event to prevent memory leaks? i noted that when i delete it, it will cause illegal buffer error sometime
  10. L

    GML Aren't variables supposed destroy themselves?[solved]

    Ive used game maker for about 8 years now but haven't really used the debugger ever. I recently started using game maker studio 2 and have a few things that are making me go wtf. so I fired up the debugger and when i pause to check my local variables, i can spot variables that were created in a...
  11. D

    GML A few questions about GML

    There are a few things i couldn't find in reference. 1. About the variables in the following code (script code); for (i = 0; i < 10; i++) { bar = i * 10; foo = bar; } what is the storage class of variable i and variable bar? I believe they are not local variables since we didn't...
  12. J

    [SOLVED] Script scope

    I have a script that needs to be called by multiple objects, constantly. It's possible it could be called simultaneously by two or more objects. The script receives a vector angle, uses it to sort values in an array created in the script, then returns one of the values in the array. I'm...
  13. L

    GML questions - scoping, api, timing

    Hi all, I had some questions about GML. Sorry for the length of the post I thought I'd just drop them all in one. 1. Is there an API similar to Java or JS framework APIs somewhere? In particular I'm looking for object variables, instance variables, object and instance functions 2. Related...
  14. M

    Passing variables into a "with" block

    Hi everyone, I've been using the command below for most collision interactions so far: with(other){ hp = hp - 5; } What I'm trying to add is the ability to pass a value into the "with" statement so that 5 is not hard-coded. Something along the lines of: var temp = 7; with(other){ hp = hp -...
  15. C

    Variable score issue ( with )

    Hi again. Coming from Ruby, Java, C#, C++, etc. I'm having a really hard time adapting to GMZ. I like the language for It's simplicity, but I can't get around some scoping problems. Here's the problem I've been having: local variable tower_hp(100003, -2147483648) not set before reading it...
Top