Moving Global Variable

Get help using Construct 2

Post » Tue May 01, 2012 8:27 pm

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*Mr4272012-05-01 20:29:39
Posts: 16
Reputation: 609

Post » Wed May 02, 2012 6:17 am

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.GenkiGenga2012-05-02 06:21:56
Posts: 1,036
Reputation: 10,213

Post » Wed May 02, 2012 11:09 pm

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:

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. kittiewan2012-05-02 23:13:37
Posts: 281
Reputation: 11,858

Post » Thu May 03, 2012 6:02 pm

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!
Posts: 16
Reputation: 609

Post » Tue Oct 09, 2012 10:19 am

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. Paradox2012-10-09 10:21:17
Posts: 891
Reputation: 35,843

Return to How do I....?

Who is online

Users browsing this forum: farfetchd83, lainshi, MrWhizm, RazHarmy and 7 guests