[Plugin] Globals

  • I am testing this out with a boolean.

    As an action using The Global Plugin "Set boolean" the boolean can only be set to "True" or "False".

    As a condition when using System "Compare two values" I can only compare to "true" or "false".

    "False" isn't working when compared to "false"?

    It seems to be ignoring the condition.

    When I change it to a text variable I am able to match the capitalization of the variable and the conditions are working.

    It seems boolean can't be used, or I am comparing/setting it wrongly?

  • Unconnected you can compare it with 0 or 1. 0 is false, 1 is true.

  • .

  • > I am testing this out with a boolean.

    >

    > As an action using The Global Plugin "Set boolean" the boolean can only be set to "True" or "False".

    >

    > As a condition when using System "Compare two values" I can only compare to "true" or "false".

    >

    > "False" isn't working when compared to "false"?

    > It seems to be ignoring the condition.

    >

    > When I change it to a text variable I am able to match the capitalization of the variable and the conditions are working.

    > It seems boolean can't be used, or I am comparing/setting it wrongly?

    >

    Just use "is bolean set" and invert it to compare if a bool is false.

  • This looks awesome. Dreading converting my global variables but definitely worth it.

  • I understand why having a Global Variable the user can't change freely during game play is considered a problem.

    I have global variables that the user can freely change in game settings or game play, are these considered unsafe Global Variables? They are limited by conditions and only effect the player changing them.

  • I understand why having a Global Variable the user can't change freely during game play is considered a problem.

    I have global variables that the user can freely change in game settings or game play, are these considered unsafe Global Variables? They are limited by conditions and only effect the player changing them.

    I'm sorry but I don't understand what you mean exactly. You can change global variables during gameplay and they are safe to use from security perspective... and I think you know that... could you please rephrase your question?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A Global Variable that if changed could ruin the game or allow cheating versus a global variable that when changed won't effect game play or allow cheating.

    Something like a Global variable that sets the game limits, versus one that would allow something like a name change or a color change.

    Are both considered dangerous or just all Global Variables?

  • I don't remember I ever said that C2 global variables are dangerous in any way.

    Well, if one has a global var which value change can unintentionally make a mess on the runtime then it means his code architecture is crying a river.

    Please read my article linked in the first post here. I think it will clear things out for you.

  • I did, it is why I asked...

    I misread Issue #4 apparently.

    Thanks for the plug in.

  • Ashley, is this something worth concidering for C3? Or not necessary anymore, because C3 is built in a different way?

  • I think if you have tons of globals you could do a lot to refactor your events.

    In particular static local variables are designed as a substitute for globals but just scoped to the events that use them. For example you could use 10 static locals inside a group, when only just that group uses them, and they never appear anywhere else in the event system, and the variables themselves are close to where they are used. I think this is an under-used feature and would do a lot to solve the "global overload" problem.

  • Ashley

    I think the default settings for local variable should be static.

    I also think that it would be nice to have static instance variable.

  • Instance variables are already static, because they don't reset every tick.

  • Ashley

    "static instance variable" across the all the instances of a sprite for example.

    we have object sprite A with instances A1 A2 A3, they have a static variable called total shots fired. (its just 1 integer in memory).

    (so things can be just a little bit closer to oop)

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