• 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!

variable

  1. nuclear_shmatt

    switch statement case 2 code won't run

    So, everything works, up until the "switch(i) case 2:" where it just doesn't run even though in the debugger, the 'i' variable does reach 2. if(!menu_check) { switch(menu_type) { case MENU_BAR.NORMAL: for(var i = 0; i < menu_amount; i++) {...
  2. King

    SOLVED Getting "Assignment of an empty value (function does not return anything?)" ONLY when I try to build YYC (Android)

    So my game build fine on mobile when compiling using VM. But trying to build on YYC gives me an error for one of my pieces of shader code if (end_super_speed) { var u_time = shader_get_uniform(sh_speed_flashing_warning, "u_time") if ss_final_countdown >= 0 {...
  3. NovemberTender

    SOLVED switch statement loop even with break;

    if ((menuability_commited != -1) and (global.menuability == true)) switch (menuability_commited) { case 4: { instance_create_layer(oPlayer.x, oPlayer.y, "Held_Tools",oFireorb); break; } case 3: {...
  4. Nick der mit hut

    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.
  5. E

    Windows [Solved] - Global Var doesn´t have the actual value

    Hi there, i have a confused issue. here my code: scr_revice_msg() ... case 7: var player = buffer_read(buffer, buffer_u16); scr_get_states(player, 1); scr_server_send_data(1, targetsocket, 7, global.exp); break...
  6. R

    [sorted out]updating variables

    hello guys, i have a doubt about the create event and ways to update variables with new values. well, I'm trying to create a system that passes information between instances and, I modified and updated its variables, however, when I was creating the system (I tried it in many ways, even with a...
  7. W

    Not existing variable "not set before reading"

    Hello everyone, I'm working on a platformer/fighting game right now and I just followed a tutorial on how to add a grapple. However, now when I run my game and press the button to use this grapple i get this error : ERROR in action number 1 of Step Event0 for object obj_Reb: local variable...
  8. R

    How to change variable after collision?

    I instantiate my variable and then later I have a collision that I want to make the jumpheight smaller. I have this but it does not work. I changed the number from -10 to -20 and it did change the jumpheight but the collision does not. I need assistance. jumpheight = -10 if...
  9. PotatoSnail64

    It says variable not set before reading it even though it should have been set at the creation of the instance

    In a game that I am working on I made a very simple door that is set up so that I can edit the variables of specific instances of it so they will lead to different locations. When I select an instance I am pretty sure that I can set the variables at the creation of the instance. When I go...
  10. T

    Giving a colliding object your variable value.

    I have a game which has the main character (a light bulb boy) interacting with several intractable electric objects. The electric objects have two main "states" (though no real state system has been implemented yet), where they are either turned on or off as indicated by sprites. I have a system...
  11. G

    GML Visual Creating an instance using a variable.

    When creating an instance, is it possible to use a variable containing the object name instead of the object name itself? Whenever I try doing this, it results in an error.
  12. M

    GameMaker Difference between undefined and variable not set.

    Hi there, first post so don't kill me here. Can someone explain the difference between a variable that's undefined and not set? It's just I'm used to JavaScript where they're the same thing. The reason I ask is sometimes I try to handle this by doing say if (is_undefined(fullScreen)) fullScreen...
  13. FoxyOfJungle

    Update variable in step event without initialize it in the create event?

    It seems a little strange, but let's say I don't want to initialize a variable in the create event and just use the Draw event, is there any way to make that variable change without being started? I managed to do something like this: if !variable_instance_exists(object_index, "variable") var...
  14. C

    SOLVED Collision checks in local variables executes slower?

    Hello! I found something interesting while messing around with my code. Here it is, clearly following one of Shaun Spaulding's tutorials: In the Step Event: #region//set controls key_left = (keyboard_check(vk_left)) || (keyboard_check(ord("A"))); key_right = (keyboard_check(vk_right)) ||...
  15. KyleRansford

    Solved Help with understanding error type

    Hello, everyone, I've actually upgraded to GMS 2.3.1 and for the most part, everything is working well. But, when I imported a project I was working on in 2.2, it was working well, but, since importing it into GMS 2.3.1, some aspects of the game don't work like they should. For instance, the...
  16. E

    Gamemaker Local Variables

    I have this code where I want an instance to be created as long as the circumstances are met. This is the code: if(hAmount < hMax){ var spawnCounter = 0; spawnCounter += 1; if(spawnCounter >= 3*room_speed){ var sRange = irandom_range(65,80)...
  17. D

    SOLVED keyRun, hSpeed, and vSpeed are mysteryously "undefined" in PlayerStateFree

    The h and v speed are clearly defined in the player create event (seen below): and keyRun is also clearly defined in the player step event (seen below): However when I test my game, this happens: When I re-define keyRun in PlayerStateFree, this happens:
  18. jobjorgos

    Legacy GM How to send variable over from GM to online Javascript file with 'http_post_string'?

    I need instance variable online_players to be send over from GameMaker to players.js on my website Too bad with the code below there has not anything been updated yet in the players.js file. Alarm[0] Event: http_post_string("http://example.com/***/***/players.js"...
  19. 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...
  20. 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?
Top