Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-04-2012, 02:10 PM
jamitsu89 jamitsu89 is offline
Registered User
Join Date: Jun 2011
Posts: 27
jamitsu89 is an unknown quantity at this point
GuiScrollCtrl - Getting max y pos

Is there a way to check the maximum Y position of a Gui Scroll Control?

Think Client RC. If chat scroll is at the bottom when more text is added, it scrolls down and shows it, whereas if scroll bar is up a tad, it doesn't scroll down to encompass the new text - it simply stays where it is.

EDIT- Nobody knows how to get a similar effect to the Client RC?

Last edited by jamitsu89; 03-04-2012 at 09:52 PM..
Reply With Quote
  #2  
Old 03-09-2012, 11:22 AM
jamitsu89 jamitsu89 is offline
Registered User
Join Date: Jun 2011
Posts: 27
jamitsu89 is an unknown quantity at this point
Well, in case anyone else also has this problem, I'll post my solution:
Graal Script Code:
temp.origposition GuiScrollCtrl.scrollpos;

GuiScrollCtrl.scrolltobottom();

temp.maxposition GuiScrollCtrl.scrollpos;



if (
temp.origposition[1] < temp.maxposition[1])

  
GuiScrollCtrl.scrollTo(temp.origposition[0], temp.origposition[1]); 
An unfortunate work around, and doesn't always work, but seems the only way.
Reply With Quote
  #3  
Old 03-09-2012, 04:26 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Try this:

Graal Script Code:
//#CLIENTSIDE
function onRCChat() {
  
GuiChatScroll.scrolltobottom();

You'll have to replace the GUI object's name obviously.
__________________
Quote:
Reply With Quote
  #4  
Old 03-09-2012, 09:55 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
Quote:
Originally Posted by fowlplay4 View Post
Try this:

Graal Script Code:
//#CLIENTSIDE
function onRCChat() {
  
GuiChatScroll.scrolltobottom();

You'll have to replace the GUI object's name obviously.
I think what he's trying to do instead is make a GuiScrollCtrl scroll to the bottom when the height increases only when it was already scrolled to the bottom.
__________________
Reply With Quote
  #5  
Old 03-09-2012, 09:59 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
I feel like that would trigger a GuiScrollControl.onResize() and you can do the same thing there.

Graal Script Code:
//#CLIENTSIDE
function GuiScrollControl.onResize() { 
  
GuiScrollControl.scrolltobottom();

__________________
Quote:
Reply With Quote
  #6  
Old 03-09-2012, 10:09 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
Quote:
Originally Posted by fowlplay4 View Post
I feel like that would trigger a GuiScrollControl.onResize() and you can do the same thing there.

Graal Script Code:
//#CLIENTSIDE
function GuiScrollControl.onResize() { 
  
GuiScrollControl.scrolltobottom();

Except the problem is he only wants to scroll down if it's already scrolled to the bottom. If someone chats in RC but you've scrolled up, it doesn't automatically scroll down for you (that would be annoying).
__________________
Reply With Quote
  #7  
Old 03-09-2012, 11:16 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
This is how I did it in the Client RC (copied/pasted directly out of the script):

Graal Script Code:
    // Changed this so RC will scroll back to 
    // normal position. -Tig
    
    // Store the old position before adding text
    
temp.oldpos ScriptedRCScroll.scrollpos;
    
    
// Need to get the position of scroll when it's
    // at the bottom
    
ScriptedRCScroll.scrollToBottom();
    
temp.maxscroll ScriptedRCScroll.scrollpos[1];
    
    
ScriptedRCRCchat.text @= "\n" temp.data;
        
    
// If the scroll wasn't at the bottom, then don't
    // scroll to back to the bottom.
    
if (temp.oldpos[1] != temp.maxscroll) {
      
ScriptedRCScroll.scrollTo(temp.oldpos[0], temp.oldpos[1]);
    } else {
      
ScriptedRCScroll.scrollToBottom();
    }
    
    
// Check to see if the text is bigger than the scroll
    // viewing window, if not, scrolltobottom.
    // Makes sure it will move the scroll down to the bottom
    // if there was previously no scroll showing.
    
if (ScriptedRCRCchat.clientheight ScriptedRCScroll.clientheight ScriptedRCRCchat.profile.getTextHeight()) {
      
ScriptedRCScroll.scrollToBottom();
    } 
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #8  
Old 03-09-2012, 11:37 PM
jamitsu89 jamitsu89 is offline
Registered User
Join Date: Jun 2011
Posts: 27
jamitsu89 is an unknown quantity at this point
Ah lovely, thanks a lot Tig.
And cheers for responding, Jer and Chris.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:22 AM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.