Boolean Operation Error

Just ran into an issue as I checked my game for errors. This popped up:

Expected no more tokens, found: Boolean_Operator (or).

If it will help I’ll post the problem segment if someone reminds me how to do it.

Use < pre> before and < /pre> after. No spaces.


			*if (Stature = "Strong") or (Stature = "Medium")
				#your fellow hunters honoured you for your strength, endurance, and willpower. You joined up the group that would land the killing blow.
					*set Strength %+5
					*set Endurance %+5
					*set Willpower %+5
					*set Swordsmanship %+10
					*set Shield %+10
					*set Background "Hunter"
					*goto Hunter
			*if (Stature = "Small") or (Stature = "Medium")
				#your fellow hunters honoured you for your speed, agility, and craftiness. You joined the group quick and subtle enough to keep the beast occupied while others went in for the killing blow.
					*set Speed %+5
					*set Agility %+5
					*set Subtlety %+5
					*set Archery %+10
					*set Spearmanship %+10
					*set Background "Hunter"
					*goto Hunter
			*if (Stature = "Small") or (Stature = "Medium") or (Stature = "Strong")
				#as the Shaman's apprentice you belonged next to him, no matter the danger. Besides, they might have needed your healing magic on such a dangerous journey.
					*set Willpower %+5
					*set Subtlety %+5
					*set Intuition %+5
					*set Healing %+10
					*set Background "Shaman Apprentice"
					*goto Shaman		

I think you may be missing brackets. I’m not sure. Try adding in some more so

*if ((Stature = “Small”) or (Stature = “Medium”) or (Stature = “Strong”))

I may be wrong though.

That worked, thanks.

As a general rule, each pair of conditions should be grouped with extra brackets, e.g.

*if ((Stature = "Small") or (Stature = "Medium")) or (Stature = "Strong")


*if ((Stature = "Small") or (Stature = "Medium")) or ((Stature = "Strong") or (Stature = "Mighty"))


Doesn’t each pair of brackets need to be different? like
(((1) Or ((2) or (3)


When just checking multiple conditions individually (i.e. where only one of the stated conditions needs to be true), the “group each pair of conditions within extra brackets” is all you’ll ever need to abide by.

It does get slightly more complicated when using both “and” & “or” within the same statement, i.e. when you need more than one of the conditions to be true or *else. For instance, changing that second example above slightly, note the different bracket placements to group conditions properly:

*if (((Stature = "Small") or (Stature = "Medium")) and (Hair = "Brown")) or (Stature = "Strong")

This might also (if there are only three types of Stature) be written as:

*if ((Stature != "Strong") and (Hair = "Brown")) or (Stature = "Strong")

…which is saying essentially the same thing but in a slightly different way. Both are equally valid and would have the same end result.

In short, conditions should always be grouped in pairs using extra brackets, except where a condition is true only if multiple conditions (in this case both Stature and Hair) are met, or an exception to the main condition (Strong stature in this case, which totally disregards Hair) is true.

As a general rule, the simpler the better. :wink: