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

Hyperlink

Script function

world.Hyperlink

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);

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). Also, as it is like a ColourTell you should eventually wrap up the line with a Note or similar to "end the line".

You can specify:

* An action (what is done) - this is what gets sent. If URL is true it is sent to your web browser, otherwise it is sent to "Execute", that is the MUSHclient command processor.

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" (as a string).

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)
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)
Send arg
End Sub

------------------

WARNING!

Do not use the Hyperlink function in a script called by "sendto:script" from a trigger, if that trigger omits from output. The mechanism for preserving the "noted" output does not preserve hyperlinks. Use "sendto:script (after omit") instead.


Available in MUSHclient version 3.41 onwards.



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)


Lua notes

Lua has a 7th optional argument: NoUnderline.

If true, the hyperlink is not underlined. It defaults to false.


Return value

Nothing.


See Also ...

Topic

Notes

Functions

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

(Help topic: function=Hyperlink)

Documentation contents page


Search ...

Enter a search string to find matching documentation.

Search for:   

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