May 17, 2024, 03:18:36 AM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


SX-B Programming question

Started by gmacted, August 01, 2008, 07:31:44 AM

Previous topic - Next topic

gmacted

Jon,

     I have a SX-B programming question.  I'm not sure it's in the correct forum, but here goes.

     In an "IF THEN ELSE" how do you create multiple conditions?

     Example: 

     if channel < 8 then
        If (channel = 3) or (channel = 7) then
            value = 1
       else
           value = 2
      endif
    endif
 
The | "pipe" is a "logical OR", but what is the symbol for a "conditional OR"?



pwillard

I think you are forced into making more nested "IF's" since I don't think there is anything "OR" related other than bitwise-"OR" that I've ever seen.

The thing is, you might be entering a situation where a lookup/lookdown table would work better.


JonnyMac

August 01, 2008, 08:20:26 AM #2 Last Edit: August 01, 2008, 08:25:42 AM by JonnyMac
SX/B is a single-pass compiler that is very close to the underlying assembly code so you can only have one expression per line.  You can recode your example like this:

Check_Channel:
 IF channel < 8 THEN
   IF channel = 3 THEN
     value = 1
   ELSEIF channel = 7 THEN
     value = 1
   ELSE
     value = 2
   ENDIF
 ENDIF
Jon McPhalen
EFX-TEK Hollywood Office