3 registered members (Quad, VoroneTZ, 1 invisible),
852
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
1,000,000 undeclared identifiers!
#183667
02/13/08 11:12
02/13/08 11:12
|
Joined: Aug 2006
Posts: 128 Papua New Guinea
Impaler
OP
Member
|
OP
Member
Joined: Aug 2006
Posts: 128
Papua New Guinea
|
I have noticed some posts where undeclared identifiers and syntax errors occur in lite-c even though the syntax is sound according to the manual. I have just started migrating to lite-c, and almost every single thing I type in gives me the 'undeclared identifier' error upon compilation. I would like to know which of the following lines of code would be responsible for this, and maybe some forewarning about other code differences.(This is the only code in my .c file.) Code:
action player_soldier() { var vel[3] = (0, 0, 0);//velocity in x, y, z var accel[3] = (0, 0, 0);//velocity in x, y, z var timer = 0;//general timer my.skill9 = 100; while(1) { accel[0] = key_w;//control acceleration by keyboard accel[1] = key_d; accel[0] -= key_s; accel[1] -= key_a; vel[0] += accel[0]; vel[1] += accel[0]; vel[0] = max(vel[0], -20); vel[0] = min(vel[0], 20); vel[1] = max(vel[1], -20); vel[1] = min(vel[1], 20); my.x += vel[0] * cos(my.pan)* time; my.y += vel[1] * sin(my.pan) * time; camera.z = my.z + 100; camera.x = my.x; camera.y = my.y; wait(1);} }
Murphey's Law: << if anything can go wrong, it will >> (Murphey was an optimist).
|
|
|
Re: 1,000,000 undeclared identifiers!
[Re: Excessus]
#183669
02/13/08 11:41
02/13/08 11:41
|
Joined: Aug 2006
Posts: 128 Papua New Guinea
Impaler
OP
Member
|
OP
Member
Joined: Aug 2006
Posts: 128
Papua New Guinea
|
sorry, I forgot to mention that I also had a starter script in which those files were included. It looked like this: Code:
#include <acknex.h>; #include <default.c>; #include "WWII_fps.c"; var video_mode = 6; var video_depth = 16; STRING level_str = "Caen.wmb"; function main() { tex_share = 1; level_load(level_str); }
Murphey's Law: << if anything can go wrong, it will >> (Murphey was an optimist).
|
|
|
Re: 1,000,000 undeclared identifiers!
[Re: Impaler]
#183670
02/13/08 14:37
02/13/08 14:37
|
Joined: May 2007
Posts: 2,043 Germany
Lukas
Programmer
|
Programmer
Joined: May 2007
Posts: 2,043
Germany
|
max(...) -> maxv(...) min(...) -> minv(...) time -> time_step STRING -> STRING* var video_mode = 6; var video_depth = 16; -> function main () { video_mode = 6; video_depth = 16; ... }
|
|
|
Re: 1,000,000 undeclared identifiers!
[Re: Impaler]
#183671
02/13/08 14:39
02/13/08 14:39
|
Joined: Aug 2005
Posts: 390 Florida
oldschoolj
Senior Member
|
Senior Member
Joined: Aug 2005
Posts: 390
Florida
|
I'm pretty sure that a "*" is required behind that STRING declaration. So it woud be STRING*
you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe.
__________________________________
yours truly
|
|
|
Re: 1,000,000 undeclared identifiers!
[Re: oldschoolj]
#183672
02/13/08 20:10
02/13/08 20:10
|
Joined: Aug 2004
Posts: 1,305 New York
PrenceOfDarkness
Serious User
|
Serious User
Joined: Aug 2004
Posts: 1,305
New York
|
var vel[3] = (0, 0, 0);//velocity in x, y, z
I think should be
var vel[3] = {0,0,0}; or if just enter 1 0 they are all set to zero (i do this and it works)
var vel[3] = {0};
"There is no problem that can't be solved with time and determination." -me prenceofdarkness for instant messages on AIM.
Looking for a model designer PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
|
|
|
Re: 1,000,000 undeclared identifiers!
[Re: oldschoolj]
#183673
02/14/08 11:53
02/14/08 11:53
|
Joined: Aug 2006
Posts: 128 Papua New Guinea
Impaler
OP
Member
|
OP
Member
Joined: Aug 2006
Posts: 128
Papua New Guinea
|
Thanks, guys, those are very helpful! It's nice to know about the differences in syntax like that.
Murphey's Law: << if anything can go wrong, it will >> (Murphey was an optimist).
|
|
|
|