Page 2 of 2

Posted: 21 Mar 2007, 07:55
by KDR_11k
I never use break because I have no idea which block it breaks out of.

Posted: 21 Mar 2007, 08:49
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.

Posted: 21 Mar 2007, 15:41
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...

Posted: 21 Mar 2007, 15:46
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)?

Posted: 02 Apr 2007, 03:11
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

Posted: 02 Apr 2007, 16:41
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.

Posted: 02 Apr 2007, 16:57
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

Posted: 02 Apr 2007, 22:00
by Dragon45
When can we jsut jump to LUA and cut out BOS altogether? :P

Posted: 02 Apr 2007, 22:09
by KDR_11k
Never because the devs say LUA is too slow.

Posted: 02 Apr 2007, 22:09
by FLOZi
Dragon45 wrote:When can we jsut jump to LUA and cut out BOS altogether? :P
Not a great idea.

Posted: 02 Apr 2007, 22:36
by rattle
Dragon45 just volounteered to port scripts over for free.

Posted: 03 Apr 2007, 08:24
by Dragon45
>_> cut BOS out of the update loop i mean

I dont have the time to develop an assembly code converter :<

Posted: 03 Apr 2007, 08:40
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.

Posted: 03 Apr 2007, 09:37
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
            )