Fix some order of operations and variables naming so that the script compiles and runs under OpenSim. Add a temporary workaround for llGetLinkNumberOfFaces() current inability to get the correct number of faces from a mesh object on OpenSim (currently it always returns 8 regardless of the actual number of sides)