I’m having trouble with my choicescript and I keep getting the non- existent variable error for “house”. Where it says “*if House Ruddhale” I keep getting the error, however, I feel as if I don’t need to create the create variable thing in the startup. Need Helpstrong text

My code looks like this:

*temp alliegance_name
*set alliegance_name "override_alliegance"
*if House Ruddhale
  *set alliegance_name "House Ruddhale"
*if override_alliegance = "None"
  *if alliegance = House Stone
    *set alliegance_name "House Stone"
    *goto name
  *elseif alliegance = House Mallor
    *set alliegance_name "House Mallor"
    *goto name
  *elseif alliegance = House Crowe
    *set alliegance_name "House Crowe"
    *goto name

It should be

*if (house = "name")
*if (allegiance = "thing")

The creates at the startup look like this:

*create house ""
*create allegiance ""


1 Like

Can I ask, what do you want to achieve with this code?

I mean, what do you want to do?

Because the code *if House Ruddhale itself is too ambiguous. What kind of situation you want the code to check?

I want to make it so that if your alliegance, a variable in my game, is with House Ruddhale that’s what will be displayed in the stat chart, or if it is with another House such as House Crowe it will display that as your allegiance in the stat chart.

I’ll see if it works thanks for helping

MeltingPenguins is correct. Your problem is that you have two values with no comparator. The expression that follows *if has to be something that evaluates to either true or false. That means a variable, a comparator, and an immediate value that the variable is being compared to. The value, if it’s pure text, has to be surrounded by quote marks - otherwise the code parser has no way to tell that it’s not a variable itself.

That’s where the ‘non-existant variable’ error comes from.

When you’re thinking ‘I need to check whether the MC belongs to House Blar’, translate that thought into ‘I need to check if the variable house has a value that’s equal to Blar’.

At the start of startup.file use:

*create alliance ""

Somewhere in story text use:

Who will you ally with?

  #House Ruddhale
    *set alliance "Ruddhale"
  #House Crowe
    *set alliance "Crowe"

In stats screen use:

Your ally: House ${alliance}

If player chose House Crowe in the story, this should read as:
Your ally: House Crowe

If your player is not allied with anyone, it will say:
Your ally: House

You can use this code in stats screen to avoid the last mentioned scenario:

*if (alliance = "Crowe")
    Your ally: House Crowe
*if (alliance = "Ruddhale")
    Your ally: House Ruddhale

YOU ARE A LIFESAVER this way was the best for my current “skill level” aka it was super easy and although it took 3 hours Its finnaly over and thanks to everyone that helped out.

1 Like