Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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 (Ayumi), 886 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
lorikob361, LucasJoshua, Baklazhan, Hanky27, firatv
19054 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