BOS Operators??? - Page 2

BOS Operators???

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I never use break because I have no idea which block it breaks out of.
tombom
Posts: 1933
Joined: 18 Dec 2005, 20:21

Post by tombom »

KDR_11k wrote:I never use break because I have no idea which block it breaks out of.
It breaks out the innermost block.
Argh wrote: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???
All that looks like virtual machine kinda stuff; like simplifying all the code. If you know what I mean.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Argh wrote:Sooo... can Break stop an aiming function? Cuz that'd be... erm... useful.
And why @endif, @endelse, @endwhile???
return FALSE; stops an aiming function or you can use a signal to break out of it. Break is a keyword to break out of a while or for loop.

The @ ones are precompiler keywords I guess, i.e. #endif.

Code: Select all

var y;
while (x < 5) {
	++x;
	for (y = 0; y < 5000; ++y) {
		if (y >= 5) break;
	}
	if (x > 2) break;
}
The foor loop will stop when y reaches 5, the while loop when x reaches 2. It's fairly simple...
Last edited by rattle on 21 Mar 2007, 15:49, edited 1 time in total.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I think they're interpretations of }, actually. If they were precompiler statements we'd see ifdef, ifndef, etc listed there as well. BTW, is there a precompiler statement that repeats a chunk of text N times with a certain keyword replaced with the number of the iteration (so if I had e.g. ten LLTs on a unit I'd script one of them and tell the precompiler to make 9 more copies of that code)?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

BUMP

After checking Spring code and scriptors compiler.cfg I can reveal

Code: Select all

const int BITWISE_AND = 0x10035000;
From Spring

and

Code: Select all

Operator= ? ;
Value=10035000;
From Scriptor. The '?' operator is the BITWISE_AND we were all missing. I have updated my Compiler.cfg accordingly :P
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Cool! Why not use & for it instead?

Anyway...
rattle wrote:? is a min(x,y) function.

Code: Select all

var i;
i = 10?9;

i is 9.

i = 10?11;

i is 10.
lol :P

The results are right however. Should have done some more testing.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

It's easy to change your compiler.cfg to use &.

I'll probably go through and add other missing operators (e.g. XOR) and then release an updated Compiler.cfg
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

When can we jsut jump to LUA and cut out BOS altogether? :P
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Never because the devs say LUA is too slow.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Dragon45 wrote:When can we jsut jump to LUA and cut out BOS altogether? :P
Not a great idea.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Dragon45 just volounteered to port scripts over for free.
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

>_> cut BOS out of the update loop i mean

I dont have the time to develop an assembly code converter :<
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

KDR_11k wrote:is there a precompiler statement that repeats a chunk of text N times with a certain keyword replaced with the number of the iteration
I wish there was such one me too.


Dragon45 wrote:When can we just jump to LUA and cut out BOS altogether?
So that we can tick "run as slow as a slideshow even on a quad core" on our list our features copied from SupCom?



No, the real question is, can we use Compiler.cfg to add new keywords to the language (after they've been coded in Spring source)? I still want some kill-unit(id) and morph-into("unitname") and two arguments "set"!



Nice find on the bitwise AND.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

zwzsg

kill-unit(id) and morph-into("type") are exactly the kinds of functions
that can be left to the COB<-->LUA interface (in terms of the amount
of times that they would likely be called, not their functionality.

With regards to adding new GET ids, that's fine for quick info grabs,
but isn't as nice as a named call-script solution for routines. I plan on
finishing my COB->ScriptMoveType interface (same run-time binding
trick as for lua_ routines), and then you'll see how much cleaner it looks.
Using a call-script also makes it possible to use more then the 4 args
that GET is limited to.

example:

Code: Select all

call-script ScriptMovePhysics(
              0, 100, 200,  // positon
              0, 10,  0,    // velocity
              0, 30,  0     // rotation
            )
Post Reply

Return to “Game Development”