BUTTON STRIP : how to query their values in hscript?

   1237   3   1
User Avatar
Member
47 posts
Joined: April 2020
Offline
if you query the button's values, it appears to only return a single int, and that int is the added results of all the pressed buttons.

for example:
none pressed = 0
button1 = 1
button2 = 2
button3 = 4
button4 = 8
button1 + button4 = 9
button2 + button3 + button4 = 14

i can't imagine putting in a gazillion if statements for all the possible numbers that could indicate if button2 was currently pressed, so i wonder if i'm missing something about this.

the query is this:
ch("../null1/Masks")

i've tried other ways of querying the value in an array or dict manner but all failed...

but no way can a multiple choice button be this difficult to use....!?

thanks in advance!
-seneca
User Avatar
Member
8551 posts
Joined: July 2007
Online
multichoice buttonstrips or iconstrips are represented as bitfield
use bittest() to check which bit is on
it will return 1 if the bit in question is on and 0 if off (meaning if the button is on or off)

to check if first button (0) is on do:
bittest(ch("../null1/Masks"), 0)
second button (1):
bittest(ch("../null1/Masks"), 1)
third button (2):
bittest(ch("../null1/Masks"), 2)
fourth button (3):
bittest(ch("../null1/Masks"), 3)
fifth button (4):
bittest(ch("../null1/Masks"), 4)
...
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
47 posts
Joined: April 2020
Offline
thank you so much! i knew there had to be a sane way to query their values. i wish this stuff was easier to find in the docs.
User Avatar
Member
47 posts
Joined: April 2020
Offline
hmm. how would you use this in a gui's HIDE WHEN field ?

this doesn't appear to work :

{ bittest(cow,0) == 1 }
  • Quick Links