# More efficient way to go about having to constantly check 64 different switches?

#### CalebHatesYou

##### Villager
ok so i'm at the point in my game where I want to allow the player to customize the hairstyles and clothing of each party members. Each party member will have 8 different hairstyles and 8 different outfits, meaning I will be making 64 portraits for each party member (8 hairstyles X 8 outfits = 64 combinations). This now means that during cutscenes when adding dialogue and character portraits next to said dialogue, I will have to have a long list of "If switch H1 C1 is on, then ___ Otherwise if Switch H1 C2 is on ___ Otherwise..." and so on. in order to have the correct portrait show up next to the characters dialogue.

#### Cormorant42

##### Veteran
Lol, sorry, I didn't even see! I'm 75% sure there must be some equivalent for VX Ace

#### gstv87

##### Veteran
make each switch a bit in a binary number and apply an AND logic.

take the lot of switches: 0010101001101010 = 10858
if you want to check switch 6: 0000000000100000 => 32
if 10858 AND 32 == 1, switch 6 is ON.

for all switches, take X AND 2^64 == 1.

#### Andar

##### Veteran
there are several scripts that add messaging options to the engine, including to use faces based on actors instead of fixed faces. In this case the ATS series from modern algebra is probably better than the more commonly used yanfly message system, as it contains more options for the use of faces.

#### CalebHatesYou

##### Villager
make each switch a bit in a binary number and apply an AND logic.

take the lot of switches: 0010101001101010 = 10858
if you want to check switch 6: 0000000000100000 => 32
if 10858 AND 32 == 1, switch 6 is ON.

for all switches, take X AND 2^64 == 1.
I appreciate the information but I honestly have no idea what any of this even means. I am not well versed in rpg maker scripting.

#### gstv87

##### Veteran
I appreciate the information but I honestly have no idea what any of this even means. I am not well versed in rpg maker scripting.
it'll probably require a plugin, but that's how to handle a lot of binary values at once: each switch is binary, it can only be on or off.
if you take the whole set of 64 switches as a binary number, each bit has a numeric value when converted to decimal.
and, by comparing decimal and reverting back to binary you can isolate one or many bits, which in turn give you the switches.

#### CraneSoft

##### Filthy Degenerate
Have one common event for each party member that does the conditional check, then just call the equivalent common event every time before a dialogue is the easiest way. Also for this situation it would be better to just use variables instead of switches so you only need 16 variables instead of 64.

#### CalebHatesYou

##### Villager
there are several scripts that add messaging options to the engine, including to use faces based on actors instead of fixed faces. In this case the ATS series from modern algebra is probably better than the more commonly used yanfly message system, as it contains more options for the use of faces.
Just got the face script now and it seems like it will be very helpful to my situation. I just have a question that maybe you can help me with.

Is there a way to pick the index number on an actor's current faceset in this command
"\af[n] - set face to the face of the actor with ID n in the database."

Like you can in this command?
"\f{"filename":n} - set face to the one in "filename" at index n."

If there is a way to do this then my problems will be solved

#### Andar

##### Veteran
sorry - I never used ATS myself, I just once made a point to check every script on the master script list to learn what it can do.

However, are you telling me that you not only have composite faces but also different expressions that you need to switch of an index that way? Bevcause if you have only one face per actor after all the switches, you won't need the face index at all.
If you have different expressions and need to select them, then I would suggest using string operations to handle filenames in the second option.

If neither fits, you need to post examples of what exactly you do with your faces.

### Latest Profile Posts

Stream will be live shortly with some pixel art! Feel free to drop by!

Can't believe I forgot to put an image of my drawing pad! It looks kinda like this, maybe I'll get a better pic tomorrow...
Backup tip: If you don't want to back up your whole project every day, at least back up everything *except* your Image and Audio folders, which you can do weekly/as needed/etc.
The final version of our game is already available both in English and Spanish! ^___^
Can't believe this day has finally come... T_T
Im so happy that Dead By Daylight is getting a Silent Hill chapter! Cant wait to play as pyramid head