Login
Remember
IF Answers
Ask a Question

# Squiffy: How to force two variables to equal based off another variable?

–1 vote
323 views
asked May 7 in Authoring by Natas (17 points)

This question is a bit hard to ask so it is best if I show it instead:

    @set car =
    @set color1 =
    @set color2 =
    @set colorAll =

        if(get("car") =truck){
            set(get("color1"), get("colorAll"));
            set(get("color2"), get("colorAll"));
            }else{
                }

    This is a test to make two variables the same based off of one using javascript!
    Select a vehicle:{rotate car:truck:car:bus}

    [Continue](step1)

    {if car=bus: Select a color {rotate colorAll:red:yellow:orange}

    [Continue](test)
    }{else: Select two colors please:

    Color 1: {rotate color1:red:yellow:orange}

    Color 2: {rotate color1:red:yellow:orange}

    [Continue](test)
    }

    [Javascript Test](test)

    [test]:

    You have  a {color1} car! It even has {color2} tinted windows!!

- squiffy

commented May 9 by Alex (486 points)
I don't understand what you're asking at all.
commented May 10 by Natas (17 points)
How do I make variable color1 and variable color2 equal variable colorAll when the situation calls for it?

## 1 Answer

+1 vote
answered May 10 by Alex (486 points)
selected May 10 by Natas
Best answer

You have an error in your "set" statement. It should be:

    set("color1", get("colorAll"));
    set("color2", get("colorAll"));

commented May 10 by Natas (17 points)
:< My code still doesnt work... The code in facts seems to break Squiffy: (Sorry there is no code brackets in comments)
if(get("selfRace") ="Slime"){
set("selfEyeColor", get("selfGGSColor"));
set("selfSkinTone", get("selfGGSColor"));
set("selfHairColor", get("selfGGSColor"));
}else if(get("selfRace") ="Goo"){
set("selfEyeColor", get("selfGGSColor"));
set("selfSkinTone", get("selfGGSColor"));
set("selfHairColor", get("selfGGSColor"));
}else if(get("selfRace") ="Gel"){
set("selfEyeColor", get("selfGGSColor"));
set("selfSkinTone", get("selfGGSColor"));
set("selfHairColor", get("selfGGSColor"));
}else{
}
commented May 10 by Alex (486 points)
You need "==" not "=" in your first line.
Otherwise, look in your browser console for errors.

## Related questions

- How to compare two variables in Squiffy?
- Squiffy: How to fix if else error?
- How to deal with large numbers in Squiffy?
- How to add a random number generator in Squiffy?
- Squiffy: Extracting Data From Objects Variables.

...