The O.G. Virtual learning! Buy one, get 2 more Lifetime Memberships! - Click Here!

Using SetValues for Boolean does not work (?)

Home 4 Forums iOS / tvOS Starter Kits The Story Tellers Kit 2 for iOS or tvOS Apps Using SetValues for Boolean does not work (?)

Tagged: ,

This topic contains 8 replies, has 2 voices, and was last updated by  Martin Ortiz 3 years, 4 months ago.

  • May 7, 2018 at 9:44 am #183667

    I want to turn Listerners on and off as needed….
    So I went into Events/SetValues section of main page and created the “variable”.
    To double check, I tried with a string variable, and did a “OutputValue” to see what it was
    For true/false the string value would be yes/no
    I switch it to Boolean, and for true/false it would be 1/0.

    But when I did this for listner, it would not work (it seems to default to disabled)
    Enabled [STRING] ListenerEnabled

    If I do this
    Enabled [STRING] YES
    Enabled [STRING] NO
    It works as expected, but if I use ListenerEnabled “variable”, it does not work properly
    (I tested with ListenerEnabled defined as a string and also defined as a boolean.

    (raw text of plist section below)

  • May 7, 2018 at 1:30 pm #183672

    When setting values they always get saved as Key (String) Value (String), so yeah, just keep them as String. It will do the conversion in the code if needed (like for numbers).

  • May 7, 2018 at 1:32 pm #183673

    Wait, wait. Scratch that. I’m looking at your Plist data. What you’re trying to do isn’t even an option. Hold on…

  • May 7, 2018 at 1:46 pm #183675

    Okay, what you’re doing does work, but I’m not sure if its doing what ya think =)

    So yeah, you can use a SetValues dict and create a variable named ListenerEnabled set to YES (as a String).

    What confused me is that looked similar to the actual Enabled property you can use in an EventListener. So I thought you were trying to start or stop a Listener using SetValues.

    And by the way, you do have Event properties StartListener and StopListener where the value would be the listener name.

    If it helps, describe what you’re doing and I can suggest the setup.

  • May 7, 2018 at 2:00 pm #183676

    Yes, I am wondering if I set it up right….

    For my puzzle, I AnimateNodeToSlot, to gather puzzle pieces together closer to the actual puzzle. (that is, puzzle pieces far away are too annoying to drag, when just one click will bring them all in, closer to puzzle.)

    But guess what? 🙂

    If a puzzle is animated/dragged to slot, if it happens to “fly over” the spot in puzzle it belongs, it gets captured! Like it was placed there by user.

    Thus, during this process, I would need to turn off the puzzle listeners, do the AnimateNodeToSlot, then turn on the puzzle listners again.
    (more in next post)

  • May 7, 2018 at 2:19 pm #183677

    I create “variable”

    I want to use it to turn on/off puzzle listener as needed

    #1 in image does not work

    #2 works for YES or NO, but of course, now it’s “hard-coded”

  • May 7, 2018 at 2:22 pm #183681

    Puzzle_001 is puzzle piece #1
    Puzzle_002 is puzzle piece #2
    etc…up to
    Puzzle_00N is puzzle piece #N

    So right now, I have it set up per puzzle piece, is there a more efficient way to do it en-mass? (that is, turn listeners on/off en-mass)

  • May 7, 2018 at 3:08 pm #183683

    Well I see the reason why now. But are you setting up a listener for each piece? Here’s the setup from the demo…

    Puzzle example

    One listener handles all the puzzle pieces

    • May 7, 2018 at 3:42 pm #183684

      The reason why I switched to individual, is that I also set a property on a node that is placed into puzzle to false. (custom property)

      I do this so that these nodes can get skipped, I had to add a line of code into page where the AnimateNodeToSlot is done, to skip “invalid” puzzle piece sprites.
      (that is, puzzle pieces that are done)

You must be logged in to reply to this topic.

Know what an affiliate program is? You make money just by sharing links to our site! Win. Win.

Earn when you refer any buyer here! 30 day tracking. Commissions are 33%-50% and recur on subscription products!

Uh oh, missing your affiliate ID. Create one real quick