BOS Operators???
Moderator: Moderators
BOS Operators???
I just noticed that BOS has no & (binary and) operator. WHY???
Also I noticed that there's a ? operator. WTF does that do? Same for ??, ??? and ????.
Also I noticed that there's a ? operator. WTF does that do? Same for ??, ??? and ????.
Code: Select all
d = (a?b:c);
Code: Select all
if (a) d = b;
else d = c;
The & operator could have been useful for working with masks indeed.
? is a min(x,y) function.
Code: Select all
var i;
i = 10?9;
i is 9.
i = 10?11;
i is 10.
It might be a bitwise AND though, since it's used with explode mostly.
I mean, in "explode right_arm type FALL | FIRE" OR makes little sense.
Okay I tested this.
16|32 is 48.
32|7 is 39.
...
edit:
It's a bitwise & indeed. 32|7|1 is 39, since 0010 0111 includes 0000 0001.
So you can use it for flags. Pretty useless without & though.
The % operator compiles as well, no idea what it does though. It's not the rest operator. ~ does as well, same about it's use. Same for ´, `, ' etc. Apparently some characters do get accepted as operators but do nothing.
Just found out that you can use operators used in if queries anywhere, i.e.
will increase a by 1 since it's true. Not sure about the usefulness though.
edit2:
& does exist, just write it out.
AND, OR, ...
I mean, in "explode right_arm type FALL | FIRE" OR makes little sense.
Okay I tested this.
16|32 is 48.
32|7 is 39.
...

edit:
It's a bitwise & indeed. 32|7|1 is 39, since 0010 0111 includes 0000 0001.
So you can use it for flags. Pretty useless without & though.
The % operator compiles as well, no idea what it does though. It's not the rest operator. ~ does as well, same about it's use. Same for ´, `, ' etc. Apparently some characters do get accepted as operators but do nothing.
Just found out that you can use operators used in if queries anywhere, i.e.
Code: Select all
a = 10; a = a + (a>1);
edit2:
& does exist, just write it out.
AND, OR, ...
127 && 32 is 1, though (and I looked through the compiler files, && and AND have the same opcode, as do OR and ||). It compares bitwise but it only returns true or false, not the proper result.
a = a + (a>1);
You sound surprised by some of this stuff.
I mean, in "explode right_arm type FALL | FIRE" OR makes little sense.
Um, read that again. Bitwise OR is the ONLY thing that makes sense.
a = a + (a>1);
You sound surprised by some of this stuff.
I mean, in "explode right_arm type FALL | FIRE" OR makes little sense.
Um, read that again. Bitwise OR is the ONLY thing that makes sense.
From Compiler.cfg.
I'm an idiot. Didn't know that FOR/NEXT was allowed, among other things.
...hey, there's some very interesting stuff here. AND there's some important stuff that's missing. Where's the vertex-moving stuff?
I'm an idiot. Didn't know that FOR/NEXT was allowed, among other things.
Code: Select all
[OPERATORS]
Operator = ! ;
Operator = NOT ;
Operator = * ;
Operator = /;
Operator = +;
Operator = -;
Operator = <;
Operator = <=;
Operator= > ;
Operator= >= ;
Operator= >? ;
Operator= >=? ;
Operator= == ;
Operator= != ;
Operator= ? ;
Operator= | ;
Operator= && ;
Operator= AND ;
Operator= || ;
Operator= OR ;
Operator= ?? ;
Operator= ??? ;
Operator= ???? ;
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
[STD_DEFS]
Name = FALSE;
Value = 0;
Name= TRUE;
Value = 1;
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
[COMMANDS]
Keyword = if;
Keyword = @endif;
Keyword = @endelse;
Keyword = for;
Keyword = @next_for_1;
Keyword = @next_for_2;
Keyword = while;
Keyword = @endwhile;
Keyword = break;
Keyword = continue;
Keyword = @NewScript;
Keyword = @PopFVar;
Keyword = @PopSVar;
Keyword = static-var;
Keyword = sound;
Keyword = var;
Keyword = piece;
Keyword = move;
Keyword = turn;
Keyword = spin;
Keyword = return;
Keyword = stop-spin;
Keyword = emit-sfx;
Keyword = sleep;
Keyword = rand;
Keyword = get;
Keyword = set;
Keyword = attach-unit;
Keyword = drop-unit;
Keyword = play-sound;
Keyword = stop-sound;
Keyword = show;
Keyword = hide;
Keyword = cache;
Keyword = dont-cache;
Keyword = dont-shadow;
Keyword = dont-shade;
Keyword = signal;
Keyword = set-signal-mask;
Keyword = wait-for-turn;
Keyword = wait-for-move;
Keyword = explode;
Keyword = Mission-Command;
Keyword = call-script;
Keyword = start-script;
...hey, there's some very interesting stuff here. AND there's some important stuff that's missing. Where's the vertex-moving stuff?
Sooo... can Break stop an aiming function? Cuz that'd be... erm... useful.
And what does @NewScript do?
@PopFVar? @PopSVar? Sounds like they feed values into variables to avoid divide-by-zeroes. Probably just old stuff from Cavedog debugging.
And why @endif, @endelse, @endwhile???
What does for ( ;; ) mean? Does that actually work? Is it an infinite "for" that would be more efficient than a WHILE?
I am realizing there's a bunch of interesting junk in here... how much of it works with Spring is anybody's guess, though.
And what does @NewScript do?
@PopFVar? @PopSVar? Sounds like they feed values into variables to avoid divide-by-zeroes. Probably just old stuff from Cavedog debugging.
And why @endif, @endelse, @endwhile???
What does for ( ;; ) mean? Does that actually work? Is it an infinite "for" that would be more efficient than a WHILE?
I am realizing there's a bunch of interesting junk in here... how much of it works with Spring is anybody's guess, though.
~ and % aren't in there so I guess they don't do anything...
Wth are >? and >=? for?
break i knew was in, but generally isn't that useful except for killing infinite loops - i doubt it will allow you to kill an aim function, argh, what's wrong with return for that anyway? Likewise, continue isn't of that much use either, merely a shortcut to something you can do with conditionals anwyay.
And why are you always adamant BOS supports vertex moving? I've never seen any evidence for that
Wth are >? and >=? for?
break i knew was in, but generally isn't that useful except for killing infinite loops - i doubt it will allow you to kill an aim function, argh, what's wrong with return for that anyway? Likewise, continue isn't of that much use either, merely a shortcut to something you can do with conditionals anwyay.
And why are you always adamant BOS supports vertex moving? I've never seen any evidence for that

The @ stuff looks more like internal codes that are used for establishing the basic grammar.
Argh, if you want to kill an aiming function, aren't signals and returns enough?
A for is just a fancy way of saying while, the differentiation exists so it's clearer that a loop iterates through a number of values.
Argh, if you want to kill an aiming function, aren't signals and returns enough?
A for is just a fancy way of saying while, the differentiation exists so it's clearer that a loop iterates through a number of values.
Here is what break does, AFAIK:Argh wrote:Sooo... can Break stop an aiming function? Cuz that'd be... erm... useful.
Code: Select all
i = 0;
j=50;
while(i<100)
{
++i;
if(i==j)
{
break;
}
}