Where are the global variables

For questions about using Classic.

Post » Sun May 22, 2011 6:23 pm

Ok so I look in the forums for a way to put a Score up and I keep hearing about global variables. I know there SUPPOSED to be in the projects tab right next to the transition icon but it isn't there for me, never has. I don't know what's up.I have the lastest verison of Construct Classic
B
5
S
3
G
4
Posts: 189
Reputation: 2,910

Post » Sun May 22, 2011 7:00 pm



1. Click the Project tab (not the one at the top of the Construct window), then look at the list it gives you. You should see a folder named "Global Variables".

2. Right-click on that folder and click on "add global variable".

3. A small window will pop up named "Construct: Add global variable", and this is where you will name your Global Variable (in the first field), decide whether the Global Variable type will be text or a number (see the pull-down menu), and decide what the initial value of the Global Variable will be (third field).

4. When you've chosen all of what you want to do in #3, click OK, and you've created a Global Variable.

Now the Global Variable is in and can be used in events.
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Mon May 23, 2011 5:48 pm

Thanks, I have a tendency to overlook somethings. :lol:
B
5
S
3
G
4
Posts: 189
Reputation: 2,910

Post » Fri Sep 23, 2011 6:25 pm

Hi! I'd like to ask where are the global variables in Construct Classic. Does anyone know it?
Borka223 from RecGames
B
14
S
4
G
5
Posts: 39
Reputation: 2,987

Post » Fri Sep 23, 2011 6:29 pm

The answer is 2 posts above yours. Once created they are accessed via the 'System' object.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,844
Reputation: 48,289

Post » Fri Sep 23, 2011 6:36 pm

Sorry, I meant Construct 2.
I found it out in the beginner's tutorial.
Borka223 from RecGames
B
14
S
4
G
5
Posts: 39
Reputation: 2,987

Post » Mon Jun 18, 2012 11:13 pm

If you haven't created any global variables then there is no folder entry in the Project tab to right click on.

To create your first global variable you need to select the Event sheet.

Right click on the event sheet and select "add global variable".
B
7
Posts: 20
Reputation: 580

Post » Mon Jun 18, 2012 11:32 pm

[QUOTE=Chainsaw] If you haven't created any global variables then there is no folder entry in the Project tab to right click on.[/QUOTE] To what Construct version do you refer to? Construct Classic or Construct 2? For Construct Classic this is not true. There's always a folder entry named "Global variables".
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri Mar 06, 2015 5:01 pm

When writing a plugin, you can access the global variables like this:

var gb_vars = cr.runtime.all_global_vars;
var bg_value = gb_vars.getByName("variable_name");


Array.prototype.getByName = function(name) {
for (var i=0, len=this.length; i<len; i++) {
if (typeof this[i] != "object") continue;
if (this[i].name === name) return this[i].getValue();
}
};
B
5
Posts: 10
Reputation: 269

Post » Fri Mar 06, 2015 5:19 pm

@hlebegue

No you cannot access global variables in Construcy Classic as you have described. Maybe in Construct 2, but this is the Construct Classic section and the thread you have bumbed is nearly 3 years old.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,844
Reputation: 48,289

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests