playMaker

Author Topic: FSM variables [SOLVED]  (Read 635 times)

LogLady

  • Full Member
  • ***
  • Posts: 125
    • View Profile
FSM variables [SOLVED]
« 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!
« Last Edit: November 24, 2015, 12:11:19 PM by LogLady »

mdotstrange

  • Hero Member
  • *****
  • Posts: 549
    • View Profile
    • Can't code? Who cares! Make games anyway!
Re: FSM variables
« Reply #1 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-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2305
    • View Profile
    • jinxtergames
Re: FSM variables
« Reply #2 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 :


LogLady

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: FSM variables
« Reply #3 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)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2305
    • View Profile
    • jinxtergames
Re: FSM variables
« Reply #4 on: November 24, 2015, 11:55:21 AM »
Hi,
I am happy it worked for you :)

can you add [SOLVED] to the subject pls :)

LogLady

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: FSM variables [SOLVED]
« Reply #5 on: November 24, 2015, 12:12:03 PM »
Done!