Home 4 › Forums › iOS / tvOS Starter Kits › The Story Tellers Kit 2 for iOS or tvOS Apps › Using SetValues for Boolean does not work (?)
This topic contains 8 replies, has 2 voices, and was last updated by Martin Ortiz 9 months, 2 weeks 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] ListenerEnabledIf I do this
Enabled [STRING] YES
or
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)
<key>SetValues</key>
<dict>
<key>ListenerEnabled</key>
<string>YES</string>
</dict>
<key>SetValuesIfNil</key>
<dict>
<key>ListenerEnabled</key>
<string>YES</string>
</dict> -
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 #NSo 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: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.