Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 1,211 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Strategy game snippet #384943
10/10/11 16:04
10/10/11 16:04
Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
Minamato Offline OP
Junior Member
Minamato  Offline OP
Junior Member

Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
Hey guys!

I wonder if anyone can help me "translating" the AUM 2 snippet of a strategy game from C-Script to Lite-C.

It would be great!

The code can be found here: http://www.coniserver.net/coni_users/web_users/pirvu/aum/aumonline_e/

Thanks =)

Greetz, Minamato

Last edited by Minamato; 10/10/11 16:12.
Re: Strategy game snippet [Re: Minamato] #385509
10/19/11 10:41
10/19/11 10:41
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
just check stratego 2 in AUM-11 (http://aum.gstools.de/aum/aum11/code.html), it is much easier to be converted to lite-C

in AUM42 there is a download link for C&C Chapter 1, which should be good for you (http://aum.gstools.de/aum/aum42/user.html)

somewhere on the forum I found its translation to lite-C called cc_chapter1_reload. if you don't find I can upload.

if you need a TotalWar like camera system, you can download my example I posted as a bug report, the link is somewhere in the 'Ask the Developer' section

moreover, I'm planning to provide such codes on my webpage in Nov-Dec for supporting my new standalone 3D Gamestudio editor at http://mapbuilder.zxq.net


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Strategy game snippet [Re: sivan] #386010
10/26/11 21:20
10/26/11 21:20
Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
Minamato Offline OP
Junior Member
Minamato  Offline OP
Junior Member

Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
Thanks for your helpful reply =)

I'll see how far I'll get.

Re: Strategy game snippet [Re: Minamato] #386037
10/27/11 10:29
10/27/11 10:29
Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
Minamato Offline OP
Junior Member
Minamato  Offline OP
Junior Member

Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
While translating the code to lite-c, I am confronted with a problem:

If I leave the following lines like they are, I will get the error message "Error in line 138: 'enable_click': is not a member of 'ENTITY'".

Code:
my.enable_click = on;
my.enable_entity = on;
my.enable_block = on;



But if I change them to the following lines, I will get the error message "Error in line 138: syntax error".

Code:
my.ENABLE_CLICK = ON;
my.ENABLE_ENTITY = ON;
my.ENABLE_BLOCK = ON;



Can somebody help me?

Re: Strategy game snippet [Re: Minamato] #386043
10/27/11 12:41
10/27/11 12:41
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
ON doesn't exist anymore in Lite-c
my.emask |= ENABLE_CLICK; etc...

Re: Strategy game snippet [Re: Minamato] #386044
10/27/11 12:47
10/27/11 12:47
Joined: Dec 2008
Posts: 1,660
North America
Redeemer Offline
Serious User
Redeemer  Offline
Serious User

Joined: Dec 2008
Posts: 1,660
North America
In Lite-C flags are no longer treated as structure elements but bit flags.

The standard entity flags, like INVISIBLE, BRIGHT, and PASSABLE can be accessed by referencing the bits of the entity.flags variable. The entity event flags, like ENABLE_CLICK, ENABLE_ENTITY, and ENABLE_BLOCK can be accessed by referencing the bits of the entity.eflags variable.

There are macros built into Lite-C so you don't have to use OR and AND operators to access the bits of the entity.flags variable, and can instead use more simple commands like the following (red is c-script, green is lite-c):

Code:
my.invisible = on; // turns on flag
my.invisible = off; // turns off flag
if( my.invisible == on ) // returns 1 if flag is on
if( my.invisible == off ) // returns 1 if flag is off



Code:
set(my,INVISIBLE); // set flag on
reset(my,INVISIBLE); // set flag off
if( is(my,INVISIBLE) ) // returns 1 if flag is on
if( !is(my,INVISIBLE) ) // returns 1 if flag is off



Unfortunately for the event flags in entity.eflags no such macros exist, so you must access the bits yourself with boolean operators such as AND and OR. Here are some examples:

Code:
my.eflags |= ENABLE_CLICK; // set flag on
my.eflags &= ~ENABLE_CLICK; // set flag off
if( my.eflags & ENABLE_CLICK ) // returns 1 if flag is on
if( !(my.eflags & ENABLE_CLICK) ) // returns 1 if flag is off




Eats commas for breakfast.

Play Barony: Cursed Edition!
Re: Strategy game snippet [Re: Minamato] #386073
10/27/11 19:35
10/27/11 19:35
Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
Minamato Offline OP
Junior Member
Minamato  Offline OP
Junior Member

Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
Great, thanks. I am a total newbie in translating c-skript to c-lite, so there is another problem:

Code:
vec_set(temp, my.pos);



"Error in line 140: 'pos' is not a member of 'ENTITY'"

What is the problem here?

Re: Strategy game snippet [Re: Minamato] #386076
10/27/11 20:00
10/27/11 20:00
Joined: Dec 2008
Posts: 1,660
North America
Redeemer Offline
Serious User
Redeemer  Offline
Serious User

Joined: Dec 2008
Posts: 1,660
North America
In C-Script, "pos" was a term used to reference the position vector of an entity. It is no longer valid in Lite-C, but you can get the same results by writing:
Code:
vec_set(temp,my.x);


Note that "temp" is no longer a predefined variable in Lite-C. You must define it yourself in your own script, and it cannot be used for multiple purposes. If you need to use the "temp" variable as a vector, declare it as one like this:
Code:
VECTOR temp;


or if you need to use it as a float, declare it like this:
Code:
float temp;


But as with any variable, temp cannot be redefined multiple times throughout a script.


Eats commas for breakfast.

Play Barony: Cursed Edition!
Re: Strategy game snippet [Re: Minamato] #386078
10/27/11 20:19
10/27/11 20:19
Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
Minamato Offline OP
Junior Member
Minamato  Offline OP
Junior Member

Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
the thing with "temp" to be predefined by myself I knew before, but thanks reminding me =)

but there is still some work to do grin

Code:
trace_mode = IGNORE_ME | IGNORE_SPRITES | IGNORE_MODELS | USE_BOX;
my.z -= trace(my.x, temp);	// place the unit on the ground (it has been spawned in the air)
my.target_x = 100000;



"Error in line 143: 'trace' undeclared identifier"

I know that "trace" has to be replaced with "c_trace", but I am a little bit confused with the statement "my.z -= trac(my.x, temp)". How do I have to rewrite it?

I hope I do not sound too stupid grin grin

Re: Strategy game snippet [Re: Minamato] #386113
10/28/11 20:22
10/28/11 20:22
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
check c_trace in manual, and AUM 101 or 100 dealt with c_trace a lot... but anyway, it is the LiteC version, if temp is a VECTOR (if var, use 3 vars: vector(tempx,tempy,tempz) or something like this... ) :

my.z -= trace(my.x, temp , IGNORE_ME | IGNORE_SPRITES | IGNORE_MODELS | USE_BOX);


Free world editor for 3D Gamestudio: MapBuilder Editor

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1