Actually, no problem not solved yet...
PHP Code:
function WarptoAIS_Button.onAction() {
if (confirm("Warp to AIS")) {
this.chat = "Works?";
}
}
function confirm(action) {
new GuiWindowCtrl("ConfirmationBox") {
profile = "GuiBlueWindowProfile";
width = 131;
height = 110;
x = player.x;
y = player.y;
text = "Confirmation";
canMaximize = false;
canMinimize = false;
destroyonhide = true;
canresize = false;
this.returnvalue = false;
new GuiTextCtrl("AlertConfirm_l") {
profile = GuiBlueTextProfile;
x = 11;
y = 27;
height = 15;
width = 130;
text = "Proceed with:";
}
new GuiTextCtrl("AlertConfirm_l_action") {
profile = GuiBlueTextProfile;
x = 30;
y = 42;
height = 15;
width = 130;
text = action;
}
new GuiButtonCtrl("cYes_Button") {
profile = GuiBlueButtonProfile;
x = 11;
y = 67;
width = 50;
height = 30;
text = "Yes";
thiso.catchevent(this.name, "onAction", "onReplied");
}
new GuiButtonCtrl("cNo_Button") {
profile = GuiBlueButtonProfile;
x = 71;
y = 67;
width = 50;
height = 30;
text = "No";
thiso.catchevent(this.name, "onAction", "onReplied");
}
}
waitfor(this, "AnsweredDialog", 3600);
return ConfirmationBox.returnvalue;
}
function onReplied(obj) {
ConfirmationBox.returnvalue = (obj.text == "Yes" ? true : false);
ConfirmationBox.hide();
this.trigger("AnsweredDialog", "");
}
The confirmation box does popup and it does hide when I click yes or no, but it wont return a value, If I take off the hide() then it does return the value...