|
|
|
|
Reply From: |
p7f |
Have you tried something like this?
var x = []
x.append({ "Str": 0, "Dex": 0, "Int": 0, "Wis": 0, "Cha": 0, "Con": 0, "Slot": 0 })
And you can add sucessive dictionaries with append… So for example, for printing the dictionary saved in the code above you would do:
print(x[0])
If you want to print the Str on the dictionary you do:
print(x[0]["Str"])
And so on…
This was EXACTLY what I needed!
I used:
var Slot =
Slot.append({ “Str”: 0, “Dex”: 0, “Int”: 0, “Wis”: 0, “Cha”: 0, “Con”: 0, “Slot”: 0 })
and ran a loop to fill up the slots I needed (8)
I needed to be able to fill and empty the values by variable and this worked!
I was able to get rid of almost a hundred lines of code using this! thanks!
Mystile1369 | 2019-01-29 14:27
Hi, sorry I know this is over 2 years old but is it possible to get more than one of the strings or values?
For example: print(x[0][comment2-"Str"]["Dex"][comment2-"Int"])
Is that something I can do? If so how do I do it (I’ve already tried how I’ve done it here and it hasn’t worked for me.
(By the way I am trying to add entries of game titles along with the amount of copies available, the games publisher etc. into an ItemList, if you have any tips on how I can do this that would be amazing).
Thanks in advance!
Lazulily | 2022-08-10 02:09