Graal Forums

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

Sage_Shadowbane 12-25-2009 06:32 PM

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! :D

cbk1994 12-25-2009 06:41 PM

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


Sage_Shadowbane 12-25-2009 06:50 PM

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


All times are GMT +2. The time now is 01:31 AM.

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