playMaker

Author Topic: [solved] Int to Bool? Is this possible? (Or Get/Set Bool in PlayerPrefs?)  (Read 3287 times)

createasaurus

  • Full Member
  • ***
  • Posts: 146
I have Ints that are either 0 or 1 that I'd like to convert to Bools.  Is this possible?  Is there a custom action already made for this?

The reason I am doing this is I have Global Bools that I want to save to Player Prefs.  However, there is no Playmaker action to save Bools to Player Prefs that I know of.  So, I'm manually converting all the Bools to Ints then saving to Player Prefs.  Now, for loading, I'm taking these new Player Prefs Ints, and I need to assign them back to Bools.  I guess I could write a long thing out using Int Switch for each one...  I just was wondering if there was a more elegant way.  Thanks!
« Last Edit: October 17, 2015, 02:11:24 PM by createasaurus »

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Int to Bool? Is this possible?
« Reply #1 on: October 16, 2015, 07:34:36 PM »
There is a Playerprefs Get/Set Bool in the ecosystem that does this

createasaurus

  • Full Member
  • ***
  • Posts: 146
Re: Int to Bool? Is this possible? (Or Get/Set Bool in PlayerPrefs?)
« Reply #2 on: October 17, 2015, 02:32:50 AM »
Quote
There is a Playerprefs Get/Set Bool in the ecosystem that does this
I know this sounds crazy, but I can't find it.

Please see my attached image of what my Playerprefs menu looks like... no Get/Set Bool.  I wonder why I do not have this option?  Please, where do I find or get this?  If I could simply do Get/Set Bool in Playerprefs, it would solve my whole problem.

In the meantime, I'm starting to write a manual workaround using states to change all Bools to Ints, one by one, then Save, then the reverse for Load. (It is cumbersome, and I worry I can introduce error by writing all this out and overlooking something, but I need to do this somehow.)  Furthermore, changing each Int back into a Bool is requiring me to write an Int Switch sending to either a Set to 0 or Set to 1 state... this was the reason for my original post, a request for an Int to Bool action.

Thank you for your thoughts!!
« Last Edit: October 17, 2015, 02:52:44 AM by createasaurus »

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Int to Bool? Is this possible? (Or Get/Set Bool in PlayerPrefs?)
« Reply #3 on: October 17, 2015, 04:13:38 AM »
Hi,

You are not using ecosystem. Get the ecosystem pckage from here / wiki and install package into your game. Ecosystem is now in the add-on section in the playmaker menu. You are not looking in the right place.

Also you can use playerprefsx

createasaurus

  • Full Member
  • ***
  • Posts: 146
Re: Int to Bool? Is this possible? (Or Get/Set Bool in PlayerPrefs?)
« Reply #4 on: October 17, 2015, 02:11:06 PM »
@terri & dudebxl
Ah ha!  Now I understand. This is the first I have heard of ecosystem.  Fantastic!!  Thank you.