I'm not sure about this error

I think it has to do with a few different *if options for race. Maybe I just need to adjust the code a bit, but I’m not entirely sure what this means. Anyone understand it and what I should do here?

Are you deliberately using ${Race} instead of race?

1 Like

FYI, variable name cannot contain uppercase letter
As well as when you try to “call” them

I thought that was the proper format. You pick your race at the beginning, so then when you get to this scene, there are slight extra bits depending on which you chose.

@Szaal Your variables can contain uppercase letters. It’s just best not to.

@Badchoice

Use

*if race = “blah”

1 Like

OK that seems to have done it. Thank you.

1 Like

Oddly, now it runs smoothly except that it completely ignores the extra text that depends on race, like it can’t read that part (?)

What’s your code for setting the races?

So far you choose and then I just use *set race “blah”

Oh, rly?
*CS coding exploitation intensifies :smiling_imp:

@Badchoice: It’ll be better if you post the code as well. Hard to determine the 'cause of error without the exact picture of th code

Without seeing the actual code, it’s difficult to find the actual cause of the error. There are several different things that could be happening, depending on how the code is written.

For example, if the *choice (or *fake_choice) you’re using to *set the variable has a *goto command attached, and the *goto is ahead of the *set, ChoiceScript will reach the *goto and then jump to the referenced *label, completely ignoring the *set. So if you have a piece of code like…

*choice
  #I am race "blah."
    *goto next
    *set race "blah"
*label next

…then the variable will never get *set in the first place. It will go straight from *goto to *label, skipping everything in between. And without a *set variable, the *if statements won’t be able to detect the player’s decision, and won’t display. However, if the *goto and the *set from that example were swapped, it would correctly *set the variable. Like so:

*choice
  #I am race "blah."
    *set race "blah"
    *goto next
*label next

Unfortunately, that’s not the only possible cause of your error.

Another possible problem is a change in the capitalization of the variable’s contents. Not race, the name of the variable itself, but "blah", the string of letters it contains. If you accidentally *set race "blah" but then checked for *if race "Blah", your check will never produce a result. As far as ChoiceScript is concerned, "blah" and "Blah" are completely different things.

There may be even more potential causes I’m overlooking! It’s late enough (local time,) and I’m tired enough that I’m not thinking quite as clearly as is entirely useful. With so many different ways the code could produce the same result, it becomes extremely difficult for us to guess the right solution.

If you can post the code that *sets the variables, or a screenshot of it, we should be able to help much more effectively.

Edit: Previously, I commented that *set race and *set Race would be counted as two different variables. Upon testing with my own ChoiceScript installation (which is probably out of date,) I determined my earlier statement was either entirely untrue or inconsistently true. In my short testing, CS treated both race and Race as a single variable. However, since I haven’t done anywhere near enough testing to determine how reliable and consistent that is, I’m going to fall back on the old advice of “Don’t use capital letters in the variable’s name, only in its contents.”

1 Like

OK, here’s all the related code. Hopefully that will help. I can’t seem to
send WIP’s, but I copied the relevant parts from the text files into a new
one so you can look at it.

If you attached a file it won’t show up on the forum. If you included a link there it didn’t show up.

Hmm… ok, here’s an abridged version of the text file.

Note: from Startup.txt
Welcome to the land of Esparia, in the nation of Efrya. You were born

*choice
#An agile Sacambion, close to the magic of the world

    *set Race  "Sacambion"

#A giant Akhi, strong and tough

    *set Race "Akhi"
    

#A charming and stealthy Nirqo

    *set Race  "Nirqo"
  

#A well-rounded, resourceful human

    *set Race  "Human"
    
	
	Note: From Scene1.txt
	
	*label The_situation

You are called from your ordinary activities into the presence of Her Majesty. This is not your first visit to the castle, but this one feels different. There is a somber mood throughout, and a sense of some important event about to take place.

*if Race = “sacambion”
You sense a stirring of deep magic in the atmosphere, as though an ancient spell were humming in the very walls.

*if Race = “akhi”
You can’t help but notice that while you are physically stronger than many you pass, they are better armed. Some cast nervous glances and seem relieved when you leave them behind.

*if Race = “nirqo”
Though you are a trusted member of the Order, many eye you suspiciously out of the corner of their eyes. You know you could win them over if you tried, but they hardly seem worth the effort.

Where are your gotos? Are they in the right location?

Can you type in a {Race}, or a "your race is {Race} after those choices, to check and make sure that race is actually getting set.

If your Race is getting set, and this happens before your if checks, then the problem is likely with the indentation of your ifs.

Umm… Maybe you would like to include the whole texts into the Preformatted Block (CTRL + SHIFT + C)

That won’t work. Capitalization matters in text strings. So as values for the Race variable, “Sacambion” and “sacambion” are not the same thing.You need to standardize and always use one or the other. Well you could check for both, but that’s kind of silly unless you’re letting the reader type the name in for some reason and want to cover both possibilities.

2 Likes

I’ll make sure the capitalization is consistent. I hope that’s all it needs.