[Home] [Downloads] [Search] [Help/forum]

MUSHclient scripting

Description of MUSHclient world function: world.SetScroll

Name SetScroll
Type Method
Summary Sets the scroll bar position, and hides or shows it
Prototype long SetScroll(long Position, BOOL Visible);

View list of data type meanings


This lets you do two things:

* Hide the existing scroll bar if desired
* Set the "scroll position" in the output window

The first feature (hiding the scroll bar) lets you, well, hide it, so that you can draw your own wherever you want (eg. with a themed miniwindow somewhere near where the text appears).

The second feature lets your code scroll the text around (so you can still use the existing output buffer) in response to the player clicking and dragging on "your" thumb, or arrows.

A position of -1 means "the end of the window" (which is the number of lines multiplied by the size of the font, less the size of the output window).

A position of -2 means "no change".

You can use GetInfo (296) to find the current scroll-bar position (and thus add or subtract from it, to scroll up or down small amounts (like a line or a page).

You can use GetInfo (120) to find if the scroll-bar is currently hidden or not.

The existing code adds the font height (GetInfo (212)) to the current scroll position to scroll downwards a line, and subtracts it to scroll up a line.

To scroll up or down pages you need to find the size of the output window text rectangle, and add or subtract that.

Note: Available in version 4.60 onwards.

Lua example
SetScroll (0, false)  -- hide scroll bar, go to top of window
SetScroll (-1, false) -- hide scroll bar, go to end of window

SetScroll (-2, false) -- hide scroll bar, do not change position
SetScroll (-2, true)  -- show scroll bar, do not change position
Lua notes
The Visible flag is optional and defaults to true.
Returns eOK - success

View list of return code meanings

Introduced in version 4.60

See also ...

Function Description
GetInfo Gets information about the current world

Search for script function

Enter a word or phrase in the box below to narrow the list down to those that match.

The function name, prototype, summary, and description are searched.

Search for:   

Leave blank to show all functions.

Return codes

Many functions return a "code" which indicates the success or otherwise of the function.

You can view a list of the return codes

Function prototypes

The "prototype" part of each function description lists exactly how the function is called (what arguments, if any, to pass to it).

You can view a list of the data types used in function prototypes

View all functions


Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]