0 Favourites

Where are the global variables

This forum is currently in read-only mode.
  • 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

  • <img src="http://farm4.static.flickr.com/3588/5747767094_2f097b2b26.jpg">

    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.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Thanks, I have a tendency to overlook somethings.

  • Hi! I'd like to ask where are the global variables in Construct Classic. Does anyone know it?

  • The answer is 2 posts above yours. Once created they are accessed via the 'System' object.

  • Sorry, I meant Construct 2.

    I found it out in the beginner's tutorial. <img src="smileys/smiley9.gif" border="0" align="middle" />

  • 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".

  • If you haven't created any global variables then there is no folder entry in the Project tab to right click on.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".

  • 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 != "object") continue;

    if (this.name === name) return this.getValue();

    }

    };

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

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