Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Gui Scripting (https://forums.graalonline.com/forums/showthread.php?t=67956)

killerogue 08-08-2006 09:40 PM

Gui Scripting
 
I've gotten so far scripting this GUI window by reading the wiki and examining other scripts and the functions they used. But o I'm sort of stuck any and all help would be appreciated as to how I would go about doing this right. >_<

PHP Code:

//By Stan.

//CLIENTSIDE
function onCreated()
{
this.on false;

addGUIControls();
}

function 
turnon()
{
this.on true;
function 
onKeyPressed(code,key) {
if (
keycode==0x75) {//F9
if (this.on
turnoff();
else
turnon();
}



Omini 08-09-2006 12:34 AM

I hope you want to turn it on somewhere else in the script. You forgot the # for Clientside ( //#CLIENTSIDE ), and forgot to close the { bracket for turning it on. Also, I dont think scripts can go back if they call a function (if they call a function, that function needs to be below it). And the part

PHP Code:

function onKeyPressed(code,key) {
if (
keycode==0x75) {//F9 

the if (keycode == 0x75) { }

keycode is the code given within the onKeyPressed params, so it would either be

PHP Code:

function onKeyPressed(keycode,key) {
if (
keycode==0x75) { 

or

PHP Code:

function onKeyPressed(code,key) {
if (
code==0x75) { 

Also I don't see why this is entitled 'Gui Scripting', since so far you havn't mentioned anything about GUIs--but rather, GS2 Scripting.

killerogue 08-09-2006 01:01 AM

I'm scripting the GUI for a window. XD Also I've gotten alot of help from Warcaptain and have come to understand it more.

killerogue 08-09-2006 01:19 AM

Ok. Now I've gotten very far with this GUI script with help from Warcaptain, Master Storm and Kaidenn. But everytime I set the GUIButtonProfile. My menu gets messed up.

PHP Code:

//#CLIENTSIDE
function onCreated(){
  
addGUIControls();
}

function 
addGUIControls(){
  new 
GuiWindowCtrl("SH_Information"){
    
profile "GuiWindowProfile";
    
extent "450 300";
    
position "100 100";
    
canmaximize 1;
    
canminizmize 0;
    
canclose 1;
  new 
GUIButtonCtrl("News"){
  
profile "GuiButtonProfile";
  
extent "400 300";
  
position "45 45";
   }
  }
  new 
GUITabCtrl(Hirings_Tab){
  }
  new 
GUIScrollCtrl(){
  
profile "GuiScrollProfile";
  }
  
GraalControl.addControl(Blah);



ApothiX 08-18-2006 04:31 AM

Quote:

Originally Posted by killerogue
Ok. Now I've gotten very far with this GUI script with help from Warcaptain, Master Storm and Kaidenn. But everytime I set the GUIButtonProfile. My menu gets messed up.

PHP Code:

//#CLIENTSIDE
function onCreated(){
  
addGUIControls();
}

function 
addGUIControls(){
  new 
GuiWindowCtrl("SH_Information"){
    
profile "GuiWindowProfile";
    
extent "450 300";
    
position "100 100";
    
canmaximize 1;
    
canminizmize 0;
    
canclose 1;
  new 
GUIButtonCtrl("News"){
  
profile "GuiButtonProfile";
  
extent "400 300";
  
position "45 45";
   }
  }
  new 
GUITabCtrl(Hirings_Tab){
  }
  new 
GUIScrollCtrl(){
  
profile "GuiScrollProfile";
  }
  
GraalControl.addControl(Blah);



Not sure if it's case sensative or not, but it should be GuiButtonCtrl, GuiTabCtrl, etc.

Also, you are not setting any properties of your tab, and where is 'Blah' defined?

Rapidwolve 08-18-2006 04:47 AM

Don't forget to use thiso.catchevent(this,"onAction","function")

for the buttons

ApothiX 08-21-2006 05:56 AM

Quote:

Originally Posted by Rapidwolve
Don't forget to use thiso.catchevent(this,"onAction","function")

for the buttons

that is not required, you can just as well use:

PHP Code:

function ButtonName.onAction() {
  
// ...



Rick 08-21-2006 07:29 AM

catchevent allows you to assign multiple buttons the same event.

Twinny 08-22-2006 12:12 PM

PHP Code:

//#CLIENTSIDE
function onCreated(){
  
TwinnyTest.destroy//No need to reconnect after each update now
  
drawgui();
}

function 
drawgui(){
  
Testing = new GuiWindowCtrl(TwinnyTest); //Sets the name of the window
  
with (TwinnyTest) {
    
useownprofile true;
    
profile      "GuiBlueWindowProfile";
    
extent       "450 300";
    
position     "100 100";
    
canmaximize  true;
    
canminizmize false;
    
canclose     true;
    
visible      true;
  
    new 
GuiButtonCtrl("News") {
      
profile "GuiBlueButtonProfile";
      
extent "100 30";
      
position "5 150";
      
text     "Actual Text";
    }

    new 
GuiScrollCtrl("ScrollName") { //Must enter a name for a control
      
profile "GuiBlueScrollProfile"//use GuiScrollCtrl not GUIScrollCtrl
      
extent  "100 100";
      
position "10 30";
    }
  }
  
GraalControl.addControl(TwinnyTest); //Must be the name of the window


Use that for a reference for your main GUI stuff

http://wiki.graal.net/index.php/Crea...d_Window_Panes
A link to a guide about Tabbed Panes from Graal Wiki

Skyld 08-22-2006 12:51 PM

What is it with you people being unable to indent correctly? :mad:

Also, Twinny. You don't need to add the control to GraalControl again, and check that your window exists before destroying it or you will just create F2 console errors.
PHP Code:

function onCreated()
{
  if (
myWindow != NULL)
  {
    
myWindow.destroy();
  }



ApothiX 08-24-2006 04:18 AM

Quote:

Originally Posted by Twinny
PHP Code:

//#CLIENTSIDE
function onCreated(){
  
TwinnyTest.destroy//No need to reconnect after each update now
  
drawgui();
}

function 
drawgui(){
  
Testing = new GuiWindowCtrl(TwinnyTest); //Sets the name of the window
  
with (TwinnyTest) {
    
// ..



Assigning the variable testing is irrelevant. What you did can be accomplished in one line.
PHP Code:

function drawgui() {
  new 
GuiWindowCtrl("TwinnyTest") {
    
// ..
  
}




All times are GMT +2. The time now is 06:56 AM.

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