hey,

you need to sort out your indentations, you'd of spotted the problem in no time...

make sure you have all your defines 1st,
then pump out your strings and vars
go mad with your bmaps snd files etc...
then your functions

the problem you're having though in the instance is you've put a wait(1); outside of a function
reading the error you can see on line 68 you've closed the function which would be more noticable with correct indentation, (there may be other mistakes, i'm just pointing out this one)

Code:
DEFINE nullframe,-2;
DEFINE blend,-1;
DEFINE stand,0;
DEFINE run,1;
DEFINE walk,2;
DEFINE jump,3;
DEFINE fall,4;
DEFINE move_x,skill22; //movement skills
DEFINE move_y,skill23;
DEFINE move_z,skill24;
DEFINE force_x,skill25;
DEFINE force_y,skill26;
DEFINE force_z,skill27;
DEFINE velocity_x,skill28;
DEFINE velocity_y,skill29;
DEFINE velocity_z,skill30;
DEFINE animate,SKILL31; //animation skills
DEFINE animate2,SKILL32;
DEFINE animblend,SKILL33;
DEFINE currentframe,SKILL34;
DEFINE blendframe,SKILL35;
DEFINE z_offset,SKILL50; //gravity and jumping skills
DEFINE jumping_mode,SKILL51;
DEFINE gravity,SKILL52;
DEFINE movement_mode,SKILL53; //for various movement mainly combat
DEFINE moving,SKILL54;
DEFINE hit_by_player,SKILL55; //enemy skills
DEFINE entity_type,SKILL56;

ACTION player_action {
	my.shadow = on;
	WHILE (1) { //the main loop
		handle_movement();
		handle_camera();
		handle_animation(1);
		wait(1);
	}
}

FUNCTION handle_movement() {
	temp.x = -1000;
	temp.y = 0;
	IF (key_w == 1) { temp.x = camera.pan; }
	IF (key_s == 1) { temp.x = camera.pan + 180; }
	IF (key_a == 1) { temp.x = camera.pan + 90; }
	IF (key_d == 1) { temp.x = camera.pan - 90; }
	IF (temp.x != -1000) { temp.y = 15 * time; }

	my.move_x = fcos(temp.x,temp.y);
	my.move_y = fsin(temp.x,temp.y);
	c_move(my,nullvector,my.move_x,use_aabb | ignore_passable | glide);

	IF (my.move_x != 0 || my.move_y != 0) { //if we are moving
		IF (my.animblend == stand) { //if our current animation is stand
			IF (key_shift == 1) { my.blendframe = walk; } ELSE { my.blendframe = run; }
		}
		IF (my.animblend == run && key_shift == 1) { my.blendframe = walk; }
		IF (my.animblend == walk && key_shift == 0) { my.blendframe = run; }
	} ELSE {
		IF (my.animblend > stand) { //if we aren't moving and our current animation is walk or run, blend and cycle the stand animation
			my.blendframe = stand;
		}
	}
}

FUNCTION handle_camera() {
	vec_set(camera.x,vector(my.x + fcos(my.pan,-200),my.y + fsin(my.pan,-200),my.z + 80)); //place the camera behind the player
	vec_diff(temp.x,my.x,camera.x); //make the camera look towards the player
	vec_to_angle(camera.pan,temp.x);
//}
	wait(1);
}


NB: i've only commented out the extra close bracket you have, put some indentation and put white spacing in

Hope this helps!