Reset Global variables to default values.

New releases and general discussions.

Post » Thu Apr 30, 2009 6:38 pm

An Action to reset global variables back to their default value would be nice. so that If you use them to move from layout to layout and you start a new game it will set them back to their defaults.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Thu Apr 30, 2009 6:53 pm

I don't remember if such feature was implemented anywhere. If you were to provide "Reset Global Values", it'd be only natural to consider adding this feature for PVs, arrays and stuff.

I find workaround too easy and too intuitive to add such feature.
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Post » Thu Apr 30, 2009 7:00 pm

Intuitive yes but practical to program: no.
If I have 30 variables that need to be reset back to default values I am supposed to write out 30 events and search through them every time I change the default value I have to slog through the events and change it again.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Thu Apr 30, 2009 7:13 pm

You're supposed to write 30 actions in 1 event, not 30 events. That'd take about 2-5 minutes.
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Post » Thu Apr 30, 2009 7:19 pm

You still have to write all the code how is that easier than "Reset variable"?
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Thu Apr 30, 2009 7:27 pm

You don't see my point. You shouldn't add feature "reset" to global variables alone. PVs are also variables and they should be provided with the same ACEs as global variables. That's the consequence in programming. And I'd be really disappointed to see that PVs vectors are written twice in memory (original values and modified in runtime).

To tell it short, you shouldn't add wild ACEs.
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Post » Thu Apr 30, 2009 7:33 pm

First off Global variables are easier to pick. PVs you have to pick an specific object of who's variable to reset and what happens if you cant pick them right?

Why do global and Private need to have the same ACES? They should yes but they don't need to. The fact is something like reset back to default variable would be very useful weather they implement it is up to the devs and the devs alone.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Thu Apr 30, 2009 7:33 pm

I think this would be a useful feature, both for global and private variables.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Apr 30, 2009 7:37 pm

Storing copies of instance's PVs for every object would take too much memory. Construct aims to have great performance.
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Post » Thu Apr 30, 2009 7:56 pm

Eh, you're probably right. Okay, then... if it can't be done for PV's I still think it would be a good feature to have for globals.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests