HTML Code:
function WarpAIS_Button.onAction(){
confirm("WarptoAIS");
if(this.flag ==1){
this.chat = "test";
}else if (this.flag == 0)
{
this.chat = "no";
}
}
function confirm(action){
this.flag = 0;
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;
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";
}
new GuiButtonCtrl("cNo_Button") {
profile = GuiBlueButtonProfile;
x = 71;
y = 67;
width = 50;
height = 30;
text = "No";
}
}
}
function cYes_Button.onAction()
{
ConfirmationBox.destroy();
this.flag = 1;
}
function cNo_Button.onAction()
{
ConfirmationBox.destroy();
this.flag = 0;
}
Here is a snippet of a script I created. The problem is, when I click the WarptoAIS button, yes the confirmation box does popup, but the value that the WarpAIS_Button.onAction() is always false because when the confirm box is created.. How can I make a function to confirm an action before performing it?
in short...
Action --> Confirm --> If true, do action