Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-04-2012, 03: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 10:52 PM..
Reply With Quote
  #2  
Old 03-09-2012, 12:22 PM
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:
PHP 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, 05: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:

PHP 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, 10: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:

PHP 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, 10: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.

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

__________________
Quote:
Reply With Quote
  #6  
Old 03-09-2012, 11: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.

PHP 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-10-2012, 12:16 AM
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):

PHP 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-10-2012, 12:37 AM
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


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 12:42 AM.


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