I have failed...

I have failed...

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

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

I have failed...

Post by KDR_11k »

Code: Select all

#ifndef __STACK_H
#define __STACK_H

static-var stack_error;

#define STACK(stackvar)	static-var push_stackvar, pval_stackvar, pop_stackvar, stackvar, stackvar_isempty;\
	func_stackvar(value, rec) {\
		while (!pop_stackvar) {\
			if(push_stackvar) {\
				push_stackvar=0;\
				call-script func_stackvar(pval_stackvar + 0, rec + 1);\
			}\
			sleep 30;\
		}\
		stackvar = value;\
		if (rec == 0) stackvar_isempty = 1;\
		pop_stackvar = 0;\
	}\
	\
	stackvar_push(value) {\
		if (stackvar_isempty) {\
			stackvar_isempty = 0;\
			start-script func_stackvar(value+0);\
		}\
		else {\
			push_stackvar = 1;\
			pval_stackvar = value;\
		}\
	}\
	\
	stackvar_pop() {\
		if (!stackvar_isempty) {\
			pop_stackvar = 1;\
			stack_error=0;\
		}\
		else {\
			stack_error=1;\
		}\
	}
#endif
This thing should be an implementation of a stack in BOS. Unfortunately, since #define won't replace its parameter properly if it's part of another identifier (e.g. function name) it won't work well, to have more than one stack in your code you'd have to copy&paste and search/replace the stackvar... Guess it's not possible to do this well.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

use luaCOB, much much easier.
User avatar
nemppu
Posts: 417
Joined: 25 Jun 2007, 22:27

Post by nemppu »

lol fail)))))
User avatar
nemppu
Posts: 417
Joined: 25 Jun 2007, 22:27

Post by nemppu »

soz i dont very good
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

imbaczek wrote:use luaCOB, much much easier.
Yeah, probably.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

Your location is breaking the forum! Ahhhhh!!!!!!!
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

I don't very good either.

PS: I noticed this too. BOS' macros are rather limited in their use.
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post by MadRat »

That's a limiting factor only if you know what is a stack. I bet most people don't get as fancy as you want simply because they find it easier to copy from existing examples. Well at least I'd always cut and paste from cavedog bos files for the basic framework of a bos to speed up the process.

Using the rem tag \ in the middle of your while statement looks like bad general usage of a rem statement. I'm surprised the bos compiler even knows in those cases to continue to read beyond that rem comment for the rest of the statement.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

Your next mission, should you choose to accept it, is to acquire Scriptor source code by any mean necessary, and "fix" our issues at the source.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

scriptor is fubar, I was thinking about making a completely new compiler, probably would be easier...
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

MadRat wrote:Using the rem tag \ in the middle of your while statement looks like bad general usage of a rem statement. I'm surprised the bos compiler even knows in those cases to continue to read beyond that rem comment for the rest of the statement.
WTF are you talking about?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

MadRad got confused beween // and /* */, used to insert comments, which he calls remarks, and \, which is used to make a macro span several lines.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

i.e. as usual he didn't know what he was talking about.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

BTW is there a reason why everybody tells everyone to use scriptor instead of http://cc.tauniverse.com/boscompiler.html ?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Post by smoth »

no idea, I have never used bos compiler. Scriptor is the tool everyone uses because we know for sure it works correctly.
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

The one you linked imbaczek, is neither as stable nor as pretty (IIRC) as Scriptor.
i think its also built to utilize some advanced features of a hacked TA.exe that mafia/prognosis developed a while back, and as such, has never really been as 'stable'.

Someone made something called The Brain a while back, and that as actually very feature-rich, but for some reason it never became widely accepted in the community (consistency and stability issues again, i think).

Scriptor has been the de facto standard for years.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

I did try the Brain once. It was horrendous, would refuse most of my code, for stupid reason, like if I had a variable named k I couldn't use any other variable called kxx, it wouldn't tell which line was faulty like Scriptor does, it seemed to have lots of pass and intermediate compilation stages, and was generally loads of phail.

Scriptor's not perfect, but it's the best!
Ok, I admit I have not tried Cobbler or other alternatives
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

That assembler/compiler combo looks neat, source code says it does some optimizations. Does scriptor do that?

Also, prettiness is not something to judge a compiler on IMHO 8) Grab notepad++ and make a BOS syntax file that makes stuff pretty.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

I have used BASM. It is not suitable for work with Spring, it produces code that Spring will not execute properly (probably order-of-instructions stuff, but the problems may be larger than that). It was very, very useful for studying low-level assembly of COB, though.
Post Reply

Return to “Game Development”