How do I add multiple keys...

Get help using Construct 2

Post » Wed Jul 23, 2014 1:33 pm

How can I add multiple keys in a single line with the dictionary object?

It works fine if i have separate lines of code like in the sample but is there a way to add new entries on a single line?

ie.. (Inventory ---- add key "coin,wood,mobdrop" with value 0)
You do not have the required permissions to view the files attached to this post.
B
15
S
4
Posts: 31
Reputation: 1,267

Post » Wed Jul 23, 2014 2:49 pm

smoke84 wrote:How can I add multiple keys in a single line with the dictionary object?

It works fine if i have separate lines of code like in the sample but is there a way to add new entries on a single line?

ie.. (Inventory ---- add key "coin,wood,mobdrop" with value 0)

I don't think that it's possible. At first i want to say that you can possibly use "Add key" > ("wood" & "coin" & "mobdrop"), because nothing except "&" can be used in strings, but then i try that on my own and it doesn't work, the string like that just adds a key "woodcoinmoney", that's how "&" works.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Wed Jul 23, 2014 3:01 pm

I guess you could that with a function.

Both of these functions work, use the one that suits you most !

You could even add another parameter to set a specific value to those keys, instead of the default 0.
You do not have the required permissions to view the files attached to this post.
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Wed Jul 23, 2014 3:14 pm

Magistross wrote:I guess you could that with a function.

Both of these functions work, use the one that suits you most !

You could even add another parameter to set a specific value to those keys, instead of the default 0.

Now i really believe that construct 2 can make everything, that's clear magic :lol:, but it's not fairly single line that op wanted, it's a single line with a function :)
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Thu Jul 24, 2014 12:55 am

@Magistross The first method you described worked perfectly for me. Thank you.
B
15
S
4
Posts: 31
Reputation: 1,267


Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 8 guests