*if - or condition Confusion HELP

I’m currently learning how to use CS with the CScript Writers Tool and I’m stuck with something.

I’m doing small exersies at the moment to get the hang of it.

I have these 3 choices, 2of them are *if…or - conditions to have that choice available.

Here’s the problem: Even when for both choices one of the conditions (“class” or “race”) are met, it only shows the option of which class has been met, not the one which race has been met as well. When it’s just the race set to dwarf condition that would be applicable the choice belonging to it also doesn’t show up at all as well.

The error I’m getting is:…

My code looks like this:

    *if (class = "thief") or ("race" = "elf")
        #I hold out my hand. I am comfortable that I know what I'm doing.
            I jerk my hand back in time, when I see the dog is about to snap at my hand.
    *if (class = "warrior") or ("race" = "dwarf")
        #I raise my voice and while I stare down the dog "Sit!"
            The dog does, in fact, not sit. Instead it growls even more agitated then before.
    #I'm not going to deal with that.
        I slowly backtrack out of the alley while keeping eye contact with the dog.

Can someone figure out how I would get both options to be displayed when it should / where the error wiith the dwarf lies??

Remove the quotation mark around the race variable in the comparison, since you need to compare the variable to a string value, not a string to a string (ie. string “race” will never equal string “dwarf” or anything that’s not also “race”).

*if (class = "thief") or (race = "elf")
*if (class = "warrior") or (race = "dwarf")

Do I remove the quotations on both (“elf” and “dwarf”)?

I tried deleting the quotations for the dwarf but then I get the Non-existent variable ‘dwarf’ error.

I’m not quiet sure I understand your explanation I’m so sorry I just started a few days ago

I’m showing you the modified code based on your pasted code:

*if (class = "thief") or (race = "elf")
*if (class = "warrior") or (race = "dwarf")

You did it right for the class variable name, but added quotation marks to race variable name. So just remove the quotation mark from race variable name part of your code, and see if that works for you.


This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.