A simple way to replace variable names?

Get help using Construct 2

Post » Fri Jun 08, 2012 10:10 am

Hi there,

When I code I have this tendency to have to move global variables around (for example from one event sheet to another, or to an object's instance variable), however it's a hassle to do so for me because Construct 2's consistency checker gets in the way (I can't simply delete the declaration of the variable and let the compiler show me the parts I have to change as I would in a programming language, furthermore deleting the declaration is not an option because it removes all uses of the variable). Is there a replace variable functionality implemented anywhere in Construct 2 that I could use to ease the process along?

Thanks for your help!
B
19
S
5
G
4
Posts: 85
Reputation: 4,925

Post » Fri Jun 08, 2012 10:17 am

There no simple way to do it.

You might to try Dictionary Plugin, it may add and delete keys as variables. It could replace keys.
Joannesalfa2012-06-08 10:40:44
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,646

Post » Fri Jun 08, 2012 1:42 pm

You can cut and paste event variables between event sheets. When you paste it back to the second sheet all the events that disappeared should reappear again (providing the variable's scope hasn't changed).
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Fri Jun 08, 2012 4:15 pm

Thanks for the suggestion @Joannesalfa! Although using a dictionary to perform this task seems a little heavy handed. And I do like grouping things together in their respective objects/event sheets.

@Ashley Thanks for the tip, that works! I've never tried it before because of the warning it gives and the subsequent deletion of events. Any suggestion about the change from a global var to an object var though? Any chance that a simple way will be added in the future?

Cheers!
B
19
S
5
G
4
Posts: 85
Reputation: 4,925


Return to How do I....?

Who is online

Users browsing this forum: getplay and 26 guests