If you destroy and create a GUI in the same function callstack, exceptions occur not every time but eventually they do.
Work-around:
PHP Code:
//#CLIENTSIDE
function onCreated() {
if (isObject("awesomeGUI")) {
awesomeGUI.destroy();
}
this.scheduleevent(0.05, "CreateGUI", ""); // Should be able to use trigger as well, but the difference would be neglible.
}
function onCreateGUI() {
new GuiWindowCtrl("awesomeGUI") {
x = y = 10;
width = height = 100;
}
}
As for your "this." variable situation, you were probably accessing it at the wrong level of scope.
PHP Code:
//#CLIENTSIDE
function onCreated() {
this.value = 5;
new GuiButtonCtrl(testButton) {
width = height = 100;
x = (screenwidth - width) / 2;
y = (screenheight - height) / 2;
this.other = "lol";
text = "Value: " @ thiso.value; // Would show Value: 5
text = "Other: " @ this.other; // Would show Other: lol
}
}