variable

  1. ZacKow264

    SOLVED Variables no longer coloured or showing up in Code Completion

    There should be an image attached to show what I mean. Instance variables, local variables, and custom scripts no longer show up for me in their assigned colours. And yes, I checked my preferences, and nothing has changed there. Additionally, none of those show up in Code Completion either...
  2. jobjorgos

    SOLVED why does 'is_undefined' NOT prevent undefined variable crashs

    I simply have this code: if is_undefined( database[i, oPlayers] ) { //stop } and still the game crashes saying that is_undefined( database[i, oPlayers] ) is not set before reading it! I acctually USE is_undefined to PREVENT this error! Why does it not work?
  3. S

    GML How i can create and save a variable for every Instances of an objects in one room?

    Hello all. I were thinking about creating and saving (in hdd or etc) a variable for every instance of an object in one room. i have thought about using of id or instance_id but i couldn't make it working. So how i can create and save a variable for every Instances of an objects in one room? For...
  4. K

    Help me please! Game Maker

    I'm still working on my game. But ANOTHER PROBLEM arose. What happens is that I have two GLOBAL VARIABLESl. Score and another global. HiScore. The latter supposedly has to show the highest score obtained, and above all, when the score is lower, it must stop adding until it exceeds it. That's...
  5. XenonMax

    GML Save page and color in 1 variable

    Hello, I want to program something like a Launchpad light show painter(this thing with buttons/music/light). Now I try to save the current buttoncolor in a variable on the right page! Like --> ( If I have page 2 change color(or image_index) to red(or 2) ) (I can't create 100000 variables for...
  6. Lens

    SOLVED Having problems to identify multiple objects with a collision rectangle

    Hello, good morning/afternoon/evening! I'm using a collision rectangle to identify other object instances around the room, and, while there is any of those specific objects touching/being inside the rectangle, the main character (whose posseses the collision rectangle) will change a variable...
  7. K

    GML About variables and global variables

    I wanna know about the difference between them, is that variables are attached to the object only, and you can't use it in another object and global variables are available across all objects? I don't know if I am right.
  8. Lens

    SOLVED Problems identifying specific object and thus changing its variables.

    Good morning/afternoon/evening! :potato: I have many instances in a game called oBomber. Also I have an object called oTank, which has a range (collision rectangle). Once oBomber gets inside the oTank's collision rectangle, it should lose HP (to make it simpler, as for testing, now it just...
  9. M

    if the variable for nearest instance = 1: stuff happens

    Hey, basically, I want to make it so that if an enemy object with a certain variable (effect) set to 1 comes near enough to another enemy object whose var is still 0, then that enemy object's var 'effect' also becomes 1. Sort of that the effect spreads to all nearby enemies from each other. I...
  10. M

    referring to an instance stored in a variable

    Hey guys, Im trying to have my game pick a random instance of an object (enemypar) and then store that random instance to a variable. Then, I'd want to refer to that variable in this a statement, for example: <variable here>.distance_to_object(playerpar) < 100 So that the randomly picked...
  11. U

    GMS 2 Check all objects

    Hey, i was wondering if the is a way to check if one variable is equals to 1,for example, in all objects of one type: if(all of object one type.variablenamehere==1){ then do something }
  12. flyinian

    (SOLVED)Can't Assign variables to variables in the "Variable Definition" page of an object.

    I am trying to assign a variable to a variable in the variable definition on the object's page. EX: //Here is the variables in question. //I am assigning _object an object. I am then assigning _SpriteX & _SpriteY the variable of the _object's X & Y value which is determined through another...
  13. flyinian

    Design Questions about Delta time, lag with incremental/click based game.

    1. Is Delta timing good for a incremental/click based game? 2. If I have variables doing calculations per step, and the game lags, will it cause issues for me? Ex: if I had two variables relying to be in sync, and become out of sink due to lag. Or is that lag just voided steps and the...
  14. Scienitive

    GML How to put piece of code in a variable or argument?

    Hello, I am trying to put some code into an argument of a script how can I do it? This is how I want to call the script: change_script(1, 2, global.military_point = global.military_point + 3, global.economic_point = global.economic_point + 3); This is inside of the script: var unique_id =...
  15. CreativeBand124

    Triggered variable one time

    Hello guys! I got a problem. I make game similar to FTL and i need this for my crew members code. So... i got script for rooms and crew members which are cloned obj_crew. This is inside the room_script which are in draw event of gui_object. This code it's for slots on my room scripts for the...
  16. William Garrison

    GMS 2 Referencing drawn layers

    Okay so is it possible (and if so how to go about it properly) to draw sprite items and then reference or move them individually in game when something happens? For example, lets say I have this... draw_sprite(info here); // top layer draw_sprite(info here); // mid layer draw_sprite(info here)...
  17. Fleoh

    GMS 2 [SOLVED] Is there a way to adress a variable from a string ? (asset_get_index)

    Hello guys, I've got a question. In Game maker, there is a way to adress an object from a string with the function asset_get_index. Exemple : weapon = "pistol"; sprite_index = asset_get_index("spr_"+ weapon); Is there a way to do the same thing with a variable ? Exemple : sell_pistol =...
  18. Pompadour Dude

    GMS 2 (SOLVED) How to combine string variables?

    Hey guys, I am working on one of my games and I want characters to change clothing (head / body / legs) separately. I want to use three string variables. For example: headSlot = "some var" bodySlot = "some var" legsSlot = "some var" These variables can be equal to clothing type: bodySlot =...
  19. William Garrison

    GMS 2 if Toggle

    Why doesn't this work? var toggle = false; if keyboard_check_pressed(ord("1")) && (!toggle) { image_index = 1; toggle = true; } if keyboard_check_pressed(ord("1")) && (toggle) { image_index = 0; toggle =...
  20. K

    Drag And Drop always: 'variable not set'

    Hello! Always i have this problem. I don't know what to do to repair this bug. Please help.
Top