How do I access a dictionary entry via a variable?

Get help using Construct 2

Post » Sat Aug 02, 2014 8:36 am

Okay, so, I basically have a text variable that I want to use to access the value of a dictionary entry by setting it to the entry's name. I'm trying to make it do this by having it join to a counter variable- e.g. EntryID = "entry" & counter
How, then, would I be able to use this so that if my variable is entry1 it would access dictionary.entry1, but if it's entry3 it would access dictionary.entry3 and so on?
Does this even make sense? :P
B
9
S
3
Posts: 22
Reputation: 755

Post » Sat Aug 02, 2014 2:01 pm

You use Dictionary.Get(EntryID)
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
71
S
21
G
220
Posts: 3,649
Reputation: 123,727

Post » Sat Aug 02, 2014 7:53 pm

Thanks, but I'm still getting a weird issue: Whenever I try to run it, the only thing that outputs is "0". I'm trying to print dialogue to the screen... here's my capx.
You do not have the required permissions to view the files attached to this post.
B
9
S
3
Posts: 22
Reputation: 755

Post » Sat Aug 02, 2014 9:17 pm

You didn't look at my example. You don't add instance variables, you enter the data into the dictionary.
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
71
S
21
G
220
Posts: 3,649
Reputation: 123,727

Post » Sat Aug 02, 2014 10:13 pm

Oh, okay! I wasn't sure how to do that, sorry! Thanks so much! :)
B
9
S
3
Posts: 22
Reputation: 755


Return to How do I....?

Who is online

Users browsing this forum: blissfulwizard, DevinMurray, wizdigitech and 15 guests