[Plugin] Globals

Post your completed addons to share with the community

Post » Wed Mar 08, 2017 1:35 pm

Oh right, that way. I guess it's an interesting idea.
Scirra Founder
B
402
S
238
G
89
Posts: 24,644
Reputation: 196,095

Post » Wed Mar 08, 2017 3:50 pm

@Ashley
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.



Speaking from experience, from a non-programmer background noob,
It takes a few runs to figure out why using all global variables is a bad idea,
in fact it takes a few runs to figure out how to use things like groups and functions and local variables properly

its only when you start to understand and use these sort of features that you really begin to appreciate what you guys have achieved with Construct 2.
...
B
47
S
25
G
7
Posts: 365
Reputation: 8,436

Post » Wed Mar 08, 2017 9:49 pm

This looks excellent! Normally i do bools with a global using 0 or 1 but nice to have a true/false and not pollute the event sheets.

@BackendFreak
Whats the deal with using this as part of a commercial release?
B
9
S
2
Posts: 69
Reputation: 833

Post » Wed Mar 08, 2017 10:02 pm

Ashley wrote: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..


That's exactly the point and I have mentioned that in my article as well. Whenever it is possible you should encapsulate your project as much as you can. The code architecture is crucial in development, especially for big projects.

Then if you still need some variables with global reach the Globals plugin comes handy.

@MattTonkinson you are free to use any of my free plugins in your commercial and non-commercial projects without any restrictions. You are also not obligated to credit me or something - it's fully free.
ImageImageImage
B
31
S
19
G
82
Posts: 1,039
Reputation: 46,207

Post » Fri Jul 21, 2017 11:15 am

Hi Guys, I've updated the first post of this thread. Globals 2.0 has just been released.

== UPDATE - New extended version ==

Image

Globals 2.0 is now available in Scirra Store (note that Globals v1.0 is still and will remain free).

Globals 2.0 is an extended version of Globals plugin with the following extra features:
  • Compatible with Globals 1.0
  • Save/Load variables to System storage
  • Save/Load variables to LocalStorage (or any other place by export/import JSON)
  • Reset variables
  • Can be used as a "struct" data object

For more details and the video please visit the Globals 2.0 store page.
ImageImageImage
B
31
S
19
G
82
Posts: 1,039
Reputation: 46,207

Post » Fri Jul 21, 2017 12:48 pm

Awesome Toby! :D
B
58
S
25
G
14
Posts: 793
Reputation: 13,302

Post » Thu Aug 17, 2017 1:58 pm

Globals 2.0 is now also available for C3 .
ImageImageImage
B
31
S
19
G
82
Posts: 1,039
Reputation: 46,207

Post » Mon Aug 21, 2017 11:53 pm

Globals 1.0 is now also available for C3.
ImageImageImage
B
31
S
19
G
82
Posts: 1,039
Reputation: 46,207

Post » Tue Sep 12, 2017 3:28 pm

Hi! Please correct me if I am mistaken.
The system global variable is checked on all events of a events sheet.
Instans variable is checked by a call in an event.
I so understand, Global is checked as instans?
Something like invisible instans on a global layer?
B
20
S
7
G
3
Posts: 10
Reputation: 2,826

Post » Tue Sep 12, 2017 5:33 pm

repkino wrote:Hi! Please correct me if I am mistaken.
The system global variable is checked on all events of a events sheet.
Instans variable is checked by a call in an event.
I so understand, Global is checked as instans?
Something like invisible instans on a global layer?


Hi @repkino,

I don't know what you mean by "is checked on all events of a events sheet". Neither the native global variables nor instance variables are checked by the engine unless you code the check as a condition or expression.

Instance variables of Globals plugin are exactly the same instance variabless as you use in any other plugin.

Both native global variables and instance variables are accessible globally. If you want to read more about the differences, you can read the article which I also linked in the very first post here: http://tobyr.wtfgamesgroup.com/c2-plugi ... variables/
ImageImageImage
B
31
S
19
G
82
Posts: 1,039
Reputation: 46,207

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest