Any idea why this does not work?

Just starting out? Need help? Post your questions and find answers here.
LCD
Enthusiast
Enthusiast
Posts: 206
Joined: Sun Jun 01, 2003 10:55 pm
Location: Austria, Vienna
Contact:

Any idea why this does not work?

Post 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
My PC
Ryzen 9 5950, 64 GB RAM, nVidia RTX A4000, Win 10
Ryzen 7 1700, 32 GB RAM, nVidia RTX A2000, Win 10
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post 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

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
Saboteur
Enthusiast
Enthusiast
Posts: 273
Joined: Fri Apr 25, 2003 7:09 pm
Location: (Madrid) Spain
Contact:

Post 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
[:: PB Registered ::]

Win10 Intel core i5-3330 8GB RAM Nvidia GTX 1050Ti
LCD
Enthusiast
Enthusiast
Posts: 206
Joined: Sun Jun 01, 2003 10:55 pm
Location: Austria, Vienna
Contact:

Post by LCD »

Yup, thanx! this works now fine...
My PC
Ryzen 9 5950, 64 GB RAM, nVidia RTX A4000, Win 10
Ryzen 7 1700, 32 GB RAM, nVidia RTX A2000, Win 10
Post Reply