As far as determining which surface you are looking at, you can use raycasts. I did something like this in Trench Digging Plus. Here's a succinct version of what I did in
my code%eyePoint = %client.player.getEyePoint();
%eyeVector = %client.player.getEyeVector();
%pos = vectorAdd(%eyePoint, 100); // You will probably want to tweak the range here; 100 is probably too big for your purposes
%ray = containerRayCast(%eyePoint, %pos, $TypeMasks::FxBrickObjectType);
%brick = firstWord(%ray);
%normal = normalFromRayCast(%ray);
That
%normal will tell you what surface the player is looking at. A normal of "0 0 1" indicates the top surface, "0 0 -1" the bottom, and "0 1 0", "1 0 0", "0 -1 0", "-1 0 0" the north, east, south and west surfaces, respectively (I am not sure if these are conventionally considered north, south, east, and west, but it is how I refer to them). One thing to note is that the normal vectors are not always perfect. That is, you might get a vector more like "6.172444e-123 0 1" instead of "0 0 1". If you're just dealing with basic normal surfaces (no inclined or oblique surfaces), then you can just round each coordinate value.
Are you trying to create event triggers, like
onActivateTop or
onActivateNorth, etc.?