Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   News-Window (https://forums.graalonline.com/forums/showthread.php?t=84684)

xXziroXx 03-15-2009 11:50 AM

Quote:

Originally Posted by Angel_Light (Post 1474639)
I don't get the problem, it works great for me and I have never had a problem with it.... x_x

Then you're just overcomplicating something that should be simple. :D

Angel_Light 03-15-2009 12:14 PM

Quote:

Originally Posted by xXziroXx (Post 1474700)
Then you're just overcomplicating something that should be simple. :D

lol, xD I think I understand what you mean, but it seems repetitive have several vars being set to the same value over and over, while you could just set all the values once.

Quote:

Originally Posted by Schetti (Post 1474682)
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.

that means your MLText width is bigger than window width, try reducing, I usually take the gui width and - 20 for inner texts widths (compensation for the vscrollbar)

salesman 03-15-2009 04:30 PM

I don't think you guys are referring to the same thing.

(?)Angel_Light is referring to this as good practice:
PHP Code:

temp.foo temp.bar temp.yay 42

(?)and Ziro is referring to this as crappy styling:
PHP Code:

temp.foo     3;
temp.bar     7;
temp.yai     10;
temp.crapthisoneislongerthantherest 20;
temp.nowihavetoreadjustallofthepreviousspacing "frown"

Correct me if I'm wrong.

Angel_Light 03-15-2009 06:22 PM

Quote:

Originally Posted by salesman (Post 1474748)
I don't think you guys are referring to the same thing.

(?)Angel_Light is referring to this as good practice:
PHP Code:

temp.foo temp.bar temp.yay 42

(?)and Ziro is referring to this as crappy styling:
PHP Code:

temp.foo     3;
temp.bar     7;
temp.yai     10;
temp.crapthisoneislongerthantherest 20;
temp.nowihavetoreadjustallofthepreviousspacing "frown"

Correct me if I'm wrong.

That's what I'm talking about...

Codein 03-15-2009 06:48 PM

Either way, I prefer doing it like this:

PHP Code:

temp.var1 true;
temp.var2 true;
temp.var3 true

so then I can easily do, say, temp.var2 = false, without having to mess around.

Angel_Light 03-15-2009 08:10 PM

Quote:

Originally Posted by Codein (Post 1474784)
Either way, I prefer doing it like this:

PHP Code:

temp.var1 true;
temp.var2 true;
temp.var3 true

so then I can easily do, say, temp.var2 = false, without having to mess around.

styling choice really. although they both produce the same results. =P

Codein 03-16-2009 11:36 PM

Quote:

Originally Posted by Angel_Light (Post 1474811)
styling choice really. although they both produce the same results. =P

I'd say it was a choice between "Waste time once or waste time multiple times later", but that's just my honest opinion. Only really good, in my opinion (opinion being key here), for when you're assigning multiple variables (see example), but, even still, I don't like doing that.

PHP Code:

temp.var = 3;
temp.var2 temp.var3 temp.var1


Deas_Voice 03-17-2009 08:21 PM

okey, we get it, stop argue about it! x_x

Schetti 03-26-2009 03:14 PM

With Scroll, FINALLY!
 
1 Attachment(s)
Now with scroll, smaller and also position = {}; extent = {}; stuff and better names(NewsTab etc.).
Also, if you want to use it(for those who didnt know)
Save it for example under -System/News
and after that, open the script for Control-NPC and add this
PHP Code:

function onActionPlayerOnline(){
  
addweapon("-System/News");


And this is the Final News-Window
PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
NewsWindow = new GuiWindowCtrl("NewsWindow");
  
  
with (NewsWindow)
  {
    
profile     "GuiBlueWindowProfile"
    
position    "640 390";
    
extent      "380 380";
    
canMove     true
    
canResize   false
    
canMaximize false
    
canClose    true
    
tile        true
    
text        "News"
    
    new 
GuiControl(NewsTab)
    {
      
visible    false;
      
profile    "GuiBlueControlProfile";
      
position   "10 52";
      
extent     "360 310";
      
    new 
GuiScrollCtrl("NewsScroll") {
      
profile GuiBlueScrollProfile;
      
position = { 510};
      
extent = { 350300};
      
hscrollbar "alwaysOff";
      
vscrollbar "alwaysOn";


    new 
GuiMLTextCtrl("NewsList") { 

         
profile GuiBlueMLTextProfile;
         
extent = { 51832};   
        
horizsizing "width";
text "
Insert News here ^^
        "
;                                            

      };
    }
    };
    
    new 
GuiControl(HiringsTab)
    {
      
visible    false;
      
profile    "GuiBlueControlProfile";
      
position   "10 52";
      
extent     "360 310";
      
    new 
GuiScrollCtrl("HiringsScroll") {
      
profile GuiBlueScrollProfile;
      
position = { 510};
      
extent = { 350300};
      
hscrollbar "alwaysOff";
      
vscrollbar "alwaysOn";


    new 
GuiMLTextCtrl("HiringsList") {
        
profile GuiBlueMLTextProfile
        
horizsizing "width";
extent = { 34732};
text "
Insert Hirings stuff here ^^

        "
;    
       
      };
    }
    };
    
    new 
GuiControl(StaffTab)
    {
      
visible    false;
      
profile    "GuiBlueControlProfile";
      
position   "10 52";
      
extent     "360 310";
      
    new 
GuiScrollCtrl("StaffScroll") {
      
profile GuiBlueScrollProfile;
      
position = { 510};
      
extent = { 350300};
      
hscrollbar "alwaysOff";
      
vscrollbar "alwaysOn";


    new 
GuiMLTextCtrl("StaffList") {
        
profile GuiBlueMLTextProfile
        
horizsizing "width";
        
position = { xy};
        
extent = { 34732};
text "
Insert staff list here ^^
"
;    
       
      };
    }
    };
    
    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"Staff"))
      {
        
this.pane StaffTab;
      }
      
      
thiso.catchevent(name"onSelect""onTabSelect");
    };
  };
  
ExampleTabs.setSelectedById(0);
  
GraalControl.addControl(NewsWindow);
}

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



xfazex 03-31-2009 03:39 AM

Errors from this script:

PHP Code:

ScriptCouldn't create object: type GuiWindowCtrl is not existing at line 4 in script of -System/News
Script: Couldn'
t create objecttype GuiControl is not existing at line 18 in script of -System/News
Script
Couldn't create object: type GuiScrollCtrl is not existing at line 25 in script of -System/News
Script: Couldn'
t create objecttype GuiMLTextCtrl is not existing at line 33 in script of -System/News
Script
: Function addcontrol not found at line 33 in script of -System/News
Script
: Function addcontrol not found at line 25 in script of -System/News
Script
: Function addcontrol not found at line 18 in script of -System/News
Script
Couldn't create object: type GuiControl is not existing at line 44 in script of -System/News
Script: Couldn'
t create objecttype GuiScrollCtrl is not existing at line 51 in script of -System/News
Script
Couldn't create object: type GuiMLTextCtrl is not existing at line 59 in script of -System/News
Script: Function addcontrol not found at line 59 in script of -System/News
Script: Function addcontrol not found at line 51 in script of -System/News
Script: Function addcontrol not found at line 44 in script of -System/News
Script: Couldn'
t create objecttype GuiControl is not existing at line 70 in script of -System/News
Script
Couldn't create object: type GuiScrollCtrl is not existing at line 77 in script of -System/News
Script: Couldn'
t create objecttype GuiMLTextCtrl is not existing at line 85 in script of -System/News
Script
: Function addcontrol not found at line 85 in script of -System/News
Script
: Function addcontrol not found at line 77 in script of -System/News
Script
: Function addcontrol not found at line 70 in script of -System/News
Script
Couldn't create object: type GuiTabCtrl is not existing at line 96 in script of -System/News 


Schetti 04-09-2009 06:45 PM

lawl, maybe I shouldnt "edit" the script and just post the one I use:


If this doesnt work, I should stop scripting
PHP Code:

//Made by Schetti
/* useful Codes:
<b>text</b>
<u>text</u>
<i>text</i>
<center>text</center>
*/

//#CLIENTSIDE
function onCreated()
{
  
NewsWindow = new GuiWindowCtrl("NewsWindow");
  
  
with (NewsWindow)
  {
    
profile     "GuiBlueWindowProfile"
    
position    "640 390";
    
extent      "380 380";
    
canMove     true
    
canResize   false
    
canMaximize false
    
canClose    true
    
tile        true
    
text        "Supernova-News"
    
    new 
GuiControl(NewsTab)
    {
      
visible    false;
      
profile    "GuiBlueControlProfile";
      
position   "10 52";
      
extent     "360 310";
      
    new 
GuiScrollCtrl("NewsScroll") {
      
profile GuiBlueScrollProfile;
      
position = { 510};
      
extent = { 350300};
      
hscrollbar "alwaysOff";
      
vscrollbar "alwaysOn";


    new 
GuiMLTextCtrl("NewsList") { 

         
profile GuiBlueMLTextProfile;
         
extent = { 51832};   
        
horizsizing "width";
text "
<u><b>Schetti:</b></u>
I am working on our mine system,
but it needs GFX!

<u><b>Lucas:</b></u>
Finally we got tailor (Schetti
made it,much thanks to he for that) 
to open it say /tailor.

<u><b>Schetti:</b></u>
The newswindow is fixed now.
We are working on some quests now.

<u><b>Schetti:</b></u>
I am is working on a new Event. 
I hope it works
"
;                                            

      };
    }
    };
    
    new 
GuiControl(HiringsTab)
    {
      
visible    false;
      
profile    "GuiBlueControlProfile";
      
position   "10 52";
      
extent     "360 310";
      
    new 
GuiScrollCtrl("HiringsScroll") {
      
profile GuiBlueScrollProfile;
      
position = { 510};
      
extent = { 350300};
      
hscrollbar "alwaysOff";
      
vscrollbar "alwaysOn";


    new 
GuiMLTextCtrl("HiringsList") {
        
profile GuiBlueMLTextProfile
        
horizsizing "width";
extent = { 34732};
text "
We are currently under construction and we hire every kind of staff 
exept FAQ/GP and ET.

<b>WE HARDLY NEED SCRIPTERS(NAT)!
Just send us 2-3 of your best scripts.</b>

If you're interested write an E-Mail to:
                                         
[email protected]
or  [email protected]
                                                                                                       
with some of your levels, ganis or what ever you make at your job                 
and some personal stuff like: 
your experience on other servers, 
why you want to be staff here, 
and why do you think we should take you 
instead of another applicant.

LATs can contact Schetti or Lucas3 if they are online.
We might give you OnlineEditor so you can show us what you can.

You also can say 
/latapply  or
/gfxapply



<b>IMPORTAND!</b>
Please dont write an apply, if you aren't Gold.
        "
;    
       
      };
    }
    };
    
    new 
GuiControl(StaffTab)
    {
      
visible    false;
      
profile    "GuiBlueControlProfile";
      
position   "10 52";
      
extent     "360 310";
      
    new 
GuiScrollCtrl("StaffScroll") {
      
profile GuiBlueScrollProfile;
      
position = { 510};
      
extent = { 350300};
      
hscrollbar "alwaysOff";
      
vscrollbar "alwaysOn";


    new 
GuiMLTextCtrl("StaffList") {
        
profile GuiBlueMLTextProfile
        
horizsizing "width";
        
position = { xy};
        
extent = { 34732};
text "
*Owner*
Lucas3

*CO-Owner*
<b>needed</b>  

*Manager*
<b>needed</b> 
                                                                                                                                                                
*Developer*
PowerProNL
tstre

*GFX*
<b>needed</b>

*LAT*
Schetti
Valtor
sonnfel"
;    
       
      };
    }
    };
    
    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"Staff"))
      {
        
this.pane StaffTab;
      }
      
      
thiso.catchevent(name"onSelect""onTabSelect");
    };
  };
  
ExampleTabs.setSelectedById(0);
  
GraalControl.addControl(NewsWindow);
}

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



devilsknite1 04-09-2009 08:55 PM

I'd suggest using
PHP Code:

NL 

on your text = ""; line. NL means Next Line.

It would look something like this:
PHP Code:

text "hi" NL "<b><u><font color=000000>black font that's bold and underlined!</font></u></b>" NL "weee"

Not sure if I'm right, but just doing enter's won't create new lines. If it does, then cool, you can keep doing it that way and ignore what I said :D
I guess it's personal preference, though. It just might free up some space in that script.

[email protected] 04-09-2009 09:06 PM

Or you can use
HTML Code:

text = "hi\n lol hi new line\n again";

fragman85 04-09-2009 09:13 PM

Quote:

Originally Posted by [email protected] (Post 1482576)
Or you can use
HTML Code:

text = "hi\n lol hi new line\n again";

That's also how linebreaks get saved in DBs btw. :o


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

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