Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: artician on August 10, 2012, 04:52:06 PM
-
More Array questions! (But only because they're supremely useful and have changed my life for the better!)
I have a string variable in my FSM.
The same string is contained somewhere in an ArrayList.
I want to find the index that contains the string, so I can store the index in it's own Int variable.
I thought to use Array List Index Of, however I don't know where I declare where to store the Index value once I get it.
How can I do this?
Thank you!
-
Hi,
indexOf has a property called "indexOf" this is where you should select the fsm int that you want to store the index of the item you'll find in that array.
if you are still strugglin, I'll do a working example.
bye,
Jean
-
This is the "Index Of" within the "setup" portion of the action, correct?
I wasn't certain that this was the correct field since it was in the setup area. Let me know if that's what you mean.
Thank you!
-
Hi,
yes, It could have been laid out better, I agree, but yes, that's the "index Of" field you need.
bye,
Jean
-
I'm so glad I found this! I was having the same problem. Okay, so "index of" is the integer variable to store the index value. If I set a GameObject in the data section, that's what it will look for in the array, and it will store the index of that object in the index of variable?
Thanks! I've been playing around with this for a couple of days, trying to get a basic card setup working, specifically so I could learn how it works.
-
Hi,
Yes, but very important, DO NOT FORGET to set the "Fsm variable Type" property to the one you expect, so if you want to check the index of a "string", you have to set "Fsm Variable type" to "Fsm String" AND fill the "Set String Data" property as well with the value you want to check it against.
bye,
Jean
-
More Array questions! (But only because they're supremely useful and have changed my life for the better!)
I have a string variable in my FSM.
The same string is contained somewhere in an ArrayList.
I want to find the index that contains the string, so I can store the index in it's own Int variable.
I thought to use Array List Index Of, however I don't know where I declare where to store the Index value once I get it.
How can I do this?
Thank you!
If your want to store string with index better use Hashtable
http://csharp.net-informations.com/collection/csharp-hashtable.htm
Hope it willhelp you.
Jov.
-
Hi,
ArrayMaker also supports Hash tables actually ( I know I should have come up with a better name...)
I think however that what Artician was after is indeed using an array of string and get the index of that string within the array. As opposed to use string based indexing to reference strings.
with array:
0-> "my string"
1-> "my second string"
2-> "my third string"
with Hashtable:
"whatever key" ->"my string"
"your own key" ->"my second string"
"one last key" ->"my third string"
bye,
Jean
-
Yeah Jean has it right. That's what I was after.
Jean - Have you ever gotten something working for saving an Array/HashTable? Just curious!
-
Hi,
not yet, you can really save my proxies conveniently currently. It's a common request that I ought to implement on the next version, that btw will be a lot easier to work with as the next version of playmaker will feature new action fields that will simply let you select first a fsm variable type and then select that variable, so the actions will be down to a more digestable size and a lot less scary and inefficient and prone to error and frustration.
bye,
Jean