Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 677 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
lorikob361, LucasJoshua, Baklazhan, Hanky27, firatv
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Syntax error in code copied from manual? #337757
08/13/10 06:28
08/13/10 06:28
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
Hi all,

I am ashamed to make a syntax error topic grin but I can`t see any mistake. I copied this code from "EVENT_PUSH"-page in the manual:

Code:
my.push = 3;		 // only get pushed by entities with push above 3
my.ENABLE_PUSH = ON; // sensible for push collision
my.emask |= ENABLE_PUSH;
my.event = bounce_event;



Here the same in my code:
Code:
function enemy_bomb() 
{
   c_setminmax(me); // bounding box setzten
   my.STATE = 1;
   my.group = 3;
   my.push = 3;		 // only get pushed by entities with push above 3
   my.ENABLE_PUSH = ON; // sensible for push collision
   my.emask |= ENABLE_PUSH;
   my.event = spieler_treffer;
	
   my.pan = your.pan+180;
   my.tilt = your.tilt;
   my.roll = your.roll;
   ...



Engine gives me a syntax error message in Line 12 <my.ENABLE_PUSH = ON; // sensible for push collision>.

There must be something wrong in this line. If I comment it out, there`s no error. But I don`t know what laugh

Thx

Ditje

Re: Syntax error in code copied from manual? [Re: Ditje] #337758
08/13/10 06:35
08/13/10 06:35
Joined: Sep 2007
Posts: 62
Germany
B
bodden Offline
Junior Member
bodden  Offline
Junior Member
B

Joined: Sep 2007
Posts: 62
Germany
try

set(my,ENABLE_PUSH);

Re: Syntax error in code copied from manual? [Re: bodden] #337760
08/13/10 06:45
08/13/10 06:45
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
Yeah it works - THX for fast reply - manual should be updated here?

This topic is still fresh, so I add my next problem wink

I call the ENTITY_PUSH statement in this way:

Code:
function treffer() 
{ 
   ...   
   punkte_spieler += 50;
   //ent_remove(you);
   ...
}

...
my.group = 2;
my.push = 2;
set(my,ENABLE_PUSH);
my.emask |= ENABLE_PUSH;
my.event = treffer;

...



Pushed ENTITY has value 3. If function treffer is called the var "punkte_spieler" gets counted up. But if I remove the comment of "ent_remove(you);" I get an error message: "Invalid call in treffer()"

Thx Ditje

Last edited by Ditje; 08/13/10 07:37.
Re: Syntax error in code copied from manual? [Re: Ditje] #337763
08/13/10 07:31
08/13/10 07:31
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
You can't set ENABLE_PUSH in the flag parameter, otherwise you will likely get strange crashes. Delete that "set(my,ENABLE_PUSH);" and use the code from the manual.

my.ENABLE_PUSH = ON; is C-Script

my.emask |= ENABLE_PUSH; is lite-C.

But first you must make up your mind in what language you are writing your script, C-Script or lite-C. Obviously you cant's have both in the same script.

Dont copy code without understanding it!!

Re: Syntax error in code copied from manual? [Re: Tobias] #337765
08/13/10 07:49
08/13/10 07:49
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
ah - ok I didn`t know that red marked code in the manual is C-Script. So I copied both. RTFM from the beginning!!! Now I understand and I am allowed to copy. grin

"set(my,ENABLE_PUSH);" is removed, but I still get the error message.

Thanks

Ditje

Last edited by Ditje; 08/13/10 07:52.
Re: Syntax error in code copied from manual? [Re: Ditje] #337770
08/13/10 08:24
08/13/10 08:24
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
The error message is because you can't remove an entity directly in an event, you must add a wait() before for finishing the event. This is also in the manual when you look for the number of that error message.

Re: Syntax error in code copied from manual? [Re: Tobias] #337776
08/13/10 08:41
08/13/10 08:41
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
DANKE Tobias,

yeah it works and now I remind. I have read about and already used but forgotten. Wait was after removing. Newbie mistakes because of less practice laugh

Ditje


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