Should 'temp' be an 'undeclared identifier' in .c format?

Posted By: SirCamaris

Should 'temp' be an 'undeclared identifier' in .c format? - 02/07/09 00:05

Hi, I'm getting the 'undeclared identifier' message for the predefined 'temp' variable. Is this because I have my script saved as a .c file? I'm trying to use vec_set and vec_add, transferring the player's coordinates into temp. Here's my code:

function wall_scan()
{vec_set(temp, player.x);
vec_add(temp, vector(200, 0, 0);
c_trace(player.x, temp, IGNORE_ME + USE_BOX); //trace from the player to the walls
if(you == Walls_ent) //got the wall?
{c_move(player, vector(64,0,0), nullvector, GLIDE);
}
}

Note: I also tried 'temp.x' in place of 'temp'...didn't work
Pseudocode: Trace from player to a distance 200 quants in front of player... If the trace touches a wall, move player.
Note: The function works fine when I ignore vec_set, vec_add, and temp, and replace temp with Walls_ent within c_trace.
Any help would be appreciated. Thank you.
Posted By: Michael_Schwarz

Re: Should 'temp' be an 'undeclared identifier' in .c format? - 02/07/09 00:06

temp is a predefined variable in c-script, but not in lite-c. You have to define it yourself if you are using lite-c.
Posted By: SirCamaris

Re: Should 'temp' be an 'undeclared identifier' in .c format? - 02/07/09 01:09

Thank you, I thought that was the case. I have another problem.
I created: var temp; above vec_set. Now I receive a syntax error on the vec_add line. I'm not sure why though.
Posted By: Michael_Schwarz

Re: Should 'temp' be an 'undeclared identifier' in .c format? - 02/07/09 01:29

a missing parentheses
Posted By: SirCamaris

Re: Should 'temp' be an 'undeclared identifier' in .c format? - 02/07/09 01:39

Thanks again. That was it!
© 2024 lite-C Forums