De DigiWiki.
//calculates your position relative to <0,0,0> of 'Da Boom' in meters when you touch it
vector vecrel; //a sum of llgetpos and llgetregioncorner (and another vector). Saving time doing vector math.
default
{
state_entry()
{
llSetText("Touch me to get your position", <1,1,1>, 2.0);
}
touch_start(integer total_number)
{
vecrel = llGetRegionCorner() + llDetectedPos(0);
llWhisper(0, "llGetRegionCorner() is:"+(string)vecrel ); //for debugging before vector addition
vecrel -= <256000.0, 256000.0, 0.0>;//Da Boom's region corner is at <256000.0, 256000.0, 0.0>
llWhisper (0, "Position relative to <0,0,0> of 'Da Boom': "+ (string)llRound(vecrel.x) +",\t\t\t"+ (string)llRound(vecrel.y) +",\t\t\t"+ (string)llRound(vecrel.z) + ".");
llWhisper(0, "Position relative to <0,0,0> of 'Da Boom':"+(string)vecrel ); //faster but unformatted output
}
}