Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   GuiScrollCtrl question (https://forums.graalonline.com/forums/showthread.php?t=62616)

prozac424242 12-02-2005 09:40 PM

GuiScrollCtrl question
 
I have been researching the Gui commands on the wiki, and this is all I could find for the scroll box:
PHP Code:

    GuiScrollCtrl (GuiControl):
      
childmargin string
      constantthumbheight 
boolean
      hscrollbar 
string
      scrollpos 
string
      tile 
boolean
      vscrollbar 
string
      wheelscrolllines 
integer
      willfirstrespond 
boolean
      scrolldelta
(intint)
      
scrollto(intint

Based on that, and some othe gui commands, I was able to put this together:
The window contains the scollbox, and the scrollbox contains the text
PHP Code:

//#CLIENTSIDE

// by Prozac
// replaces the welcome server pm, so that everyone -with v4- will see it without
// having to click on the pm in the playerlist.

//with scroll window

function onCreated()
       {

      new 
GuiWindowCtrl("San_welcome")
          {
        
//profile = "GuiMLWindowProfile";
        
position "0 0";
           
width 440;
           
height400;
        
extent "440 400";
        
canMove true;
        
canResize canMaximize canClose true;
        
tile true;
        
text "Sanstrata Classic Welcome Message";
        
visible true;


   new 
GuiScrollCtrl(Scrollbox)
     {
      
position "5 24";
      
extent "430 380";
      
childmargin ="5";
      
constantthumbheight true;
      
hscrollbar "red";
      
scrollpos "gray";
      
tile true;
      
vscrollbar "hi there";
      
wheelscrolllines 400;
      
willfirstrespond false;
      
scrolldelta(100500);
      
scrollto(300500);

        new 
GuiMLTextCtrl("Welcome_msg2"
            {
          
position "0 0";
          
extent "431 473";
          
horizSizing "width";
          
vertSizing "height";
          
text "<body bgcolor=black><sbreak><shadow:1:1><shadowcolor:000000><br> I want the whole background to be black but this box will not expand downwards except for how much text you put into it<br><br><br><br><br><br><br><br>and I dont want to resort to br tags";
           }

      }
   }
 } 

But the problem is that the text extent height cannot be forced to a pixel width, it just wraps around for however much text is there, and the amount of text may vary depending on what the welcome message is. I did not find any docuemtation on how to make the window or scroll areas a different color. I can only change the color of the text area, and the text area is not going to be a constant size.

If someone knows how to please help fix this so that the whole background of the scroll/window area is always black, that would be great. (oh look! I asked nicely! :D )

ApothiX 12-04-2005 01:29 AM

Quote:

Originally Posted by prozac424242
If someone knows how to please help fix this so that the whole background of the scroll/window area is always black, that would be great. (oh look! I asked nicely! :D )

PHP Code:

new GuiWindowProfile(MySexyWindowProfile) { .. }
new 
GuiScrollProfile(MySexyScrollProfile) { .. } 

?

Yen 12-07-2005 01:55 AM

GuiScrollCtrl is based off the GuiControl object. It can use all variables you see under GuiControl, such as x, y, width, and height. Use them. :]

x-x Sorry, sleep deprived Yen didn't notice the main question.
Focusing on the scroll, there are many things you did wrong:


PHP Code:

hscrollbar "red";
vscrollbar "hi there"

{v,h}ScrollBar = "alwaysOn", "alwaysOff", "dynamic";
alwaysOn is default, the scroll bar is always showing.
alwaysOff hides the scroll bar at all times.
dynamic only makes the scroll bar appear if you can scroll down.

PHP Code:

scrollpos "gray"

scrollpos is how many pixels horizontally/vertically the scroll bars have been scrolled.
scrollpos = "0 0"; scrolls to the top-left; the first value is the horizontal bar, the second value is the vertical bar.

PHP Code:

tile true

Okay, this is part of the Scroll's profile. The profile is what the scroll looks like, such as the image, whether or not it's tiled, the color it's tinted, ect.
To modify this, you can create a new profile for any NPC to use by doing
PHP Code:

new GuiControlProfile(Name) {
  
bitmap "defaultscroll.png";
  
tile true;
  
transparency 1;
  
blue 1;
  
red 0;
  
green 0;


With this, you can use 'profile = "Name"' in all your scroll controls to give them the same properties.

Alternatively, you can use 'useownprofile = true;'
This allows you to modify the profile of just that one Gui Control.
PHP Code:

useownprofile true;
profile.tile true;
profile.blue 1;
profile.green 1;
profile.red 1

The only thing is that some of the default attributes of the scroll, such as the image, are wiped. You'll have to use 'profile.image = "defaultscroll.png"'


Good luck, I've tried playing with scroll profiles, but I found them confusing.. I think they need more support, such as the ability to use an image for the border.. Unless they already have it.

prozac424242 12-07-2005 06:48 AM

Thank you Yen for this very helpful information.

What was your resoruce for all that knowledge?
Becasue I was unable to find that level of description of what the paramaters are on the wiki. Please hook me up with the resource you used to learn that.

napo_p2p 12-07-2005 07:19 AM

Quote:

Originally Posted by prozac424242
What was your resoruce for all that knowledge?
Becasue I was unable to find that level of description of what the paramaters are on the wiki. Please hook me up with the resource you used to learn that.

I only know such things from looking at the code Stefan released (RC weapons, Level editor, etc).

HTML Code:

vscrollbar = "hi there";
One of my favorite lines of code. :cool:

ApothiX 12-07-2005 04:20 PM

Quote:

Originally Posted by napo_p2p
I only know such things from looking at the code Stefan released (RC weapons, Level editor, etc).

HTML Code:

vscrollbar = "hi there";
One of my favorite lines of code. :cool:

I agree.

And regarding the profiles, you should use GuiScrollCtrlProfile, not GuiControlProfile.

Yen 12-10-2005 12:17 AM

I learned by trial and error.
And common sense.
And looking at the RC.
But mostly trial and error.


All times are GMT +2. The time now is 05:23 AM.

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