Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (howardR, 7th_zorro), 893 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 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