Page 1 of 1

Any idea why this does not work?

Posted: Wed Jun 04, 2003 11:48 am
by LCD
This works:

Code: Select all

    scr(a1,y1+b)=0
  If col=0 And c0=1:scr(a1,y1+b)=1:EndIf
  If col=1 And c1=1:scr(a1,y1+b)=1:EndIf
  If col=2 And c2=1:scr(a1,y1+b)=1:EndIf
  If col=3 And c3=1:scr(a1,y1+b)=1:EndIf
  If col=4 And c4=1:scr(a1,y1+b)=1:EndIf
  If col=5 And c5=1:scr(a1,y1+b)=1:EndIf
  If col=6 And c6=1:scr(a1,y1+b)=1:EndIf
  If col=7 And c7=1:scr(a1,y1+b)=1:EndIf
but if I use OR, this does not work:

Code: Select all

  If col=0 And c0 Or col=1 And c1 Or col=2 And c2 Or col=3 And c3>0 Or col=4 And c4 Or col=5 And c5 Or col=6 And c6 Or col=7 And c7:scr(a1,y1+b)=1:Else:scr(a1,y1+b)=0:EndIf
even if I change the "and cX" to "and cX=1", the result in SCR() is allways 0, independend from the values of variables. Is this a bug or did I miss something important?
Btw: Select ... Case is a bit slower than If ... Endif

Posted: Wed Jun 04, 2003 11:54 am
by LarsG
Try adding paranthesis..
ie. if (a AND b) OR (a AND c) ...etc...

Don't know if it will help you, but it's worth a try..
-Lars

Posted: Wed Jun 04, 2003 11:55 am
by Saboteur
Have you tried with?:

If (col=0 And c0) Or (col=1 And c1) Or (col=2 And c2) Or (col=3 And c3>0) Or (col=4 And c4) Or (col=5 And c5) Or (col=6 And c6) Or (col=7 And c7):scr(a1,y1+b)=1:Else:scr(a1,y1+b)=0:EndIf

Posted: Wed Jun 04, 2003 12:49 pm
by LCD
Yup, thanx! this works now fine...