Playmaker Forum

Playmaker Help & Tips => Playmaker Help => Topic started by: LogLady on November 23, 2015, 01:46:53 PM

Title: FSM variables [SOLVED]
Post by: LogLady on November 23, 2015, 01:46:53 PM
Hi!

Some questions that may be dumb:

- Is it possible to count the FSM variables and separate them by type (int, float, object...) ?

- Is it possible to iterate thru FSM variables?

- Is it possible to change the compared variable on Int compare?

E.g. I have 10 int variables on my FSM and I'd like to compare their values one by one and take actions based on it but I don't want to use 10 states to compare each variable. I thought about looping the states and change the variable compared on each loop but I have no idea how to do it or if it is even possible.

Any help is appreciated.   ;)

Thanks!
Title: Re: FSM variables
Post by: mdotstrange on November 23, 2015, 07:44:16 PM
For looping through the var and making decisions on each you could use an Arraymaker array-

You could have a state that adds all the current var to an array then sort them/compare them etc and make decisions based on the results-
Title: Re: FSM variables
Post by: djaydino on November 24, 2015, 01:41:29 AM
Hi,
you can also do it without array maker if you want.

i made a quick sample :

Title: Re: FSM variables
Post by: LogLady on November 24, 2015, 11:41:31 AM
@mdotstrange
I already tried with Arraymaker but for this case I think it is a overkill. Thanks for your help!  :)

@djaydino
I got close to what you've done but this "Get FSM int" from a string and how you used it is totally new to me. It was the missing link on my code. Thanks a lot!  8)
Title: Re: FSM variables
Post by: djaydino on November 24, 2015, 11:55:21 AM
Hi,
I am happy it worked for you :)

can you add [SOLVED] to the subject pls :)
Title: Re: FSM variables [SOLVED]
Post by: LogLady on November 24, 2015, 12:12:03 PM
Done!