How do I set token in dictionary?

0 favourites
  • 9 posts
From the Asset Store
10 Beautiful Pokemon-like Building Pixel Art Sprite Sets
  • tokenat(src, index, separator)

    I have Dictionary: Set Key tokenat(Dictionary.Get("Inventory"),2,",") to value "A" but it doesn't seem to be doing anything in runtime.

    If I set a variable to tokenat(Dictionary.Get("Inventory"),2,",") then it gives the proper token value.

    How do I set a token in a dictionary?

    How do I add a token to the dictionary key?

    I mostly need to know how to structure it differently or a different expression. I am guessing it is selecting the value of the token instead of the token. I haven't figured out how to select the token.

  • post your project

  • I thought it would only really be the expression, but here. It is only 2 events.

    Edited to remove dead link.

  • you're trying to set the key of "2" but it doesn'T exist

  • Yes I know, it is why I didn't post a c3p. I was wanting to know how to set the token or if it had to be structured a specific way. 'Add key' makes a new key with the token value.

    I was thinking I will have to use a string or array and setting it's value properly then setting the dictionary key to it, but I was wanting to avoid that. It seems like an unnecessary extra step.

  • key "1,2" instead of tokenat key"1" token"2"

  • I don't know what you mean by "1,2". It would just look for key 1,2 instead of key 1 token 2. I am guessing it isn't possible. I am currently just setting a string and then setting it to a dictionary key. I have a 'for each' loop to set the string, I feel I shouldn't need one there though.

    I will probably just use an array and set it to dictionary key AsJSON. It may simplify what I am doing and get rid of that loop. Right now I have objects getting info from other objects to create a new object, an array will make it more simple. I still would rather just be able to set a token though.

  • I don't know what you mean by "1,2". It would just look for key 1,2 instead of key 1 token 2. I am guessing it isn't possible.

    try it

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 1,2 gets a syntax error in the editor and "1,2" looks for key 1,2.

    'Add key' makes a new key called 1,2.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)