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


Register forum user name Search FAQ

MUSHclient scripting

Description of MUSHclient world function: world.GetInfo


Name GetInfo
Type Method
Summary Gets information about the current world
Prototype VARIANT GetInfo(long InfoType);
Description

Gets details about the current world. You can use:

Debug ("info")

... to list the descriptions corresponding to each one (and their current values), inside MUSHclient.

You can obtain various "types" of information about the world by specifying an "InfoType". The possible InfoTypes are:

(strings - configuration)

1 - Server name (IP address)
2 - World name
3 - Character name
4 - Send to world - file preamble
5 - Send to world - file postamble
6 - Send to world - line preamble
7 - Send to world - line postamble
8 - World notes
9 - Sound on new activity
10 - Scripts editor
11 - Log file preamble
12 - Log file postamble
13 - Log file line preamble - player input
14 - Log file line preamble - notes
15 - Log file line preamble - MUD output
16 - Log file line postamble - player input
17 - Log file line postamble - notes
18 - Log file line postamble - MUD output
19 - Speed Walk Filler
20 - Output window font name
21 - Speed walk prefix
22 - Text sent on connecting
23 - Input font name
24 - Paste to world - file preamble
25 - Paste to world - file postamble
26 - Paste to world - line preamble
27 - Paste to world - line postamble
28 - Scripting language
29 - Script function for world open
30 - Script function for world close
31 - Script function for world connect
32 - Script function for world disconnect
31 - Script function for world get focus
32 - Script function for world lose focus
35 - Script file name
36 - Scripting prefix
37 - Auto-say string
38 - Auto-say override
39 - Tab-completion defaults
40 - Auto-log file name
41 - Recall window - line preamble
42 - Terminal ID (telnet negotiation)
43 - Mapping failure message
44 - Script function for MXP starting up
45 - Script function for MXP closing down
46 - Script function for MXP error
47 - Script function for MXP tag open
48 - Script function for MXP tag close
49 - Script function for MXP variable set
50 - Sound to play for beeps

(strings - calculated at runtime)

51 - Current log file name
52 - Last "immediate" script expression
53 - Current status line message
54 - World file pathname
55 - World title
56 - MUSHclient application path name
57 - World files default path (directory)
58 - Log files default path (directory)
59 - Script files default path (directory)
60 - Plugin files default path (directory)
61 - World TCP/IP address (as string, after DNS lookup, eg. 10.0.0.16)
62 - Proxy server TCP/IP address (as string, after DNS lookup, eg. 10.0.0.22)
63 - Host name (name of this PC)
64 - Current directory
65 - Script function for world save
66 - MUSHclient application directory
67 - World file directory
68 - MUSHclient startup (initial) directory
69 - Translation file
70 - Locale
71 - Font used for fixed-pitch dialogs
72 - MUSHclient version (eg. "4.11")
73 - MUSHclient compilation date/time (eg. "Jul 25 2007 14:21:10")
74 - Default sounds file directory (presently GetInfo (66) + "sounds/")
75 - Last telnet subnegotiation string received
76 - Special font pathname
77 - Windows version debug string (eg. "Service Pack 2")
78 - Foreground image name
79 - Background image name
80 - libpng version (eg. "1.2.31")
81 - libpng header (eg. " libpng version 1.2.31 - August 21, 2008")
82 - Preferences database pathname
83 - SQLite3 database version
84 - File-browsing directory
85 - Plugins state file directory
86 - Word under mouse on mouse menu click
87 - Last command sent to the MUD


(booleans - calculated at runtime)

101 - 'No Echo' flag
102 - Debug incoming packets
103 - Decompressing
104 - MXP active
105 - Pueblo active
106 - Disconnected flag (true if not connected)
107 - Currently-connecting flag
108 - OK-to-disconnect flag
109 - Trace flag
110 - Script file changed
111 - 'World file is modified' flag
112 - Automapper active flag
113 - 'World is active' flag
114 - 'Output window paused' flag
115 - Localization active
116 / 117 - removed
118 - Variables have changed
119 - Script engine is active
120 - Scoll bar is (wanted to be) visible for output window
121 - High-resolution timer is available
122 - Is the SQLite3 library thread-safe?
123 - Are we currently processing a "Simulate" function call?
124 - Is the current line from the MUD being omitted from output?
125 - Is the client in full-screen mode?

(numbers (longs) - calculated at runtime)

201 - Total lines received
202 - Lines received but not yet seen (new lines)
203 - Total lines sent
204 - Packets received
205 - Packets sent
206 - Total uncompressed bytes received
207 - Total compresssed bytes received
208 - MCCP protocol in use (0=none, 1 - or 2)
209 - MXP error count
210 - MXP tags received
211 - MXP entities received
212 - Output font height
213 - Output font width
214 - Input font height
215 - Input font width
216 - Total bytes received
217 - Total bytes sent
218 - Count of variables
219 - Count of triggers
220 - Count of timers
221 - Count of aliases
222 - Count of queued commands
223 - Count of mapper items
224 - Count of lines in output window
225 - Count of custom MXP elements
226 - Count of custom MXP entities
227 - Connect phase:
(0=not connected, 1=MUD name lookup, 2=Proxy server name lookup,
3=connecting to MUD, 4=connecting to proxy server, 5=proxy server phase 1,
6=proxy server phase 2, 7=proxy server phase 3, 8=connected to MUD)
228 - World TCP/IP address (after DNS lookup, as a number)
229 - Proxy server TCP/IP address (after DNS lookup, as a number)
230 - Script execution depth
231 - Log file size (0 if no log file open)
232 - High-performance counter output (in seconds) (double)
233 - Time spent executing trigger matching (double)
234 - Time spent executing alias matching (double)
- note: see GetScriptTime function for the time taken to execute scripts
235 - Number of world windows open
236 - First column of the selection in the command window (1-relative)
- if no selection, the column to the right of the cursor.
- If the cursor is at the start of the window, it will return 1.
237 - Last column of the selection in the command window (1-relative)
- if no selection, returns 0.
- For example, if "abcd" is in the command window and "bc" is selected then
- GetInfo (236) will return 2 and GetInfo (237) will return 3.
238 - Current "show state" for the first world window of this world.
Hide = 0
Shownormal = 1
Normal = 1
Showminimized = 2
Showmaximized = 3
Maximize = 3
Shownoactivate = 4
Show = 5
Minimize = 6
Showminnoactive= 7
Showna = 8
Restore = 9
Showdefault = 10

239 - The "source" of the current scripted action.

It is intended for scripters who want to know if a particular script is running because of user (player) action, or some sort of automated response. Effectively this can be used to determine if the player is AFK or not.

The returned value will be a number in the range 0 to 10, with these meanings:

UnknownActionSource = 0 --> no particular reason, could be plugin saving
UserTyping = 1 --> user typed something in the command area and pressed <Enter>
UserMacro = 2 --> user typed a macro (eg. F2)
UserKeypad = 3 --> user used the numeric keypad
UserAccelerator = 4 --> user used an accelerator key
UserMenuAction = 5 --> item chosen from pop-up menu
TriggerFired = 6 --> trigger fired
TimerFired = 7 --> timer fired
InputFromServer = 8 --> input arrived (eg. packet received)
WorldAction = 9 --> some sort of world action (eg. world open, connect, got focus)
LuaSandbox = 10 --> executing Lua sandbox

Effectively, if GetInfo (239) returns a number in the range 1 to 5 inclusive, then the script is running in response to direct player input. Other numbers would indicate automated processing like a trigger or timer firing, input from the MUD, a plugin callback being called, and so on.

There is no entry in the list above for an alias being called, because aliases can be triggered by user input, "send to script (Execute function)", macros and so on. Thus, the number above would indicate the "real" reason an alias was called.

240 - The average width, in pixels, of a character in the output window, in the current output font. This figure is used when calculating how many characters would fit in the current width of the output window.

241 - The height, in pixels, of a character in the output window, in the current output font.

242 - Count of lines that had bad UTF-8 sequences in them, and were thus not considered for trigger evaluation (long)

243 - Font size of fixed pitch font
244 - Count of number of triggers that were evaluated (long)
245 - Count of number of triggers that matched (long)
246 - Count of number of aliases that were evaluated (long)
247 - Count of number of aliases that matched (long)
248 - Count of number of timers that fired (long)

249 - Main frame window height (long)
250 - Main frame window width (long)
251 - Main toolbar window height (long)
252 - Main toolbar window width (long)
253 - Game toolbar window height (long)
254 - Game toolbar window width (long)
255 - Activity toolbar window height (long)
256 - Activity toolbar window width (long)
257 - Info bar window height (long)
258 - Info bar window width (long)
259 - Status bar window height (long)
260 - Status bar window width (long)
261 - World window non-client height (long)
262 - World window non-client width (long)
263 - World window client height (long)
264 - World window client width (long)
265 - Windows major version (long) -- see below
266 - Windows minor version (long)
267 - Windows build number (long)
268 - Windows platform ID (long)
269 - Foreground image mode
270 - Background image mode
271 - Background colour
272 - Text rectangle - left (see TextRectangle function)
273 - Text rectangle - top
274 - Text rectangle - right
275 - Text rectangle - bottom
276 - Text rectangle - border offset
277 - Text rectangle - border width
278 - Text rectangle - outside colour
279 - Text rectangle - outside style
280 - Output window client height
281 - Output window client width
282 - Text rectangle - border colour
283 - Mouse position - X (relative to world output window)
284 - Mouse position - Y
285 - Is output window available? (true or false)
286 - Triggers matched this session (long)
287 - Aliases matched this session (long)
288 - Timers fired this session (long)
289 - Last line number that was terminated by an IAC/GA or IAC/EOR (long)
290 - Actual text rectangle - left (see below)
291 - Actual text rectangle - top
292 - Actual text rectangle - right
293 - Actual text rectangle - bottom
294 - Status of keyboard modifiers / mouse click, as follows:

(values are in hexadecimal)

0x00001 - shift key down (left or right)
0x00002 - control key down (left or right)
0x00004 - Alt key down (left or right)

0x00008 - left shift key down
0x00010 - right shift key down

0x00020 - left control key down
0x00040 - right control key down

0x00080 - left Alt key down
0x00100 - right Alt key down

0x00200 - Caps Lock key down (right now)
0x00400 - Num Lock key down (right now)
0x00800 - Scroll Lock key down (right now)

0x02000 - Caps Lock key toggled (active)
0x04000 - Num Lock key toggled (active)
0x08000 - Scroll Lock key toggled (active)

0x10000 - Left mouse button down
0x20000 - Right mouse button down
0x40000 - Middle mouse button down

More than one of these can be active at once so you should use a bitwise "and"
operation to check each bit (eg. bit.band in Lua).

295 - Number of times output window was redrawn
296 - Current vertical position of scroll bar in first output window (long)
297 - Resolution (frequency) of the high-resolution timer
298 - SQLite3 version number (eg. 3007002 for version 3.7.2.)
299 - ANSI code-page number (see below)
300 - OEM code-page number (see below)

(dates - calculated at runtime)

301 - Time connected
302 - Time log file was last flushed to disk
303 - When script file was last modified
304 - The current date/time
305 - When client started executing
306 - When this world was created/opened

(more numbers)

310 - Newlines received from the MUD (lines terminated by a newline)



You can deduce the operating system as follows by using GetInfo (265) through to GetInfo (268):

If platform ID == 0 (Win32s) then:
you should not get this, MUSHclient doesn't run under Win32s

If platform ID == 1 (Windows 95-style versions) then:

If major == 4 and minor == 0 then: Windows 95
If major == 4 and minor == 10 then: Windows 98 (or 98SE)
If major == 4 and minor == 90 then: Windows ME

If platform ID == 2 (Windows NT versions) then:

If major == 3 then: Windows NT 3.51
If major == 4 then: Windows NT 4
If major == 5 and minor == 0 then: Windows 2000
If major == 5 and minor == 1 then: Windows XP
If major == 5 and minor == 2 then: Windows Server 2003
If major == 6 and minor == 0 then: Windows Vista, or Windows Server Longhorn
If major == 6 and minor == 1 then: Windows 7
If major == 6 and minor == 2 then: Windows 8
If major == 6 and minor == 3 then: Windows 8.1
If major == 10 and minor == 0 then: Windows 10


(The symbol "==" means "is equal to").

----

The "actual text rectangle" (selectors 290 to 293) give the offset of the text rectangle inside the main output window, taking into account the TextRectangle function (if used). However unlike selectors 273 to 276 these will always be the correct pixel offsets. For example, if TextRectangle has never been called, then 273 to 276 will all be zero, whereas 290 to 293 will have the coordinates of the text rectangle. Also if negative offsets are used for the bottom or right sides, then these are "normalized" into actual offsets for selectors 290 to 293. Thus you can use 290 to 293 for finding exactly where the text is on the screen (these figures may change if the window is resized).

----

ANSI code page numbers:

874 Thai
932 Japan
936 Chinese (PRC, Singapore)
949 Korean
950 Chinese (Taiwan Region; Hong Kong SAR, PRC)
1200 Unicode (BMP of ISO 10646)
1250 Windows 3.1 Eastern European
1251 Windows 3.1 Cyrillic
1252 Windows 3.1 Latin 1 (US, Western Europe)
1253 Windows 3.1 Greek
1254 Windows 3.1 Turkish
1255 Hebrew
1256 Arabic
1257 Baltic

OEM code page numbers:

437 MS-DOS United States
708 Arabic (ASMO 708)
709 Arabic (ASMO 449+, BCON V4)
710 Arabic (Transparent Arabic)
720 Arabic (Transparent ASMO)
737 Greek (formerly 437G)
775 Baltic
850 MS-DOS Multilingual (Latin I)
852 MS-DOS Slavic (Latin II)
855 IBM Cyrillic (primarily Russian)
857 IBM Turkish
860 MS-DOS Portuguese
861 MS-DOS Icelandic
862 Hebrew
863 MS-DOS Canadian-French
864 Arabic
865 MS-DOS Nordic
866 MS-DOS Russian (former USSR)
869 IBM Modern Greek
874 Thai
932 Japan
936 Chinese (PRC, Singapore)
949 Korean
950 Chinese (Taiwan Region; Hong Kong SAR, PRC)
1361 Korean (Johab)


Note: Available in version 3.18 onwards.


VBscript example
'
'  List the lot
'

dim i, info

for i = 1 to 320
  info = world.GetInfo (i)
  if not isnull (info) then
   world.note i & " = " & info
  end if
next

'
' Find world IP address
'

Note GetInfo (1)
Jscript example
//
//  display all information
//

for (i = 1; i <= 320; i++)
  {
  info = world.GetInfo (i);
  if (info)
    world.Note (i + " = " + info);
  }
PerlScript example
#
#  Display world IP address
#

$world->note ($world->GetInfo (1));
Python example
#
#  display all information
#

for i in range (320):
  info = world.GetInfo (i)
  if (info):
    world.Note (str(i) + " = " + str(info))
Lua example
--
--  display all information
--

for i = 1, 320 do
  info = GetInfo(i)
  if info then
    Note (i, " = ", info)
  end
end
Returns The specified information about the world, as described above.
An EMPTY variant, if a date is undefined.
A NULL variant if the InfoType is not a valid type.
Introduced in version 3.18

See also ...

Function Description
Debug Displays debugging information about the world
GetAliasInfo Gets details about an alias
GetTimerInfo Gets details about a timer
GetTriggerInfo Gets details about a named trigger

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

[Back]

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.

[Home]


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 HostDash]