1 registered members (TipmyPip),
18,449
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
error max, please help
#212109
06/20/08 13:39
06/20/08 13:39
|
Joined: Jul 2006
Posts: 76 uk london
FireArm
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2006
Posts: 76
uk london
|
I finally decided to use lite-c so my script i made im rewriting.
So far i converted about 50% of my script, after line 40 there are errors. But i got a new bug i cant fix on my own(probley something very easy to fix)
i got error
Error in 'MAIN' line 39; 'max' undeclared identifer <fall_speed.z = max (-20 * time, fall_speed.z); // 35 = falling speed> . Cant compile PROJECT.C
Any idea's which could be wrong?.
my script #include <acknex.h> #include <default.c>
ENTITY* gplayer; var walk_percentage; //anmation percent var can_walk = 1; //the player can move var distance_to_ground; // the distance between player's origin and the ground not yet used var distance_check; // use this to check distance var fall_speed; //set fall speed VECTOR* temp; VECTOR* distance_check; VECTOR* fall_speed;
function main() { video_switch(7,0,1); // set full screen and 800/600 with no depth change fps_max = 200; //set the frame rate this way game will run the same on all pc's level_load("Project1.wmb"); //load the level wait(2); // wait until the level is loaded camera.tilt = -12;//set camera tilt }
action player_actions() //player action { gplayer = me; //ponit the model is gplayer set(my,SHADOW); //shadow on while(1) //loop { if (can_walk == 1) // if you can walk { vec_set(temp,gplayer.x);//set temp to be equal to gplayer vec_set(camera,vector(temp.x-200,temp.y,gplayer.z+50));//set camera to follow vec_set(distance_check,gplayer.x); //distance_check = gplayer distance_check.z -= 5000; //set 5000 quants below player's origin distance_to_ground = c_trace (my.x, distance_check.x, IGNORE_ME | USE_BOX); fall_speed.z = - (distance_to_ground - 17); // 17 = experimental value fall_speed.z = Max (-20 * time, fall_speed.z); // 35 = falling speed if (key_w) //if keyboard W is pressed move forward { c_move(my,vector(9.6* time_step,0,fall_speed.z),nullvector,GLIDE); //move ent_animate(my, "walk", walk_percentage, ANM_CYCLE); // "walk" animation loop walk_percentage += 12 * time_step; // 3 = animation speed for "walk" } else { c_move(my,vector(0,0,fall_speed.z),nullvector,GLIDE); //dont move but appy gravity ent_animate(my, NULL, 0, 0); // reset all the animations }
if (key_a) //if keyboard A is pressed pan + 2 { my.pan+=8 * time_step; //if keyboard A is pressed pan + 2 }
if (key_d) //if keyboard A is pressed pan - 2 { my.pan-=8 * time_step; //if keyboard A is pressed pan - 2 }
wait(1); //wait to next frame }
wait(1); } }
FONT arial_font = "Arial",0,20; // Arial, bold, a character has a height of 20 points STRING worldtext_str = "My First Project"; // string says MY First Project TEXT world_txt = { pos_x = 10; pos_y = 10; string (worldtext_str) ; flags = VISIBLE; font = arial_font; } // this above displays the text top left
please help
|
|
|
Re: error max, please help
[Re: FireArm]
#212123
06/20/08 14:29
06/20/08 14:29
|
Joined: Jan 2004
Posts: 3,023 The Netherlands
Helghast
Expert
|
Expert
Joined: Jan 2004
Posts: 3,023
The Netherlands
|
thanks. is there a page in the manual that shows me all these?. use the search function, it will result into a page something along the lines like: unsupported script, and it will tell you to what the code has been updated (or not  ). regards,
|
|
|
Re: error max, please help
[Re: Helghast]
#212126
06/20/08 14:42
06/20/08 14:42
|
Joined: Jul 2006
Posts: 76 uk london
FireArm
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2006
Posts: 76
uk london
|
Thanks. i just got one last error now.
i get a crash error when i run the the game. Error E1513 player_actions
so i better post my script this one is a bit tricky for me. #include <acknex.h> #include <default.c>
var walk_percentage; //anmation percent var can_walk = 1; //the player can move var distance_to_ground; // the distance between player's origin and the ground not yet used VECTOR* temp; VECTOR* distance_check; VECTOR* fall_speed;
function main() { video_switch(7,0,0); // set full screen and 800/600 with no depth change fps_max = 200; //set the frame rate this way game will run the same on all pc's level_load("Project1.wmb"); //load the level wait(2); // wait until the level is loaded camera.tilt = -12;//set camera tilt }
action player_actions() //player action { set(my,SHADOW); //shadow on while(1) //loop { if (can_walk == 1) // if you can walk { vec_set(temp.x,player.x);//set temp to be equal to gplayer vec_set(camera,vector(temp.x-200,temp.y,player.z+50));//set camera to follow vec_set(distance_check,player.x); //distance_check = gplayer distance_check.z -= 5000; //set 5000 quants below player's origin distance_to_ground = c_trace (player.x, distance_check.x, IGNORE_ME | USE_BOX); fall_speed.z = - (distance_to_ground - 17); // 17 = experimental value fall_speed.z = maxv (-20 * time_step, fall_speed.z); // 35 = falling speed if (key_w) //if keyboard W is pressed move forward { c_move(my,vector(9.6* time_step,0,fall_speed.z),nullvector,GLIDE); //move ent_animate(my, "walk", walk_percentage, ANM_CYCLE); // "walk" animation loop walk_percentage += 12 * time_step; // 3 = animation speed for "walk" } else { c_move(my,vector(0,0,fall_speed.z),nullvector,GLIDE); //dont move but appy gravity ent_animate(my, NULL, 0, 0); // reset all the animations } if (key_a) //if keyboard A is pressed pan + 2 { my.pan+=8 * time_step; //if keyboard A is pressed pan + 2 } if (key_d) //if keyboard A is pressed pan - 2 { my.pan-=8 * time_step; //if keyboard A is pressed pan - 2 } wait(1); //wait to next frame }
} }
|
|
|
Re: error max, please help
[Re: FireArm]
#212137
06/20/08 15:40
06/20/08 15:40
|
Joined: Jan 2004
Posts: 3,023 The Netherlands
Helghast
Expert
|
Expert
Joined: Jan 2004
Posts: 3,023
The Netherlands
|
your running a lite-c project here? action/function is replaced by void (however function still works). that should fix it... also, you gotta initialise variables at the beginning, so set these 2: var walk_percentage; var distance_to_ground; to: var walk_percentage = 0; var distance_to_ground = 0; that's about it  regards,
|
|
|
Re: error max, please help
[Re: Helghast]
#212140
06/20/08 16:08
06/20/08 16:08
|
Joined: Jul 2006
Posts: 76 uk london
FireArm
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2006
Posts: 76
uk london
|
thanks but still getting the error. i can't see no errors in the script but yet the error remains.
Last edited by FireArm; 06/20/08 16:42.
|
|
|
|