Hyperlink
Script function

world.Hyperlink

DOC_scripting Read about scripting

Type

Method

Summary

Creates a hyperlink in the output window

Prototype

void Hyperlink(BSTR Action, BSTR Text, BSTR Hint, BSTR TextColour, BSTR BackColour, BOOL URL);

DOC_data_types View list of data type meanings


Description

This lets you add a hyperlink to your output window (like a world.ColourTell). Because it is like a ColourTell you can precede or follow it by other text (by using ColourTell).

You can specify:

* An action (what is done) - this is what gets sent.
eg. "north", "http://www.gammon.com.au/"

* Link text (what the player sees, underlined)
eg. "go north", "Gammon Solutions web site"

* A hint (what appears if the mouse hovers over the hyperlink).
If empty, defaults to the action.

eg. "click to go north"

* A foreground colour
The text colour. If empty, defaults to the note text colour.
eg. "blue"

* A background colour. If empty, defaults to the note background colour.
eg. "black"

* Whether it is a URL or not - if not, the action is executed like a command, otherwise it is sent to your web browser.

If false, the action gets sent to the MUSHclient command parser, so it can be a simple command (eg. "eat food"), an alias (eg. "#chats"), a script (eg. '/world.note "hello" '), or a speedwalk.

If true, the action must start with "http://", "https://", or "mailto:" and if so, it is sent to the web browser.

From version 3.42 you can also call a script in a plugin from a Hyperlink:

The hyperlink "action" text has a special case, that if it is in this format:

!!pluginID:sub(arg)

... then the sub "sub" in the plugin with that ID will be called, passing the argument "arg".

For example:

world.Hyperlink "!!01245a24e83abd8552058478:nicktest(sigh)", "My test", "Click for my test", "yellow", "green", 0

In the example above we have:

Plugin ID = 01245a24e83abd8552058478
Sub to call = nicktest
Argument = sigh

Inside that plugin you might have a sub like this:

sub nicktest (arg)
world.note arg
end sub

Note that the brackets are required, so you would need: "sub()" if you wanted to pass no particular argument to the sub.

The argument will be passed as a string, so you don't need to quote it. It doesn't particularly matter if the argument contains brackets, as the processing of the argument simply starts at the first bracket, discards the last bracket, and sends everything inbetween (even if they are brackets).

For example:

world.Hyperlink "!!01245a24e83abd8552058478:nicktest(You say (hello))", "My test", "Click for my test", "yellow", "green", 0

The plugin is called using world.CallPlugin - see its description for more details.

Normally if you were using this inside a plugin, the plugin would find its own plugin ID, and then use that to generate the appropriate hyperlinks. eg. Inside a plugin you might do this:

world.Hyperlink "!!" & world.GetPluginID & ":mysub(North)", "Go North", "Click to go north", "yellow", "green", 0

... elsewhere in the plugin ...

sub mysub (arg)
world.send arg
end sub



VBscript example

world.Hyperlink "#chats", "Chat sessions", "Active chat sessions", "blue", "green", 0



Jscript example

Hyperlink ("#chats", "Chat sessions", "Active chat sessions", "blue", "green", 0);



PerlScript example

Hyperlink ("#chats", "Chat sessions", "Active chat sessions", "blue", "green", 0);



Python example

world.Hyperlink ("#chats", "Chat sessions", "Active chat sessions", "blue", "green", 0)



Lua example

Hyperlink ("#chats", "Chat sessions", "Active chat sessions", "blue", "green", 0)



Return value

Nothing.




See Also ...

Topic

DOC_note Notes

Functions

FNC_AnsiNote AnsiNote (Make a note in the output window from text with ANSI colour codes imbedded)
FNC_CallPlugin CallPlugin (Calls a routine in a plugin)
FNC_ColourNote ColourNote (Sends a message to the output window in specified colours)
FNC_ColourTell ColourTell (Sends a message to the output window in specified colours - not terminated by a newline)
FNC_DoAfterNote DoAfterNote (Adds a one-shot, temporary note timer - simplified interface)
FNC_GetNoteStyle GetNoteStyle (Gets the style for notes)
FNC_Note Note (Sends a note to the output window)
FNC_NoteHr NoteHr (Draws a horizontal rule in the output window)
FNC_NoteStyle NoteStyle (Sets the style for notes)
FNC_SetNotes SetNotes (Sets the notes for the world.)
FNC_Tell Tell (Sends a message to the output window - not terminated by a newline)

(Help topic: function=Hyperlink)

DOC_contents Documentation contents page