Gamestudio Links
Zorro Links
Newest Posts
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
1 registered members (AndrewAMD), 1,014 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
undeclared identifier #335450
07/28/10 16:13
07/28/10 16:13
Joined: May 2010
Posts: 63
J
JohnnyIsDutch Offline OP
Junior Member
JohnnyIsDutch  Offline OP
Junior Member
J

Joined: May 2010
Posts: 63
Hello all,

i have a problem with my code:
Code:
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////// O.w.n..c //////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////


function main()
{
  if (!connection) 
    error("The Server is offlinea");
  else 
    while (dplay_status < 2) wait(1); // wait until the session is opened or joined

  dplay_localfunction = 2; // run actions both on server and client
  level_load ("O.w.n..wmb");
  vec_set(camera.x, vector (-600, 0, 100)); // set a proper camera position

  if (connection & CONNECT_SERVER)  // this instance of the game runs on the server
    ent_create ("cbabe.mdl", vector (100, 50, 40), Player); // then create the red guard!
  else // otherwise, it runs on a connected client
    ent_create ("cbabe.mdl", vector (-100,-50, 40),Player); // create the blue guard	
}


function camera_follow(ENTITY* ent) 
{ 
   while(1) 
   { 
   vec_set(camera.x,vector(-128,0,45)); 
   vec_rotate(camera.x,ent.pan);
   vec_add(camera.x,ent.x);
   vec_set(camera.pan,vector(ent.pan,-10,0)); 
   wait(1); 
   } 
}

action Player()
{ 
	{    
   var walk_percentage = 0;
   while (1) 
   {
   if (my.client_id == dplay_id) { // the following code runs on the player's client only
   my.skill1 = key_w - key_s; // forward/backward
   send_skill(my.skill1,SEND_UNRELIABLE|SEND_RATE); // send movement request to the server
   my.skill2 = key_a - key_d; // left/right rotation
   send_skill(my.skill2,SEND_UNRELIABLE|SEND_RATE); // send rotation request to the server
   }  
  
   if (connection & CONNECT_SERVER) 
   {
   my.pan += my.skill2*5*time_step;   // rotate the entity using its skill2
   var distance = my.skill1*5*time_step;
   c_move(me, vector(distance,0,0), NULL, GLIDE); // move it using its skill1
   walk_percentage += distance;
   ent_animate(me,"walk",walk_percentage,ANM_CYCLE); // animate the entity	
	wait(1);
	}
	wait (1);
	}
}

here my acklog with the error
Quote:
Log of A8 Engine 8.02.0 run at Wed Jul 28 18:08:23 2010
Johnny Reinders on Windows NT/2000/XP version 6.1 Build 7600
Options O.w.n..c -cl -sv -diag -t.
App: E:\Program Files\GStudio8\acknex.exe in E:\Program Files\GStudio7\work\O.w.n\

MM mixer opened
DSOUND device opened
DI interface opened
Start Window opened(c) Conitec - www.3dgamestudio.com
A8 Engine - Trial Edition V8.02.0 - Jul 27 2010
Development version
30 days left

Mouse found
Speakers (2- BCD3000) opened
ATI Mobility Radeon X1400 pure T&L device 1ff9 detected
D3D device ATI Mobility Radeon X1400 1ff9 selected.
ackphysx.dll opened
ackwii.dll opened
Compiling O.W.N..C - [Esc] to abort....
Error in line 19:
'Player' undeclared identifier
< ent_create ("cbabe.mdl", vector (100, 50, 40), Player); // then create the red guard!
>
.. 0.102 sec
Error compiling O.W.N..C
Error E355: Startup failure - any key to abort
Program aborted

Close level,DLL,objects
Free input,funcs,panels,defs,syns,views,strings,vars..ok
Free sounds,bmaps,fonts,hash,defs1,script..ok
Close dx,multimedia,D3D
Disconnect,connection,engine,nexus..ok
A8 Engine - Trial Edition V8.02.0 - Jul 27 2010
(c) Conitec - www.3dgamestudio.com
30 days left
Unfreed: 939, INC, 2136 bytes
Close window at 4.192


Re: undeclared identifier [Re: JohnnyIsDutch] #335454
07/28/10 16:22
07/28/10 16:22
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
How about reading my answer in the other thread ???

Re: undeclared identifier [Re: JohnnyIsDutch] #335456
07/28/10 16:25
07/28/10 16:25
Joined: Jul 2010
Posts: 129
B
bk9iq Offline
Member
bk9iq  Offline
Member
B

Joined: Jul 2010
Posts: 129
try putting the Player action above the main function....

Re: undeclared identifier [Re: bk9iq] #335464
07/28/10 17:48
07/28/10 17:48
Joined: May 2010
Posts: 63
J
JohnnyIsDutch Offline OP
Junior Member
JohnnyIsDutch  Offline OP
Junior Member
J

Joined: May 2010
Posts: 63
this is wath he say now:
Quote:
Log of A8 Engine 8.02.0 run at Wed Jul 28 19:46:40 2010
Johnny Reinders on Windows NT/2000/XP version 6.1 Build 7600
Options O.w.n..c -cl -sv -diag -t.
App: E:\Program Files\GStudio8\acknex.exe in E:\Program Files\GStudio7\work\O.w.n\

MM mixer opened
DSOUND device opened
DI interface opened
Start Window opened(c) Conitec - www.3dgamestudio.com
A8 Engine - Trial Edition V8.02.0 - Jul 27 2010
Development version
30 days left

Mouse found
Speakers (2- BCD3000) opened
ATI Mobility Radeon X1400 pure T&L device 1ff9 detected
D3D device ATI Mobility Radeon X1400 1ff9 selected.
ackphysx.dll opened
ackwii.dll opened
Compiling O.W.N..C - [Esc] to abort.....
Error in line 65:
syntax error.. 0.104 sec
Error compiling O.W.N..C
Error E355: Startup failure - any key to abort

Program aborted
Close level,DLL,objects
Free input,funcs,panels,defs,syns,views,strings,vars..ok
Free sounds,bmaps,fonts,hash,defs1,script..ok
Close dx,multimedia,D3D
Disconnect,connection,engine,nexus..ok
A8 Engine - Trial Edition V8.02.0 - Jul 27 2010
(c) Conitec - www.3dgamestudio.com
30 days left
Unfreed: 939, INC, 2136 bytes
Close window at 4.887
but i dont have 65 lines

Last edited by JohnnyIsDutch; 07/28/10 17:49.
Re: undeclared identifier [Re: JohnnyIsDutch] #335478
07/28/10 19:40
07/28/10 19:40
Joined: Jul 2010
Posts: 129
B
bk9iq Offline
Member
bk9iq  Offline
Member
B

Joined: Jul 2010
Posts: 129
Ok just try this ... it is ur code:

Quote:
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////// O.w.n..c //////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////


function camera_follow(ENTITY* ent)
{
while(1)
{
vec_set(camera.x,vector(-128,0,45));
vec_rotate(camera.x,ent.pan);
vec_add(camera.x,ent.x);
vec_set(camera.pan,vector(ent.pan,-10,0));
wait(1);
}
}

action Player()
{

var walk_percentage = 0;
while (1)
{
if (my.client_id == dplay_id) { // the following code runs on the player's client only
my.skill1 = key_w - key_s; // forward/backward
send_skill(my.skill1,SEND_UNRELIABLE|SEND_RATE); // send movement request to the server
my.skill2 = key_a - key_d; // left/right rotation
send_skill(my.skill2,SEND_UNRELIABLE|SEND_RATE); // send rotation request to the server
}

if (connection & CONNECT_SERVER)
{
my.pan += my.skill2*5*time_step; // rotate the entity using its skill2
var distance = my.skill1*5*time_step;
c_move(me, vector(distance,0,0), NULL, GLIDE); // move it using its skill1
walk_percentage += distance;
ent_animate(me,"walk",walk_percentage,ANM_CYCLE); // animate the entity
wait(1);
}
wait (1);
}
}



function main()
{
if (!connection)
error("The Server is offlinea");
else
while (dplay_status < 2) wait(1); // wait until the session is opened or joined

dplay_localfunction = 2; // run actions both on server and client
level_load ("O.w.n..wmb");
vec_set(camera.x, vector (-600, 0, 100)); // set a proper camera position

if (connection & CONNECT_SERVER) // this instance of the game runs on the server
ent_create ("cbabe.mdl", vector (100, 50, 40), Player); // then create the red guard!
else // otherwise, it runs on a connected client
ent_create ("cbabe.mdl", vector (-100,-50, 40),Player); // create the blue guard
}


Re: undeclared identifier [Re: bk9iq] #335482
07/28/10 19:50
07/28/10 19:50
Joined: Jul 2009
Posts: 80
Area 51
F
fangedscorpion Offline
Junior Member
fangedscorpion  Offline
Junior Member
F

Joined: Jul 2009
Posts: 80
Area 51
This is a double posted thread because there is another thread called "Online Shooter Tutorial" that is the exact same problem and it is posted by the same person. I already posted help there as well for the starter of the tread.


"Pow! You are dead! Not big suprise!" -Heavy

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