Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   GuiWindowCtrl bug/error. (https://forums.graalonline.com/forums/showthread.php?t=81925)

LoneAngelIbesu 09-20-2008 08:19 PM

GuiWindowCtrl bug/error.
 
1 Attachment(s)
For the life of me, I cannot figure out what's going wrong here. I'm creating 4 GuiWindowCtrls, and the first 3 work as intended. However, the fourth one is driving me crazy. Since Inverness is dealing with Ike, you guys will have to help me.

Here's the function that creates the controls. System.destroyobject(obj), checks to see if the object exists, then if so, it destroys it. All of the windows should not be visible, as their visibility is toggled by a fade script. However, if you look at the top left-hand corner, you will see a GuiTextEditCtrl and a GuiButtonCtrl.

It's either a really stupid mistake on my part (I tend to do that), or some kind of bug with Graal. As you can see from the engine log, TradeWindow4.fadein() does not exist, however fadein() is in the util_guifade class, which is joined to TradeWindow4 upon creation.

PHP Code:

function createcontrols() {
  
System.destroyobject("TradeWindow");
  
System.destroyobject("TradeWindow2");
  
System.destroyobject("TradeWindow3");
  
System.destroyobject("TradeWindow4");
  new 
GuiWindowCtrl("TradeWindow") {
    
this.join("util_guifade");
    
this.profile GuiGrayWindowProfile;
    
this.clientrelative true;
    
this.clientextent = {320,320};
    
this.canclose true;
    
this.canmaximize false;
    
this.canminimize false;
    
this.canmove true;
    
this.canresize true;
    
this.closequery false;
    
this.destroyonhide false;
    
this.= (screenwidth 2) - (this.width 2);
    
this.= (screenheight 2) - (this.height 2);
    
this.visible false;
    
this.alpha 0;
    
this.text "Your Offer";
    
thiso.catchevent(this.name"onMove""movewindows");
  }
  new 
GuiWindowCtrl("TradeWindow2") {
    
this.join("util_guifade");
    
this.profile GuiGrayWindowProfile;
    
this.clientrelative true;
    
this.clientextent = {220,320};
    
this.canclose false;
    
this.canmaximize false;
    
this.canminimize false;
    
this.canmove true;
    
this.canresize true;
    
this.closequery false;
    
this.destroyonhide false;
    
this.TradeWindow.TradeWindow.width 5;
    
this.TradeWindow.y;
    
this.visible false;
    
this.alpha 0;
    
this.text "TestAccount's Offer";
  }
  new 
GuiWindowCtrl("TradeWindow3") {
    
this.join("util_guifade");
    
this.profile GuiGrayWindowProfile;
    
this.clientrelative true;
    
this.clientextent = {120,80};
    
this.canclose false;
    
this.canmaximize false;
    
this.canminimize false;
    
this.canmove false;
    
this.canresize false;
    
this.closequery false;
    
this.destroyonhide false;
    
this.= (screenwidth 2) - (this.width 2);
    
this.= (screenheight 2) - (this.height 2);
    
this.visible false;
    
this.alpha 0;
    
this.text "Trade Invite";

    new 
GuiTextCtrl("TradeInvitationAccount") {
      
this.profile GuiGrayTextProfile;
      
this.text "From: TestAccount";
      
this.0;
      
this.0;
      
this.height 20;
      
this.width 120;
    }
    new 
GuiButtonCtrl("TradeInvitationAccept") {
      
this.profile GuiGrayButtonProfile;
      
this.text "Accept";
      
this.10;
      
this.25;
      
this.height 20;
      
this.width 100;
    }
    new 
GuiButtonCtrl("TradeInvitationDeny") {
      
this.profile GuiGrayButtonProfile;
      
this.text "Deny";
      
this.10;
      
this.50;
      
this.height 20;
      
this.width 100;
    }
  }
  new 
GuiWindowCtrl("TradeWindow4") {
    
this.join("util_guifade");
    
this.profile GuiGrayWindowProfile;
    
this.clientrelative true;
    
this.clientextent = {120,80};
    
this.canclose true;
    
this.canmaximize false;
    
this.canminimize false;
    
this.canmove false;
    
this.canresize false;
    
this.closequery false;
    
this.destroyonhide true;
    
this.= (screenwidth 2) - (this.width 2);
    
this.= (screenheight 2) - (this.height 2);
    
this.visible false;
    
this.alpha 0;
    
this.text "Account:";

    new 
GuiTextEditCtrl("TradeSendInviteAccount") {
      
this.profile GuiGrayTextEditProfile;
      
this.0;
      
this.0;
      
this.height 20;
      
this.width 120;
    }
    new 
GuiButtonCtrl("TradeSendInvite") {
      
this.profile GuiGrayButtonProfile;
      
this.text "Send";
      
this.10;
      
this.25;
      
this.height 20;
      
this.width 100;
    }
  }



Crow 09-20-2008 08:43 PM

Well, I'm unsure, but tried setting destroyonhide to false in the 4th window control? Maybe it destroys it when the alpha is 0.

Edit: Just saw you are setting this.visible to false aswell. I'm pretty sure this thing is destroyed again.

LoneAngelIbesu 09-20-2008 09:00 PM

Quote:

Originally Posted by Crow (Post 1424925)
Well, I'm unsure, but tried setting destroyonhide to false in the 4th window control? Maybe it destroys it when the alpha is 0.

Edit: Just saw you are setting this.visible to false aswell. I'm pretty sure this thing is destroyed again.

Huh. I did not know that alpha/visible actually destroys the control. However, setting this.destroyonhide to false worked. Thanks. ^^


All times are GMT +2. The time now is 08:49 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.