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

MUSHclient scripting

Description of MUSHclient world function: world.GetCommandList

Name GetCommandList
Type Method
Summary Returns some or all commands from the command history
Prototype VARIANT GetCommandList(long Count);

View list of data type meanings


This returns a variant array of the nominated number of most recent commands (in the command history window).

You can get all available commands by requesting a count of zero. (You can get the most recently saved command by requesting a count of 1).

If you request more than the available number, then the number of items in the array may be less than that requested.

You can get the current command (not yet in the command history list) by using world.GetCommand.

Note: Available in version 3.18 onwards.

VBscript example
dim commandList
dim iCount

' Get last 10 commands
  commandList = world.GetCommandList (10)

  If Not IsEmpty (commandList) Then
    For Each command In commandList  
      world.Note command 
  End If

' ------------------------

' Get most recent command

  world.note world.getcommandlist (1) (0)
Jscript example
// Get last 10 commands
  commandList = new VBArray(world.GetCommandList (10)).toArray();

  if (commandList) 
    for (i = 0; i < commandList.length; i++)
        world.note (commandList [i]);
PerlScript example
#  Get last 10 commands

foreach $item (Win32::OLE::in ($world->GetCommandList (10)))
Python example
# Get last 10 commands

commandList = world.GetCommandList (10)
if (commandList ):
  for c in commandList : world.Note (c)
Lua example
-- Get last 10 commands

for k, v in ipairs (GetCommandList (10)) do 
  print (k, v)   --> command number, what the command was
Returns If there are no commands in the history list then the return value is empty. Use "IsEmpty" to test for this possibility.

Otherwise, it returns a variant array containing the specified number of commands (counting from the most recent). Use "ubound" to find the number of commands in the list.
Introduced in version 3.18

See also ...

Function Description
GetCommand Gets the current command in the command window
PushCommand Pushes the current command into the command history list
SelectCommand Selects (highlights) the current command in the command window
SetCommand Sends text to the command window

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]