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!!
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.
This site is now closed.
As of 1st November 2015, this site is a read-only archive. For more information see the intfiction forum post

Welcome to IF Answers, a site for questions and answers about Interactive Fiction.

Technical questions about interactive fiction development tools such as Inform, Twine, Quest, QuestKit, Squiffy, Adrift, TADS etc. are all on-topic here.

Non-technical questions about interactive fiction are also on-topic. These questions could be about general IF design, specific games, entering the IF Comp etc.
...