Something for the scripting gurus here

, i'm using vertexes to attach a shield to my mech model, the pan and tilt angles are calculated properly, meaning that my shield faces the right position, but it won't roll to the right position. what i mean by this is the shield will "face" the right position, but it won't roll to match up with the second vertex i'm using, here are some pics showing what i mean:



my question is, is it possible to use a vertex to calculate the roll angle of a vertex attached entity?
i'm using one vertex on the mech's arm that's used for placing the shield, then there is one that is in the direction where the shield should face, and last there is one close to the hand's position used to calculate where the shield's bottom should point to, or the shield should roll to.
here's the code i'm using so far:
Code:
function slim_shield()
{
var roll_pos;
var attach_pos;
var temp2;
var roll_pos2;
var roll2;
my.passable = on;
while(you)
{// weapon will always "face" the second vertice from
proc_late();
vec_for_vertex(my.x,you,712); //position vertex
vec_for_vertex(attach_pos,you,713); ///the roll should be calculated here...
vec_for_vertex(roll_pos2,you, 735); ///pan and tilt angles are calculated here
temp.x = attach_pos.x - MY.X;
temp.y = attach_pos.y - MY.Y;
temp.z = attach_pos.z - MY.Z;
temp2.x = roll_pos2.x - MY.X;
temp2.y = roll_pos2.y - MY.Y;
temp2.z = roll_pos2.z - MY.Z;
vec_to_angle(roll_pos,temp);
vec_to_angle(roll2, temp2);
my.pan = roll2.pan;
my.tilt = roll2.tilt;
my.roll = roll_pos.roll;
wait(1);
}
}