4 registered members (dBc, clonman, TipmyPip, 1 invisible),
18,946
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
OP
Member
|
OP
Member
Joined: Jul 2010
Posts: 127
Germany, Herford
|
Hi all, I am ashamed to make a syntax error topic  but I can`t see any mistake. I copied this code from "EVENT_PUSH"-page in the manual:
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:
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  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
bodden
Junior Member
|
Junior Member
Joined: Sep 2007
Posts: 62
Germany
|
|
|
|
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
OP
Member
|
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  I call the ENTITY_PUSH statement in this way:
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: Tobias]
#337765
08/13/10 07:49
08/13/10 07:49
|
Joined: Jul 2010
Posts: 127 Germany, Herford
Ditje
OP
Member
|
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.  "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: Tobias]
#337776
08/13/10 08:41
08/13/10 08:41
|
Joined: Jul 2010
Posts: 127 Germany, Herford
Ditje
OP
Member
|
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  Ditje
|
|
|
|