Moving Global Variable

0 favourites
  • 5 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hey guys I just have a quick question, nothing too serious

    I was just wondering if there was a way to move global variables between event sheets?

    I know that "global" variables are used on all layouts, I just want to be able to edit the variable without having to move between the different event sheets.

    Thank you for the help

    *edit for grammar*

  • Hey Mr,

    Being that they are global, the variables can be changed in any (sheet) or layout as long as its done in event sheets that 'include' each other.

    So.. say you have a seperate event sheet for stage 1 and an event sheet for stage 2. As long as those pages link back to a page that holds the global variables you will be fine.

    To link the event sheets you need to right click on a blank area inside your sheet, then choose the include option.

  • When I have multiple event sheets I like putting the global variables in their own event sheet because I know exactly where to find them and I don't have to scroll up through a bunch of events to see them. If you want to move the global variables to their own event sheet you can do it relatively easily. I do it all of the time without problems. But it is important to make a backup first and, when you cut the variables from one event sheet, immediately paste them into the other one.

    Step by step:

    1. BACKUP YOUR PROJECT!!!!!

    2. Create a new event sheet. Call it something useful like Global.

    3. Go to the event sheet where your globals currently reside.

    4. Select and CUT the global variables. (Don't copy them or they'll be renamed when you paste.) You'll see an error message that warns you that all of your events/actions that use these globals will be deleted, but not to worry. They won't be deleted immediately, so answer 'Yes'. (You did make a backup, didn't you?)

    5. Immediately go to the Global event sheet and paste the global variables using the paste button on the left side of the toolbar.

    6. Save this new version under a new name just in case...

    You can do this to move the global variables to another existing event sheet, too, but I wouldn't do it just because I didn't want to switch back and forth while editing an event sheet.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Wow thank you both so much

    The linking event sheets together is such an awesome feature, now I can close the event sheets, which saves on load up times, but I am still able to move between them easily.

    Putting the global variables all on one event sheet is pure genius! Now with both of your guys solution I have a way to put all my global variables on one event sheet PLUS an easy way to get access to them.

    Again Thank you guys so much!

  • I know this is old, but for those looking up this answer, you don't have to link to the "Global" event sheet, the global variables will work if they are on a sheet that is never linked to. (they are initialized at the start.)

    Including the "global event sheet" in another may be a way to reset them to the default values each time that sheet is run. However the command "reset global variables" is even easier.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)