Non-threaded

Forums » Bugs & Problems » Read Thread

Post reports about problems or bugs in here.
This bug was closed 1/10/2024: yeah you just gotta use nested logic. no way to really fix this in the current editor.

AND, OR in scripts don't work with >, <

9 years ago

An example:

%A := 1
%B := 1
IF %A > 0 THEN $PAGETEXT := $PAGETEXT + "A > 0 <br>"
IF %A = 1 AND %B = 1 THEN $PAGETEXT := $PAGETEXT + "A = 1 AND B = 1 <br>"
IF %A = 1 OR  %B = 1 THEN $PAGETEXT := $PAGETEXT + "A = 1 OR  B = 1 <br>"
IF %A > 0 AND %B = 1 THEN $PAGETEXT := $PAGETEXT + "A > 0 AND B = 1 <br>"
IF %A > 0 OR  %B = 1 THEN $PAGETEXT := $PAGETEXT + "A > 0 OR  B = 1 <br>"

The output is:

A > 0
A = 1 AND B = 1
A = 1 OR  B = 1

The conditions containing both AND,OR and >,< are not executed.

AND, OR in scripts don't work with >, <

9 years ago
I haven't tried working with AND or OR, but I also can't find any references to them being included in the scripting language. Perhaps the solution is to use nested IF statements.

AND, OR in scripts don't work with >, <

9 years ago

Operator AND is mentioned in examples here: http://chooseyourstory.com/help/articles/article.aspx?ArticleId=46 and here: http://chooseyourstory.com/help/articles/article.aspx?ArticleId=48

Indeed, the workaround is to use nested conditions, but it's not a pretty solution.

A bug is a bug and needs to be fixed.

AND, OR in scripts don't work with >, <

9 years ago

@ Kiel_Farren

@BerkaZerka

@killa_robot

Any advice?

AND, OR in scripts don't work with >, <

9 years ago
Seems to be an error. Like others said, you can get around it, it' just not pretty.

AND:
IF %A > 0 THEN
IF %B = 1 THEN
$PAGETEXT := $PAGETEXT + "A > 0 AND B = 1"

OR:
%DONE := 0

IF %A > 0 THEN
BEGIN
$PAGETEXT := $PAGETEXT + "A > 0 OR B = 1"
%DONE := 1
END

IF %B = 1 THEN
IF %DONE != 1 THEN
$PAGETEXT := $PAGETEXT + "A > 0 OR B = 1"


Sadly the done variable is needed so it doesn't execute twice.

AND, OR in scripts don't work with >, <

9 years ago

Sorry, missed this tag, but Killa's right. You just have to re-word it and not use them because AND / OR are just too buggy and unreliable. It really could use some fixing, though. Hopefully Alex will look into this.
 

AND, OR in scripts don't work with >, <

9 years ago

Thank you all for the replies and suggestions!

I know how to make a workaround for this bug with extra code.

The purpose of this thread is to let developers notice this bug and fix it.

AND, OR in scripts don't work with >, <

9 years ago

"developers"

It's the developer, and it might get fixed when he wants to come around and fix some things.

AND, OR in scripts don't work with >, <

4 years ago
I know this is 4 years old, but I'm having the same problem. I know @JJJ-thebanisher recently did some updates but thought I'd just bump this in case it's possible to fix. I did fix it using IF statements, but wanted to give you a heads up anyways since this report was so old. For me it was failing to work with the following link script: IF %VARIABLE > 2 AND < 7 THEN

AND, OR in scripts don't work with >, <

4 years ago
Proper syntax would be -

IF %VARIABLE > 2 AND %VARIABLE < 7 THEN

It may still be broken, but try that to see for sure.

AND, OR in scripts don't work with >, <

4 years ago
That did validate! Thank you so much. I was going off the way it was written in the random encounter scripting article.