[Solved] How do I : reset a dictionnary

Get help using Construct 2

Post » Mon Jan 04, 2016 1:20 pm

I noticed that upon restarting a layout, the instance variables of a dictionnary wouldn't be reset to their original values.

I've tried making a capx from scratch, triggering every reset action I found on a keypress (persisted object, layout and global variable), but the changes made to the dictionnary's variable would survive everything...

Did I miss something ?
Last edited by Estecka on Mon Jan 04, 2016 1:49 pm, edited 1 time in total.
B
7
S
3
G
3
Posts: 56
Reputation: 2,240

Post » Mon Jan 04, 2016 1:39 pm

There must be an action where you set the dictionary content, right?
But if you are talking about resetting the instance variables of a global object (Dictionary is usually set to global), you should make actions for that..
Global objects keep their values, because they are global..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jan 04, 2016 1:42 pm

Maybe you could do:
Dictionary -> Destroy
System -> Create object [Dictionary]

for a quick but dirty way to 'reset' the values.
B
163
S
120
G
9732
Posts: 42
Reputation: 4,875,331

Post » Mon Jan 04, 2016 1:48 pm

"Usually" set to global ?
Ho, thank, I never noticed that little subtlelty in objects being able to be global or not. In my case that's fixing my problem.

Now you say "global" though, there's one thing still poking my mind: how comes we have an action to reset global variables but not global objects ?
B
7
S
3
G
3
Posts: 56
Reputation: 2,240

Post » Thu Aug 25, 2016 4:40 pm

You can use use "for each value" -> "delete: dictionnary.ActualKey"
B
17
S
10
G
19
Posts: 140
Reputation: 11,457

Post » Thu Aug 25, 2016 4:51 pm

Dictionary->Clear
ImageImageImage
B
71
S
20
G
190
Posts: 3,533
Reputation: 108,340


Return to How do I....?

Who is online

Users browsing this forum: RaiSen and 11 guests