1 registered members (bigsmack),
1,201
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
wath is wrong with this code
#325997
05/29/10 16:48
05/29/10 16:48
|
Joined: May 2010
Posts: 63
JohnnyIsDutch
OP
Junior Member
|
OP
Junior Member
Joined: May 2010
Posts: 63
|
what is wrong with this code
action player_move
{
player = me;
wait(1);
while (me != NULL)
{
move_vec[0] = (key_cuu - key_cud)*3 *time;
move_vec[1] = (key_comma - key_period) *2 *time;
player.pan += (key_cul-key_cur)*4 *time;
ent_move(move_vec,NULLVECTOR);
If (move_vec[0] == 0 && move_vec[1] == 0)
{
idle_percent = (idle_percent +5*time)%100;
ent_animate(me,"idle",idle_percent,ANM_CYCLE);
}
else
{
// our movement animations will go here
walk_percent = (walk_percent + sign(move_vec[0])*5*time)%100;
ent_animate(player,"walk",walk_percent,ANM_CYCLE);
}
wait(1);
}
}
error in main syntax error
Last edited by JohnnyIsDutch; 05/29/10 16:51.
|
|
|
Re: wath is wrong with this code
[Re: LemmyTheSlayer]
#326072
05/30/10 07:40
05/30/10 07:40
|
Joined: Apr 2010
Posts: 56
Badrizmo
Junior Member
|
Junior Member
Joined: Apr 2010
Posts: 56
|
@LemmyTheSlayer: Parenthesis in this case is useless as the && operator precedence is lower than the == so the code will be be the same with or without the parenthesis. check this page http://www.difranco.net/cop2220/op-prec.htm@JohnnyIsDutch: I think you should add () at the end of your action name, as far as I remember it is required in lite-c. Give it a try and let me know the results. Also if you can write the exact error message you got. For now replace action player_move With action player_move() If you have time you may check lesson 10 in the Lite-c workshops, here is the link http://tutorial.3dgamestudio.net/
|
|
|
Re: wath is wrong with this code
[Re: Badrizmo]
#326073
05/30/10 08:05
05/30/10 08:05
|
Joined: May 2010
Posts: 63
JohnnyIsDutch
OP
Junior Member
|
OP
Junior Member
Joined: May 2010
Posts: 63
|
@LemmyTheSlayer: Parenthesis in this case is useless as the && operator precedence is lower than the == so the code will be be the same with or without the parenthesis. check this page http://www.difranco.net/cop2220/op-prec.htm@JohnnyIsDutch: I think you should add () at the end of your action name, as far as I remember it is required in lite-c. Give it a try and let me know the results. Also if you can write the exact error message you got. For now replace action player_move With action player_move() If you have time you may check lesson 10 in the Lite-c workshops, here is the link http://tutorial.3dgamestudio.net/ i have a simple code with the same error "error in main" but () isn't work, here is the error ![](http://easy-upload.nl/f/5oH7UpY3.png) and the code:
// noname.c
function main()
{
level_load("noname.wmb"); // load level newlevel.wmb
}
action player
{
player = me;
}
Last edited by JohnnyIsDutch; 05/30/10 08:06.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|