Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-08-2006, 09:40 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
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();
}

__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #2  
Old 08-09-2006, 12:34 AM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
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.
__________________



Reply With Quote
  #3  
Old 08-09-2006, 01:01 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
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.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #4  
Old 08-09-2006, 01:19 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to 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);

__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #5  
Old 08-18-2006, 04:31 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
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?
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #6  
Old 08-18-2006, 04:47 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Don't forget to use thiso.catchevent(this,"onAction","function")

for the buttons
Reply With Quote
  #7  
Old 08-21-2006, 05:56 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
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() {
  
// ...

__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #8  
Old 08-21-2006, 07:29 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
catchevent allows you to assign multiple buttons the same event.
Reply With Quote
  #9  
Old 08-22-2006, 12:12 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to 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) {
    
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

Last edited by Twinny; 08-22-2006 at 01:05 PM..
Reply With Quote
  #10  
Old 08-22-2006, 12:51 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
What is it with you people being unable to indent correctly?

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();
  }

Reply With Quote
  #11  
Old 08-24-2006, 04:18 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
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") {
    
// ..
  
}

__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
Reply


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 05:18 AM.


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