I would guess that your main problem is this line :
Type tmouse Extends tgui
The tgui type has a field "mouse", which calls tmouse.create()... which creates a new instance of tmouse (which is a tgui)... which has a field "mouse", which calls tmouse.create()... which creates a new instance of tmouse (which is a tgui)... which has a field "mouse", which calls tmouse.create()... which creates a new instance of tmouse... etc...
...until it crashes.
:-)
Type tmouse Extends tgui
The tgui type has a field "mouse", which calls tmouse.create()... which creates a new instance of tmouse (which is a tgui)... which has a field "mouse", which calls tmouse.create()... which creates a new instance of tmouse (which is a tgui)... which has a field "mouse", which calls tmouse.create()... which creates a new instance of tmouse... etc...
...until it crashes.
:-)