Hi all,

Just started with GStudio and I'm trying to code some basic movement / environment manipulation scripts. I know there are templates for this sort of thing but it's helping me learn the basics. Anyway, I've a door entity that is rotated using a EVENT_CLICK and the script works just fine - that is, unless it's used in conjunction with my player movement script!

The problem seems to be that the movement script takes exclusive control of any mouse / keyboard input and mouse clicks just don't seem to register at all.

Any help would be appreciated! Thanks in advance, Jim.

** DOOR SCRIPT **

// DoorFunctions.wdl

function manipulateDoor() {

if(event_type == EVENT_CLICK) {

my.pan += 45;
}
}

action doorControls {

my.ENABLE_CLICK = ON;
my.event = manipulateDoor;
}

** PLAYER CONTROL SCRIPTS **
// PlayerControls.wdl

// ** Global variables
var moveVector[3] = 0, 0, 0;

action playerControl {

player = me;

wait(1);

// ** Loop while player exists - check for keyboard / mouse input
while(player != null) {

// *************************************
// ** Control and update player movement

moveVector[0] = ((key_w - key_s) * 4 * time); // ** Sets "reldist" vector that sets the
// ** "direction" of the player's forward
// ** / reverse movement

moveVector[1] = ((key_a - key_d) * 2 * time); // ** Sets "reldist" vector that sets the
// ** "direction" of the players strafing
// ** movement

player.pan -= (mouse_force.x * 8 * time); // ** Pans the camera - controls x-rotation

// ** Tilts the camera while restricting the amount of tilt to + / - 75 degrees
var newTilt = 0;
var tempTilt = 0;
tempTilt = (mouse_force.y * 8 * time);

if((camera.tilt + tempTilt) > 75) {

newTilt = 75;

} else {

if((camera.tilt + tempTilt) < -75) {

newTilt = -75;

} else {

newTilt = (camera.tilt + tempTilt);
}
}

ent_move(moveVector, NULLVECTOR); // ** Moves the player

vec_set(camera.x, player.x); // ** Moves the camera
camera.pan = player.pan; // ** Rotates the camera
camera.tilt = newTilt; // ** Tilts the camera


if(key_space == 1) {

c_scan(camera.x, camera.pan, vector(10, 10, 200), SCAN_ENTS);
}

if(mouse_left == 1) {


}

wait(1);
}
}