Yes and like I said, use a TStaticVar object and define its functions with function objects or a class.
PHP Code:
//// Example Script
function onCreated() {
this.topleft = Objects.Rect(null, 0, 0, screenwidth / 2, screenheight / 2);
}
function GraalControl.onMouseDown() {
if (this.topleft.inside(mousescreenx, mousescreeny)) {
// do stuff
}
}
//// Weapon Script: Objects
public function Rect(objname, nx, ny, nw, nh) {
temp.obj = new TStaticVar(""@objname);
obj.x = int(nx);
obj.y = int(ny);
obj.w = int(nw);
obj.h = int(nh);
obj.join("type_rect");
return obj;
}
//// Class Script: type_rect
function inside(nx, ny) {
if (nx in |this.x, this.x + this.w| && ny in |this.y, this.y + this.h|) {
return true;
}
return false;
}
public function objecttype() {
return "TRect";
}
It is not necessary to include what you're saying into GScript when the same functionality can already be achieved.