void end(obj_id self) { debugSpeakMsg(self, "Testing of GetGoodLocation has begun"); } void start(obj_id self) { debugSpeakMsg(self, "Testing of GetGoodLocation has begun"); } trigger OnAttach() { start(self); return SCRIPT_CONTINUE; } trigger OnDetach() { end(self); return SCRIPT_CONTINUE; } trigger OnHearSpeech(obj_id speaker, string text) { string[] words = split( text, ' ' ); if ( words[0].equals("getgoodloc" )) { getGoodLoc(self); } if ( words[0].equals("getheight" )) { getHeight(self); } if (words[0].equals("dropobjectstest" )) { dropTestObjects(self, 100); } return SCRIPT_CONTINUE; } void getGoodLoc(obj_id self) { location sll = new location (getLocation (self)); sll.x -= 8; sll.z -= 8; location sur = new location (getLocation (self)); sur.x += 8; sur.z += 8; location goodLocation = getGoodLocation(8, 8, sll, sur, false, true); if(goodLocation != null) { debugSpeakMsg(self, goodLocation.x + ", " + goodLocation.y + ", " + goodLocation.z + " is a good location."); } else { debugSpeakMsg(self, "Failed"); } } void dropTestObjects(obj_id self, int numObjects) { int areaSizeX = 8; int areaSizeY = 8; location sll = new location (getLocation (self)); sll.x -= 100; sll.z -= 100; location sur = new location (getLocation (self)); sur.x += 100; sur.z += 100; for(int i = 0; i < numObjects; ++i) { location goodLocation = getGoodLocation(areaSizeX, areaSizeY, sll, sur, false, true); if(goodLocation != null) { createObject("object/tangible/furniture/frn_all_table_s01.iff", goodLocation); } else { debugSpeakMsg(self, "Failed to find good location."); } } } void getHeight(obj_id self) { float result = getHeightAtLocation(0, 0); debugSpeakMsg(self, "" + result); }