Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-12-2010, 12:41 AM
Jimbo33 Jimbo33 is offline
****
Jimbo33's Avatar
Join Date: Jan 2008
Location: Canada
Posts: 74
Jimbo33 is on a distinguished road
Send a message via AIM to Jimbo33 Send a message via MSN to Jimbo33
Close GUI on button click?

Hi,
I want my GUI to close when the player presses a button...
Here are the two parts of my GUI Script about the button I want
to close the whole GUI:

HTML Code:
    new GuiButtonCtrl("ClassSelect_Button3") {
      profile = GuiBlueButtonProfile;
      text = "Swordsman";
      width = 80;
      x = 10;
      y = 200;
    }
...

HTML Code:
function ClassSelect_Button3.onAction() {
//Stuff
}

Please help, all I need is the command to close everything and where to put it, thanks
Reply With Quote
  #2  
Old 02-12-2010, 01:10 AM
Engine Engine is offline
Registered User
Join Date: Jan 2010
Posts: 70
Engine is on a distinguished road
i'm fairly sure it's
PHP Code:
new GuiButtonCtrl("ClassSelect_main"){
//blahblah
    
new GuiButtonCtrl("ClassSelect_Button3") {
      
profile GuiBlueButtonProfile;
      
text "Swordsman";
      
width 80;
      
10;
      
200;
    }
}
function 
ClassSelect_Button3.onAction() {
ClassSelect_main.destroy();

Reply With Quote
  #3  
Old 02-12-2010, 01:18 AM
Jimbo33 Jimbo33 is offline
****
Jimbo33's Avatar
Join Date: Jan 2008
Location: Canada
Posts: 74
Jimbo33 is on a distinguished road
Send a message via AIM to Jimbo33 Send a message via MSN to Jimbo33
Oh yeah it worked!

I was doing

ClassSelect.destroy();

but it was actually
ClassSelect_Main.destroy();
like you said

Thanks
Reply With Quote
  #4  
Old 02-12-2010, 01:39 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
If it's a GUI that will be used fairly often, or even not that often, it's better to just .hide() it rather than constantly recreating it every time it's needed. I've asked about this and Stefan has confirmed that create/destroy should only be reserved for single-use GUI's.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:16 AM.


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