global

  1. FoxyOfJungle

    SOLVED How many times can I call gml_pragma("global")?

    Hi! I have a question, can I assign a function to run in gml_pragma("global", ...) more than once? Example: gml_pragma("global", "init_global_variables();"); gml_pragma("global", "init_shader_uniforms();"); Will this work? Thanks! Edit: fixed typo.
  2. 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...
  3. tylerbertz

    is variable_global_exists() broke or am i misusing it

    if(!variable_global_exists("apple")){ global.apple = 21309734013292217380192417230912837120398123712039; } the problem is it returns true regardless if global exists or not
  4. xDGameStudios

    GML [TEXT TUTORIAL] object.variable vs global.variable vs globalvar/macro structs

    GM Version: All Target Platform: Windows / All Download: n/a Links: n/a [PROBLEM] What is the difference between object.variable, global.variable and what are globalvar macros? When should I use one of the other?! [EXPLANATION] The first thing that we need to understand is that we are trying...
  5. N

    game_load_buffer() / game_save_buffer() and global data scope problem...?

    I'm trying to use game_load_buffer() / game_save_buffer() to add simple checkpoints to my GMS2 game. However, I've ended well and truly confused. :-( My main character starts with three lives: (Main Character Instance -> Begin Room Event) level_buffer = buffer_create(512 * 1024...
  6. Adriano_ppaula

    (SOLVED) Taking variable from repeated instance to global

    Hey guys ^^ I need help with my game. I'll put a simple example here: I am making an item system in which when the player selects an item he verifies some information about it. global.item_select = (ob_item_sword_01); atk = global.item_select.atk; lv = global.item_select.lv; The problem...
  7. A

    Legacy GM Trying to switch between control of three objects

    I'm able to control both the first and third character using a variable called global.character = [number] in obj_control but not the second character for whatever reason I thought at first it was because global character is strictly a binary statement but i can successfully switch between 1 and 3
  8. P

    Trying to make a global z axis

    Hey everone, using this video I was able to get a zaxis implemented, although I don't fully understand it. Is anyone able to explain to me which part of this sets the z axis. I'm trying to make a script or a parent object that sets a z axis for all objects that may be floating or jumping. And...
  9. E

    GML Global Variables not being updated

    Hey coders, I initialise all my global variables in my first page. When i move into a fight i want the if/else statements to allow for me to create a battle system but the global variables are not being updated. (Also to note the global.MonsterSpeed> global.Spd is always called even if Spd is...
  10. M

    GM wont let me do this

    i did a dialogue system, it works with message[0] = bla, message[1] = bla bla etc... so i did this message[0] = "You ate a " + food + " " + m + " " + global.heal + "remaining" food its a random food, m its a comment based on the chosed food, global.heal is the remaining foods, but it wont let...
  11. I

    alarm and score

    I'm working on a game for a schoolproject and I need to make an alarm. This alarm has to work in different rooms, but it has to be the same countdown alarm. When the alarm ends, the game needs to stop. The score has to be a global score which we can display in different rooms. After the game...
  12. K

    Setting Array to Global Value

    Well I have a problem but not really sure where to start. Basically I have a weapon system set up in an array with ds_maps in the create even of oWeapon. //AR weapons[2] = ds_map_create(); ds_map_add(weapons[2],"sprite",sAR); ds_map_add(weapons[2],"recoil",25)...
  13. Edwin

    Legacy GM [SOLVED] draw_set... are performing for another objects

    Hello, comrades. I have a problem that I can't solve: When I set a font/colour/alpha and other stuff for my sprites or fonts in one objects Draw Event when I draw something in another object it shows the same properties that I just set. I know that I can use functions like draw_sprite_ext or...
  14. S

    Legacy GM Procedurally Generated Room Names?

    I'm working on a procedurally generated game, and I want to be able to create new rooms when the player leaves the bounds of the current room. I already have the rooms set up in a 'grid' system, that is, the name of each room contains its X/Y coordinates (i.e. room "X11_Y27"). I have it so that...
  15. C

    Storing HTTP response as multiple global variables.

    Hi, I am trying to store a HTTP response as multiple global variables. I don't know if this is the best way to do this which is why I thought I'd post on here. I have a server which returns the levels, experience etc of a player as a JSON format here is an example... { "username"...
  16. B

    Collision counter

    Hi there! I want to make a collision counter. I set to the object's create event to: global.collision = 0; And the collision event to: global.collision += 1; It counts constantly when it's overlapping, but I need just one point / collision. I have no idea, how can I do it.
  17. S

    Legacy GM Can't find MAC OS X tab in Global Game Settings

    I've had to re-name my game I'm developing for the iOS app store. However, going to File > Save As doesn't remove all traces of the old name, as the output folder created on my MAC is still named with the old name. I was told, from a bug report feedback, that in order to rename my game, I need...
  18. M

    GML crazy way to tincker with variables??

    I didn't know what to put in the title for this so I apologize for the click bate ish title My question is can there be two separate objects both programed with the same global.variable but that variable changes it's name based off of some state or position in the room?
  19. M

    GML [solved] turn based strategy game giving me minor problems

    Each player can move two objects per turn. The first object to move can not move even when it is that players turn The second object moves just fine once that players turn comes around. This leads me to believe that the code below is not being referenced by the first object moved and only the...
  20. A

    GMS 2 calling Global Variables ONCE? "Game Start" event?

    hi i have a script that holds all my global variables that need to be used in my game. i have put it in the "Game Start" Event part of my player, and i've tried putting it in the first room of my games' "Game Start" Event whenever i go back to that first room, the global variables script is...
Top