Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
4 registered members (AndrewAMD, Quad, soulman3, Ayumi), 675 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
temp "undeclared identifier" #222958
08/21/08 18:35
08/21/08 18:35
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
the following code works ok in c-script but i get that error in lite c, can anyone point out were this is wrong?
Code:
{
	camera.pan -= mouse_force.x * 12 * time;
	camera.tilt += mouse_force.y * 8 * time;
	camera.tilt = clamp(camera.tilt,-30,100);
	temp = fcos(camera.tilt,-camera_distance);
	vec_set(camera.x,vector(my.x + fcos(camera.pan,temp),my.y + fsin(camera.pan,temp),my.z + 10 + fsin(camera.tilt,-camera_distance)));

	vec_diff(temp.x,camera.x,my.x); //find the vector from the player to the camera
	vec_normalize(temp.x,16); //get the magnitude of it's vector to 16 quants and store it in temp
	vec_add(temp.x,camera.x); //add the vector (from player to camera) of a magnitude of 16 quants and add it to the camera's position.

	trace_mode = ignore_me+ignore_passable+ignore_models;
	result = trace(my.x,temp.x); //trace from the player to 16 quants behind the camera.
	IF (result > 0) 
	{
		vec_diff(temp.x,my.x,target.x); //find the vector from the point the trace hit to the player
		vec_normalize(temp.x,16); //get the magnitude of this vector to 16 quants and store in temp
		vec_set(camera.x,target.x); //place the camera at the trace hit point
		vec_add(camera.x,temp.x); //move the camera away from the wall by the vector temp, 16 quants towards the player
	}
	wait(1);
}



Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: temp "undeclared identifier" [Re: jigalypuff] #222963
08/21/08 18:42
08/21/08 18:42
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
add VECTOR temp;


"empty"
Re: temp "undeclared identifier" [Re: flits] #222964
08/21/08 19:01
08/21/08 19:01
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
erm, were abouts should i put it lol


Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: temp "undeclared identifier" [Re: jigalypuff] #222966
08/21/08 19:04
08/21/08 19:04
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
at the top

VECTOR temp;

function do_a_func()
{
...


"empty"
Re: temp "undeclared identifier" [Re: flits] #222969
08/21/08 19:11
08/21/08 19:11
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
cannot convert struct vector to fixed is the error i`m getting with that.

here is the whole movement code, it is from the latest aum.
the camera code is from an older project though. i beleive i modified the code dave lancaster contributed. the kingdom hearts stuff.
Code:
VECTOR temp;

function move_players() // both entities are controlled by the server
{ 
	var walk_percentage;
	var stand_percentage;
	while (1) 
	{
		c_move(my, vector(my.skill1, 0, 0), nullvector, GLIDE); // move the entity using its own skill1
		my.pan += my.skill2; // and rotate it using its own skill2
		if (my.skill1) // the player is moving the entity? (skill1 isn't zero)
		{
			walk_percentage += 1.5 * my.skill1 * sign(my.skill1); // allow forward / back animations
			ent_animate(my, "walk", walk_percentage, ANM_CYCLE); // animate the entity
			stand_percentage = 0; // reset stand_percentage
		}
		else
		{
			stand_percentage += 1.2 * time_step; // the "stand" animation values don't depend on player's input
			ent_animate(my, "stand", stand_percentage, ANM_CYCLE); // animate the entity
			walk_percentage = 0; // reset walk_percentage
		}
		ent_sendnow(my); // send the updated entity position regardless of the "dplay_entrate" value, etc
		wait (1);
	}
	{
	camera.pan -= mouse_force.x * 12 * time_step;
	camera.tilt += mouse_force.y * 8 * time_step;
	camera.tilt = clamp(camera.tilt,-30,100);
	temp = fcos(camera.tilt,-camera_distance);
	vec_set(camera.x,vector(my.x + fcos(camera.pan,temp),my.y + fsin(camera.pan,temp),my.z + 10 + fsin(camera.tilt,-camera_distance)));

	vec_diff(temp.x,camera.x,my.x); //find the vector from the player to the camera
	vec_normalize(temp.x,16); //get the magnitude of it's vector to 16 quants and store it in temp
	vec_add(temp.x,camera.x); //add the vector (from player to camera) of a magnitude of 16 quants and add it to the camera's position.

	trace_mode = ignore_me+ignore_passable+ignore_models;
	result = trace(my.x,temp.x); //trace from the player to 16 quants behind the camera.
	IF (result > 0) 
	{
		vec_diff(temp.x,my.x,target.x); //find the vector from the point the trace hit to the player
		vec_normalize(temp.x,16); //get the magnitude of this vector to 16 quants and store in temp
		vec_set(camera.x,target.x); //place the camera at the trace hit point
		vec_add(camera.x,temp.x); //move the camera away from the wall by the vector temp, 16 quants towards the player
	}
	wait(1);
}
}



Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: temp "undeclared identifier" [Re: jigalypuff] #222975
08/21/08 19:53
08/21/08 19:53
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
try "VECTOR* temp[3];" instead.

Re: temp "undeclared identifier" [Re: jigalypuff] #222976
08/21/08 19:54
08/21/08 19:54
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
Code:
var temp[3];

function move_players() // both entities are controlled by the server
{ 
	var walk_percentage;
	var stand_percentage;
	while (1) 
	{
		c_move(my, vector(my.skill1, 0, 0), nullvector, GLIDE); // move the entity using its own skill1
		my.pan += my.skill2; // and rotate it using its own skill2
		if (my.skill1) // the player is moving the entity? (skill1 isn't zero)
		{
			walk_percentage += 1.5 * my.skill1 * sign(my.skill1); // allow forward / back animations
			ent_animate(my, "walk", walk_percentage, ANM_CYCLE); // animate the entity
			stand_percentage = 0; // reset stand_percentage
		}
		else
		{
			stand_percentage += 1.2 * time_step; // the "stand" animation values don't depend on player's input
			ent_animate(my, "stand", stand_percentage, ANM_CYCLE); // animate the entity
			walk_percentage = 0; // reset walk_percentage
		}
		ent_sendnow(my); // send the updated entity position regardless of the "dplay_entrate" value, etc
		wait (1);
	}
	{
	camera.pan -= mouse_force.x * 12 * time_step;
	camera.tilt += mouse_force.y * 8 * time_step;
	camera.tilt = clamp(camera.tilt,-30,100);
	temp = fcos(camera.tilt,-camera_distance);
	vec_set(camera.x,vector(my.x + fcos(camera.pan,temp),my.y + fsin(camera.pan,temp),my.z + 10 + fsin(camera.tilt,-camera_distance)));

	vec_diff(temp[0],camera.x,my.x); //find the vector from the player to the camera
	vec_normalize(temp[0],16); //get the magnitude of it's vector to 16 quants and store it in temp
	vec_add(temp[0],camera.x); //add the vector (from player to camera) of a magnitude of 16 quants and add it to the camera's position.

	trace_mode = ignore_me+ignore_passable+ignore_models;
	result = trace(my.x,temp[0]); //trace from the player to 16 quants behind the camera.
	IF (result > 0) 
	{
		vec_diff(temp[0],my.x,target[0]); //find the vector from the point the trace hit to the player
		vec_normalize(temp[0],16); //get the magnitude of this vector to 16 quants and store in temp
		vec_set(camera.x,target.x); //place the camera at the trace hit point
		vec_add(camera.x,temp[0]); //move the camera away from the wall by the vector temp, 16 quants towards the player
	}
	wait(1);
}
}




"empty"
Re: temp "undeclared identifier" [Re: flits] #222980
08/21/08 20:03
08/21/08 20:03
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
weird now i`m getting error in main but i have not changed georges code at all
Code:
function main() 
{
	fps_max = 60; // limit the number of data packets that are sent each second to 60
	///video_screen = 1;
	level_load ("dark_frontier.wmb");
	vec_set(camera.x, vector (-600, 0, 100)); // set a proper camera position
	if (!connection) // no server could be found?
		sys_exit(NULL); // then shut down the engine
	if (connection == 2)  // this instance of the game runs as a client?
	{
		my = ent_create ("fcc_a.mdl", vector (100, 50, 40), move_players); // then create the red guard!
		while (1) 
		{
			my.skill1 = 5 * (key_w - key_s) * time_step;
			my.skill2 = 4 * (key_a - key_d) * time_step;
			send_skill (my.skill1, SEND_VEC); // send skill1...3 to the server
			wait (1);
		}
	}
	if (connection == 3) // this instance of the game runs as a server and client at the same time? (connection = 3)
	{ 
		my = ent_create ("cgc_a.mdl", vector (-100, -50, 40), move_players); // create the blue guard
		while (1) 
		{
			my.skill1 = 5 * (key_w - key_s) * time_step;
			my.skill2 = 4 * (key_a - key_d) * time_step;
			wait (1);
		}
	}
}



Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: temp "undeclared identifier" [Re: jigalypuff] #222981
08/21/08 20:04
08/21/08 20:04
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
sorry it says error in main line 11 syntax error


Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: temp "undeclared identifier" [Re: jigalypuff] #223767
08/26/08 14:48
08/26/08 14:48
Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
Shinobi Offline
User
Shinobi  Offline
User

Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
Just include this line in your first postīs function code.
Code:
var temp; // thats all :)


Last edited by Shinobi; 08/26/08 14:52.
Page 1 of 2 1 2

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