Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 677 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Should 'temp' be an 'undeclared identifier' in .c format? #250273
02/07/09 00:05
02/07/09 00:05
Joined: Aug 2006
Posts: 70
NJ
S
SirCamaris Offline OP
Junior Member
SirCamaris  Offline OP
Junior Member
S

Joined: Aug 2006
Posts: 70
NJ
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.

Re: Should 'temp' be an 'undeclared identifier' in .c format? [Re: SirCamaris] #250274
02/07/09 00:06
02/07/09 00:06
Joined: Aug 2003
Posts: 7,439
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,439
Red Dwarf
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.


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
Re: Should 'temp' be an 'undeclared identifier' in .c format? [Re: Michael_Schwarz] #250278
02/07/09 01:09
02/07/09 01:09
Joined: Aug 2006
Posts: 70
NJ
S
SirCamaris Offline OP
Junior Member
SirCamaris  Offline OP
Junior Member
S

Joined: Aug 2006
Posts: 70
NJ
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.

Re: Should 'temp' be an 'undeclared identifier' in .c format? [Re: SirCamaris] #250280
02/07/09 01:29
02/07/09 01:29
Joined: Aug 2003
Posts: 7,439
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,439
Red Dwarf
a missing parentheses


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
Re: Should 'temp' be an 'undeclared identifier' in .c format? [Re: Michael_Schwarz] #250282
02/07/09 01:39
02/07/09 01:39
Joined: Aug 2006
Posts: 70
NJ
S
SirCamaris Offline OP
Junior Member
SirCamaris  Offline OP
Junior Member
S

Joined: Aug 2006
Posts: 70
NJ
Thanks again. That was it!


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