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 12-25-2009, 06:32 PM
Sage_Shadowbane Sage_Shadowbane is offline
Graal Developer
Sage_Shadowbane's Avatar
Join Date: Mar 2004
Posts: 585
Sage_Shadowbane will become famous soon enough
Help pls?

So i've never used GuiCtrls before, i've always just coded my guis by hand using custom images. But i'm actually trying them out, and oddly I can't seem to figure out why my gui images wont work. If someone could help, I would appreciate it.

So first I have a class set up named gladeious_guiprofiles, and within that is the code:
HTML Code:
//#CLIENTSIDE
function GetProfiles()
{
  new GuiWindowProfile("Gladeious_Window")
  {
    profile.bitmap = "gladeius_gui_window.png";
  }
  new GuiScrollProfile("Gladeious_Scroll")
  {
    profile.bitmap = "gladeius_gui_scroll.png";
  }
  new GuiTextListProfile("Gladeious_TextList")
  {
    profile.bitmap = "";
    profile.fillcolor ={0, 0, 0, 0};
    profile.fillcolorhl ={0, 0, 0, 0};
    profile.fillcolorna ={0, 0, 0, 0};
    profile.fontcolor ={255, 255, 255, 255};
    profile.fontcolorhl ={225, 225, 225, 255};
    profile.fontcolorna ={255, 255, 255, 255};
    profile.fontcolorsel ={235, 235, 235, 255};
    profile.align = "center";
    profile.fonttype = "Comic Sans MS";
    profile.fontsize = 20;
    profile.fontstyle = "cbi";
    profile.textshadow = true;
  }
  new GuiButtonProfile("Gladeious_Button")
  {
    profile.bitmap = "gladeius_gui_button.png";
    profile.align = "center";
    profile.fonttype = "Comic Sans MS";
    profile.fontcolor ={255, 255, 255, 255};
    profile.fontcolorhl ={225, 225, 225, 255};
    profile.fontstyle = "bc";
    profile.fontsize = 20;
    profile.textshadow = true;
  }
}
Than, I have the weapon which is creating the GUI's, and is joining to the class and trying to retrieve the GetProfile() function, but oddly in the F2 output console under Script it says "GraalScript: Function GetProfiles not found in script of Weapon Sage/Testing".

But here is the weapon code:

HTML Code:
//#CLIENTSIDE
function onCreated()
{
  this.join("gladeious_guiprofiles");
  GetProfiles();  
  new GuiWindowCtrl("Example_Window_1")
  {
    profile = "Gladeious_Window";
    
    width = 200;
    height = 100;
    x = screenwidth/2-this.width/2;
    y = screenheight/2-this.height/2-100;
    text = "";
    canminimize=canmaximize=canresize=canmove=canclose=false;
    alpha = .75;
    
    new GuiScrollCtrl("Example_Scroll_1")
    {
      profile = "Gladeious_Scroll";
      
      x = 16;
      y = 16;
      width = 168;
      height = 68;
      hScrollBar = "alwaysOff";
      vScrollBar = "alwaysOn";
      
      new GuiTextListCtrl("Example_List_1")
      {
        profile = "Gladeious_List";
        
        x = y = 0;
        width = 140;
        fitparentwidth = true;
        
        clearrows();
        addrow(0, "Test");
        addrow(1, "Test 2");
      }
    }
  }
  new GuiWindowCtrl("Example_Window_2")
  {
    profile = "Gladeious_Window";
    
    width = 250;
    height = 150;
    x = screenwidth/2-this.width/2;
    y = Example_Window_1.y+Example_Window_1.height-8;
    text = "";
    canminimize=canmaximize=canresize=canmove=canclose=false;
    alpha = .75;
  }
  new GuiButtonCtrl("Example_Button_1")
  {
    profile = "Gladeious_Button";
    
    width = 88;
    height = 46;
    x = screenwidth/2-this.width/2+54;
    y = Example_Window_2.y+Example_Window_2.height+8;
    text = "Cancel";
    alpha = .75;
  }
  new GuiButtonCtrl("Example_Button_2")
  {
    profile = "Gladeious_Button";
    
    width = 88;
    height = 46;
    x = screenwidth/2-this.width/2-54;
    y = Example_Window_2.y+Example_Window_2.height+8;
    text = "Learn";
    alpha = .75;
  }
}
Edit: Where are my manners.. z.z MERRY CHRISTMAS EVERYONE!
Reply With Quote
  #2  
Old 12-25-2009, 06:41 PM
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
Try joining the class serverside. If you join it clientside, the thread isn't halted to wait for the class to be joined.

PHP Code:
function onCreated() {
  
this.join("gladeious_guiprofiles");
}

//#CLIENTSIDE
function onCreated()
{
  
GetProfiles();  
  new 
GuiWindowCtrl("Example_Window_1")
  {
    
//... 
Also, code is a lot more readable if you use [PHP] tags instead of HTML ones .

EDIT: Also, a couple other things I noticed:

First, when you create profiles, you're setting variables in that profile, so you don't need to be setting the variables on the inexistent 'profile' object - it actually won't work this way.

Instead, do this:
PHP Code:
new GuiWindowProfile("Gladeious_Window")
{
  
bitmap "gladeius_gui_window.png";

This goes for all of the profiles.


Secondly, profiles aren't strings, they're objects. Unfortunately, Gscript allows you to set profiles with quotes around them, but it's not proper syntax and Inverness will eat you alive.

PHP Code:
profile Gladeious_Window
__________________
Reply With Quote
  #3  
Old 12-25-2009, 06:50 PM
Sage_Shadowbane Sage_Shadowbane is offline
Graal Developer
Sage_Shadowbane's Avatar
Join Date: Mar 2004
Posts: 585
Sage_Shadowbane will become famous soon enough
Alright well, joining the class serverside wasn't part of the problem, it indeed was the defining of the profile object in the class. So that fixed the problem, thanks Chris. Btw i'll reference using PHP tags next time.. I was actually unsure when I was making the thread, I THOUGHT it was PHP but than suddenly something in my head told me to click HTML tags. -.o
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 11:00 PM.


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