Playmaker Forum

Playmaker Feedback => Action Requests => Topic started by: craigz on February 12, 2018, 08:10:19 AM

Title: Set Enum value via string/index?[SOLVED]
Post by: craigz on February 12, 2018, 08:10:19 AM
Wasn't sure if there currently was a way to do this or not...

I'm looking for a way to save current enum values, and best I can find to do is save the index/int for the enum. But then I realized there's no way to actually SET an enum by any value other than an enum.

Could have an int-switch tied to set-enum but that seems like a bit of a workaround. *shrugs* just wasn't sure if there was a better way?

best,

craigz
Title: Re: Set Enum value via string/index?
Post by: jeanfabre on February 19, 2018, 11:46:19 PM
Hi,

 Good point. Made an action for this on the Ecosystem. Search for "ConvertIntToEnum"

(https://i.imgur.com/dSQIGt2.png)

 bye,

 Jean
Title: Re: Set Enum value via string/index?
Post by: jeanfabre on February 19, 2018, 11:53:58 PM
Hi,

 and the second one: ConvertStringToEnum

(https://i.imgur.com/G35sI3R.png)

 Bye,

 Jean
Title: Re: Set Enum value via string/index?
Post by: craigz on February 21, 2018, 04:39:55 PM
BOOM!

As usual Jean, thank you!

You rock :D

-craigz
Title: Re: Set Enum value via string/index?[SOLVED]
Post by: craigz on February 27, 2018, 11:15:19 PM
So a follow up question, that I feel you might have answered else, couldnt remember if it was a Unity limitation or not.

But would some sort of a 'FSM Enum Switch' or 'FSM Enum Test' action be possible? (similar to how the FSM Bool Test action tests the bool on another without having to have a local data variable made on the object thats doing the testing)

I find myself needing to test if the enum on other game objects is a certain one. And things have been getting cluttered from making duplicate variables on the manager type gameobject just for the purpose of doing 'Get FSM Enum' then followed by 'Enum Switch' etc :)

-craigz
Title: Re: Set Enum value via string/index?[SOLVED]
Post by: jeanfabre on March 01, 2018, 01:55:09 AM
Hi,

 yes, I'll see if I can work on this action, it should feasible. Can you bump me mis next week if I haven't delivered?

 Bye,

 Jean
Title: Re: Set Enum value via string/index?[SOLVED]
Post by: craigz on March 01, 2018, 08:17:41 AM
Excellent! :D Thanks Jean! Will do :)

-craigz
Title: Re: Set Enum value via string/index?[SOLVED]
Post by: craigz on March 06, 2018, 05:18:52 PM
Just an almost mid-week bump ;D
Title: Re: Set Enum value via string/index?[SOLVED]
Post by: jeanfabre on March 07, 2018, 02:33:41 AM
thanks :)

on it!

Bye,

 Jean
Title: Re: Set Enum value via string/index?[SOLVED]
Post by: jeanfabre on March 07, 2018, 02:48:55 AM
Hi,

 ok, done, it's called 'FsmEnumSwitch'

the only bad thing is that you have to manually define the enum type for all your case as there is no mechanism built action to match the type this way.

 Let me know how it works for you.

 Bye,

 Jean
Title: Re: Set Enum value via string/index?[SOLVED]
Post by: craigz on March 07, 2018, 08:34:44 PM
You rock Jean! :D

This is working perfect! No worries about having to manual set them, still saves a ton of time :D

Thanks for cranking this out, it means a lot to me! :)

-craigz