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 06-15-2013, 03:23 AM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
trying to close and open a GUI - help

PHP Code:
 function onKeyPressed(codekey) {
    if (
key == "q") {
      
this.on = !this.on;
      if (
this.on) {
        new 
GuiShowImgCtrl("GUI_Inventory") {
          
position = {
            
300100
          
};
          
extent = {
            
690560
          
};
          
image "c_inventorytest6-13-2013.png";
        }
      } else {
        
player.chat "Menu off!";
      }
    }
  } 
I'm also placing the code here once again for any helpful input. thanks to those who try to help. other then that, as the title says i'm mainly trying to close and open this GUI. but i don't know any way of doing that. so if there is a way, what is it?
Reply With Quote
  #2  
Old 06-15-2013, 03:36 AM
Tim_Rocks Tim_Rocks is offline
a true gentlemen
Tim_Rocks's Avatar
Join Date: Aug 2008
Location: USA
Posts: 1,863
Tim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to behold
PHP Code:
//#CLIENTSIDE
//Try creating the GUI first before you actually try modifying/adding to it. 
function onCreated() { 
  if (
isObject("GUI_Inventory")) { 
    
GUI_Inventory.destroy(); 
  } 
  new 
GuiWindowCtrl("GUI_Inventory") { 
    
width 350
    
height 300

    
GraalControl.width - (width 2); 
    
GraalControl.height - (height 2); 

    
hide
  } 


function 
onKeyPressed(codekey) { 
  if (
key == "q") { 
    
this.on = !this.on

    if (
this.on) { 
      
GUI_Inventory.visible true
      
player.chat "I opened my inventory!"
    } else { 
      
GUI_Inventory.visible false
      
player.chat "I closed my inventory!"
    } 

  } 

Good luck buddy, I didn't test it!
__________________
Reply With Quote
  #3  
Old 06-15-2013, 05:45 AM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
thanks though is this necessary?


PHP Code:
function onCreated() { 
  if (
isObject("GUI_Inventory")) { 
    
GUI_Inventory.destroy(); 
  }
    } 

some parts of your script i'm still unfamiliar with. mainly GraalControl, even though it sounds self-explanatory its not something i've gone over very well before.

Last edited by khortez; 06-15-2013 at 05:49 AM.. Reason: found the answer to one of my questions on my own
Reply With Quote
  #4  
Old 06-15-2013, 06:30 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by khortez View Post
thanks though is this necessary?


PHP Code:
function onCreated() { 
  if (
isObject("GUI_Inventory")) { 
    
GUI_Inventory.destroy(); 
  }
    } 

some parts of your script i'm still unfamiliar with. mainly GraalControl, even though it sounds self-explanatory its not something i've gone over very well before.
No, it's not necessary. All it does is destroy the window if it already exists. Useful during development but should be taken out when you're ready to release it.

GraalControl is basically just a GUI object which contains the game. All he's doing is centering the window.
__________________
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 01:14 PM.


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