Copy one Dictionary to another

Get help using Construct 2

Post » Sat Feb 02, 2013 1:01 am

Hey guys,

Having a bit of trouble, I'm trying to find a way to copy all of the keys and values from one Dictionary object to another. I'm probably doing something wrong with the "Pick all" condition, I've never had to use it before now. I made a simple project showing what I'm trying to do, and a screenshot showing the main section. Can someone take a look and find the problem?

http://dl.dropbox.com/u/19702035/dictionary.capx

B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sat Feb 02, 2013 1:17 am

Alright, I THINK I found the problem... It's another case of the infamous "object you create doesn't actually exist until the next top level event" thing. With some rearranging I've gotten that small demo to work properly. Now I just gotta get it working in my full project...
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sat Feb 02, 2013 1:50 am

It's easier to use 'load from JSON' if you're copying the whole dictionary. You can store the first dictionary in a variable (Dictionary.AsJSON) and then load it into the new one.
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Sat Feb 02, 2013 3:10 am

Yeah, I was looking at that, but the whole "intended for development only" threw me off. That sounds ominous. >_>

Ooooohhhhh, alright. The AsJSON thing, I didn't look at that part.

And now it works like a charm, in a ridiculously more simple way. I think I'll ask for better reading comprehension for my birthday this year. Thanks a bunch, who knows how much more time I would've wasted on this!
B
20
S
9
G
6
Posts: 607
Reputation: 6,112


Return to How do I....?

Who is online

Users browsing this forum: mercuryus and 14 guests