GetStyleInfo
Script function world.GetStyleInfo Read about scripting Type Method Summary Gets details about a specified style run for a specified line in the output window Prototype `VARIANT GetStyleInfo(long LineNumber, long StyleNumber, short InfoType);` View list of data type meanings Description `Returns details about any style run for any line in the output buffer (window). The line number can be from 1 (the first line) to the number of lines in the output window. You can use "world.GetLinesInBufferCount" to find how many lines are currently in the output window. The style number can be from 1 (the first style on the line) to the number of styles in that line. You can use "world.GetLineInfo(LineNumber, 11)" to find the number of styles in each line. You can obtain one of 15 "types" of information about the style by specifying an "InfoType". The possible InfoTypes are: 1: text of style (string) 2: length of style run (short) 3: starting column of style (short) 4: action type - 0=none, 1=send to mud, 2=hyperlink, 3=prompt (short) 5: action (eg. what to send) (string) 6: hint (what to show) (string) 7: variable (variable to set) (string) 8: true if bold (boolean) 9: true if underlined (boolean) 10: true if blinking (boolean) 11: true if inverse (boolean) 12: true if changed by trigger from original (boolean) 13: true if start of a tag (action is tag name) (boolean) 14: foreground (text) colour in RGB (long) 15: background colour in RGB (long) You could use this function to "reassemble" lines with ANSI codes or other markup, by putting appropriate codes around each style run. For instance, if the "bold" flag was set, you might use <b> ... </b> . The "action type", "action", "hint" and "variable" fields are used by MXP. See the MXP write-ups on the MUSHclient forum for more detail about what they are used for. The colour codes are in RGB - you could use NormalColour or BoldColour to work out which ANSI colour they corresponded to (note, they might not correspond to any ANSI colour if MXP, or world.note has been used to output non-standard colours).` VBscript example
    ' find foreground colour in RGB of style 2 on line 100

    world.note world.GetStyleInfo (100, 2, 14)
Jscript example
    // find foreground colour in RGB of style 2 on line 100

    world.note (world.GetStyleInfo (100, 2, 14));
PerlScript example
    # find foreground colour in RGB of style 2 on line 100

    $world->note ($world->GetStyleInfo (100, 2, 14));
Python example
    # find foreground colour in RGB of style 2 on line 100

    world.note (world.GetStyleInfo (100, 2, 14))
Lua example
    -- find foreground colour in RGB of style 2 on line 100

    Note (GetStyleInfo (100, 2, 14))

    -- display the text for style 2 on line 71

    Note (GetStyleInfo (71) [2].text)

    -- Same thing, done differently:

    Note (GetStyleInfo (71, 2).text)
Lua notes
    Lua returns nil where applicable instead of an "empty variant" or "null variant".

    As an extension, you can supply zero for the StyleNumber and/or the InfoType.

    If the StyleNumber is zero, then a table of all styles will be returned
    (keyed numerically starting at one).

    If the InfoType is omitted or zero, then all types of information
    for the nominated style are returned in a table, keyed by type:

     text:       text of style (string)
     length:     length of style run (number)
     column:     starting column of style run (number)
     actiontype: action type - 0=none, 1=send to mud, 2=hyperlink, 3=prompt
     action:     action (eg. what to send) (string)
     hint:       hint (what to show) (string)
     variable:   variable (variable to set) (string)
     bold:       true if bold (boolean)
     ul:         true if underlined (boolean)
     blink:      true if blinking (boolean)
     inverse:    true if inverse (boolean)
     changed:    true if changed by trigger from original (boolean)
     starttag:   true if start of a tag (action is tag name) (boolean)
     textcolour: foreground (text) colour in RGB (number)
     backcolour: background colour in RGB (number)

    This lets you readily re-assemble data from a particular line with only one
    function call. Then just process the returned table.

    If you omit (or set to zero) both the StyleNumber and InfoType then the
    returned result will be a table of tables. The outer table will have one entry
    per style, the inner table will have one entry per InfoType.

    Example:

    t = GetStyleInfo (71)     -- get all styles, all types for line 71
    for k, v in pairs (t) do
      Note ("style run = ", k)  -- this is one style
      for a, b in pairs (v) do  -- display all info types for style
        Note (" item = ", a, " value = ", b)
      end
    end
Return value
    The specified information about the style run, as described above.
    An EMPTY variant, if the line or style does not exist.
    A NULL variant if the InfoType is not a valid type.
See Also ... Topic Information Functions BoldColour (Gets/sets the RGB colour for one of the 8 ANSI bold colours) Debug (Displays debugging information about the world) EchoInput (A flag to indicate whether we are echoing command input to the output window) GetConnectDuration (Returns the number of seconds this world has been connected.) GetEntity (Retrieves the value of an MXP server-defined entity) GetHostAddress (Returns a list of IP addresses that correspond to a host name on the Internet) GetHostName (Returns the host name that corresponds to an IP address on the Internet) GetInfo (Gets information about the current world) GetInternalCommandsList (Returns a list of the internal MUSHclient command names) GetLineCount (Gets count of lines received) GetLineInfo (Gets details about a specified line in the output window) GetLinesInBufferCount (Returns the number of lines in the output window) GetMainWindowPosition (Returns the position and size of the main MUSHclient window) GetNotepadWindowPosition (Returns the position and size of the specified notepad window) GetNotes (Gets the world's notes) GetQueue (Returns a variant array which is a list of queued commands) GetReceivedBytes (Returns the number of bytes received from the world) GetRecentLines (Assembles a block of text from recent MUD output) GetSelectionEndColumn (Returns the endling column of the selection in the output window) GetSelectionEndLine (Returns the last line of the selection in the output window) GetSelectionStartColumn (Returns the starting column of the selection in the output window) GetSelectionStartLine (Returns the starting line of the selection in the output window) GetSentBytes (Returns the number of bytes sent to the world) GetSysColor (Gets the colour of various windows items) GetSystemMetrics (Returns selected system information from Windows) GetWorldID (Returns the 24-character ID of the current world) GetWorldWindowPosition (Returns the position and size of the current world window) GetWorldWindowPositionX (Returns the position and size of a specific world window) GetXMLEntity (Retrieves the value of a standard entity) IsConnected (Tests to see if the world is connected to the MUD server) NormalColour (Gets/sets the RGB colour for one of the 8 ANSI normal colours) SetChanged (Sets or clears the "document has changed" flag) SetEntity (Sets the value of an MXP entity) UdpPortList (Returns an array of all the UDP ports in use by this world) Version (Gets the MUSHclient version string.) WorldAddress (Returns the TCP/IP address of the current world.) WorldName (Gets the world's name) WorldPort (Returns the port number of the current world.) (Help topic: function=GetStyleInfo) Documentation contents page