Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-14-2009, 05:56 PM
Schetti Schetti is offline
SC2 Player
Schetti's Avatar
Join Date: Nov 2008
Location: Austria
Posts: 269
Schetti is on a distinguished road
News-Window

I hope you like this news window.
You can list News/Updates, Hiring infos and currently staffs.
Thats my first post, so dont bee too hard.

PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
ExampleWindow = new GuiWindowCtrl("ExampleWindow");
  
  
with (ExampleWindow)
  {
    
profile     "GuiBlueWindowProfile";
    
position    "562 225";
    
extent      "545 555";
    
canMove     true;
    
canResize   false;
    
canMaximize false;
    
canClose    true;
    
tile        true;
    
text        "News";
    
    new 
GuiControl(NewsTab)
    {
      
visible    false;
      
profile    "GuiBlueControlProfile";
      
position   "7.5 52";
      
extent     "531 495";
      
    new 
GuiScrollCtrl("MyGUI_MultiLine1_Scroll") {
      
profile GuiBlueScrollProfile;
      
height 800;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 800;
      
1;

      new 
GuiMLTextCtrl("MyGUI_MultiLine1") {
        
profile GuiBlueMLTextProfile;
        
height 16;
        
horizsizing "width";
        
text " News here";                                        

        
width 518;
       }
      };
    };
    
    new 
GuiControl(HiringsTab)
    {
      
visible    false;
      
profile    "GuiBlueControlProfile";
      
position   "7.5 52";
      
extent     "531 495";
      
    new 
GuiScrollCtrl("MyGUI_MultiLine2_Scroll") {
      
profile GuiBlueScrollProfile;
      
height 800;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 800;
      
1;

      new 
GuiMLTextCtrl("MyGUI_MultiLine2") {
        
profile GuiBlueMLTextProfile;
        
height 16;
        
horizsizing "width";
        
text "Hiring datas here";                                        

        
width 518;
      }
    };
   };
    
    new 
GuiControl(StaffsTab)
    {
      
visible    false;
      
profile    "GuiBlueControlProfile";
      
position   "7.5 52";
      
extent     "531 495";
      
    new 
GuiScrollCtrl("MyGUI_MultiLine3_Scroll") {
      
profile GuiBlueScrollProfile;
      
height 800;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 800;
      
1;

      new 
GuiMLTextCtrl("MyGUI_MultiLine3") {
        
profile GuiBlueMLTextProfile;
        
height 16;
        
horizsizing "width";
        
text "Staff list here";                                        

        
width 518;
       }
      };
    };
    
    new 
GuiTabCtrl(ExampleTabs)
    {
      
profile   "GuiBlueTabProfile";
      
position  "10 28";
      
extent    "300 24";
      
      
clearRows();
      
with (addRow(0"News"))
      {
        
this.pane NewsTab;
      }
      
with (addRow(1"Hirings"))
      {
        
this.pane HiringsTab;
      }
      
with (addRow(2"Staffs"))
      {
        
this.pane StaffsTab;
      }
      
      
thiso.catchevent(name"onSelect""onTabSelect");
    };
  };
  
ExampleTabs.setSelectedById(0);
  
GraalControl.addControl(ExampleWindow);
}

function 
onTabSelect(tabs)
{
  for (
temp.tabtemp.tabs.rows)
  {
    if (
temp.tab.pane == null)
    {
      continue;
    }
    
    if (
temp.tab == temp.tabs.selected)
    {
      
temp.tab.pane.show();
    }
    else
    {
      
temp.tab.pane.hide();
    }
  }

__________________
“Peace cannot be kept by force. It can only be achieved by understanding.” – Albert Einstein
Reply With Quote
  #2  
Old 03-14-2009, 06:34 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Good Job, looks quite professional. =]

styling tip : With multiple vars that are being set to the same thing you can just use '='
ie
PHP Code:
....  
  
tile     
  
canMove  =
  
canClose true;

  
canResize   =
  
canMaximize false;
.... 
also, you can save lines by using

position = { x, y};
extent = { width, height};

in this format you can do operations which you can't do in the "x y" format.
__________________
Deep into the Darkness peering...
Reply With Quote
  #3  
Old 03-14-2009, 08:16 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
Looks good. Can you post a screenshot? I made something similar here.
__________________
Reply With Quote
  #4  
Old 03-14-2009, 08:32 PM
Schetti Schetti is offline
SC2 Player
Schetti's Avatar
Join Date: Nov 2008
Location: Austria
Posts: 269
Schetti is on a distinguished road


if I see that one mines bad.
Attached Thumbnails
Click image for larger version

Name:	News.jpg
Views:	339
Size:	36.9 KB
ID:	47732  
__________________
“Peace cannot be kept by force. It can only be achieved by understanding.” – Albert Einstein
Reply With Quote
  #5  
Old 03-14-2009, 08:52 PM
cyan3 cyan3 is offline
Registered User
cyan3's Avatar
Join Date: Nov 2005
Location: England
Posts: 2,919
cyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant future
Nice work, it looks great
Reply With Quote
  #6  
Old 03-14-2009, 09:49 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
I like yours. Only thing is it might be a bit too large.
__________________
Reply With Quote
  #7  
Old 03-14-2009, 10:00 PM
Schetti Schetti is offline
SC2 Player
Schetti's Avatar
Join Date: Nov 2008
Location: Austria
Posts: 269
Schetti is on a distinguished road
Well
I have to learn how to use scrolls,
so I made it big eneugh for begin.
__________________
“Peace cannot be kept by force. It can only be achieved by understanding.” – Albert Einstein
Reply With Quote
  #8  
Old 03-14-2009, 11:15 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Angel_Light View Post
styling tip : With multiple vars that are being set to the same thing you can just use '='
That's the worst suggestion I've seen posted in a long time. For one, it would require you to edit the "max length" of all the variable as soon as you add a new variable that has a longer name then the previously longest one.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #9  
Old 03-14-2009, 11:41 PM
MiniOne MiniOne is offline
SomeOne
MiniOne's Avatar
Join Date: Dec 2006
Location: Australia
Posts: 1,145
MiniOne is on a distinguished road
Send a message via MSN to MiniOne
I think stefan stole your idea xD
__________________
Quote:
Originally Posted by Huwajux View Post
The pistols look like they have cancer, reduce the big buboe shaped thing's size.
Reply With Quote
  #10  
Old 03-15-2009, 01:23 AM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
I would suggest a GUI that can post the news to a file, and then load the text from that file in to the various tabbed panes.

I find that sticking to a single project and making it perfect is the best way to learn how to script.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #11  
Old 03-15-2009, 01:46 AM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by xXziroXx View Post
That's the worst suggestion I've seen posted in a long time. For one, it would require you to edit the "max length" of all the variable as soon as you add a new variable that has a longer name then the previously longest one.
I think he was refering to doing something like this:
temp.foo = temp.bar = 2;
However, I do agree with you.
Reply With Quote
  #12  
Old 03-15-2009, 02:29 AM
cyan3 cyan3 is offline
Registered User
cyan3's Avatar
Join Date: Nov 2005
Location: England
Posts: 2,919
cyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant future
Quote:
Originally Posted by Schetti View Post
Well
I have to learn how to use scrolls,
so I made it big eneugh for begin.
Correct me if I'm wrong but won't this make the gui scroll?

PHP Code:
new GuiScrollCtrl("MyGUI_MultiLine1_Scroll") {
      
profile GuiBlueScrollProfile;
      
height 800;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 800;
      
1;

      new 
GuiMLTextCtrl("MyGUI_MultiLine1") {
        
profile GuiBlueMLTextProfile;
        
height 16;
        
horizsizing "width";
        
text " News here";                                        

        
width 518;
       }
      }; 
Reply With Quote
  #13  
Old 03-15-2009, 03:19 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Quote:
Originally Posted by xXziroXx View Post
That's the worst suggestion I've seen posted in a long time. For one, it would require you to edit the "max length" of all the variable as soon as you add a new variable that has a longer name then the previously longest one.
I don't get the problem, it works great for me and I have never had a problem with it....
__________________
Deep into the Darkness peering...
Reply With Quote
  #14  
Old 03-15-2009, 07:20 AM
Schetti Schetti is offline
SC2 Player
Schetti's Avatar
Join Date: Nov 2008
Location: Austria
Posts: 269
Schetti is on a distinguished road
Quote:
Originally Posted by cyan3 View Post
Correct me if I'm wrong but won't this make the gui scroll?

PHP Code:
new GuiScrollCtrl("MyGUI_MultiLine1_Scroll") {
      
profile GuiBlueScrollProfile;
      
height 800;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 800;
      
1;

      new 
GuiMLTextCtrl("MyGUI_MultiLine1") {
        
profile GuiBlueMLTextProfile;
        
height 16;
        
horizsizing "width";
        
text " News here";                                        

        
width 518;
       }
      }; 
umm...
I dont think so.
I made a LOOOOONG text, and it just didnt show up anymore.

how to say ...

the text goes out of the news window and wont be showen.
__________________
“Peace cannot be kept by force. It can only be achieved by understanding.” – Albert Einstein
Reply With Quote
  #15  
Old 03-15-2009, 07:31 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
it'd be a good idea to name the GUI objects something useful rather than "ExampleWindow" and MyGUI_ScrollLine2 etc
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 09:31 PM.


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