I would like to test a string against the condition, but is seems this is not allowed in harlowe. Or maybe I am doing something wrong.
It works the other way around but negative OR does not work If someone could explain how it works that would be great. I can eventually make just simple If condition.
(if: ($duvod1 is not "dosažení vynikajících studijních výsledků v průběhu mého studia") or ($duvod1 is not "vynikajících studijních výsledků v průběhu mého studia"))
The full condition is like this: if: ($duvod1 is not "dosažení vynikajících studijních výsledků v průběhu mého studia") or ($duvod1 is not "vynikajících studijních výsledků v průběhu mého studia"))[ - [|spatne>[Toto není správné vyjádření!]] (text-style: "italic")["z důvodu" je ustálené předložkové spojení vyžadující 2. pád, proto i následující fráze musí být v 2.p. (slovesné podstatné jméno a přívlastek neshodný)](set: _d1 to false)] (else:)[|spravne>[ Správně!](set: _d1 to true)]
What is the logic you are trying to test here, because I don’t see an issue with the code as is.
As you’ve coded it, the engine will check the code in the following manner:
- is the value of $duvod1 the same as "dosažení ...."?
- no? -> display first text block
- yes -> is the value of $duvod1 the same as "vynikajících ..."?
- no? -> display first text block
- yes -> display second text block
Do you want $duvod1 to not have either value to display the first block of text? then you need to use AND instead of OR.
When looking at output of conditionals, especially when using AND and OR, this table is pretty handy.
Let me fill you in the whole scope.
In first passage I have a questions with text fields. Students are suppose to fill in the correct text into the text fields. Type them in. Some of the inputs can be correct with different syntax. I want to account for these cases. In the “results passage” I show the students the results(test variables). So In case the inputted text is A or B the “Correct” text block will show. In any other case (any different text) the text block “Incorrect” will be shown.
I can see from your analysis that it may require a nested IF, but it seems it will be better to actually reverse the condition to “is” and then nest it in.
- is the value of $duvod1 the same as "dosažení ...."?
- yes -> display second text block
- no? -> display first text block
- is the value of $duvod1 the same as "vynikajících ..."?
- yes -> display second text block
- no? -> display first text block
edit:
This code is doing what I intended.
(print:'$duvod1')(if: $duvod1 is "dosažení vynikajících studijních výsledků v průběhu mého studia")[ - |spravne>[ Správně!](set: _d1 to true)] (else-if: $duvod1 is "vynikajících studijních výsledků v průběhu mého studia")[ - [|spravne>[ Správně!](set: _d1 to true)]] (else:)[ - [|spatne>[Toto není správné vyjádření!]] (text-style: "italic")["z důvodu" je ustálené předložkové spojení vyžadující 2. pád, proto i následující fráze musí být v 2.p. (slovesné podstatné jméno a přívlastek neshodný)](set: _d1 to false)]