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

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Hyperlinks to run scripts!
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Hyperlinks to run scripts!

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Ilyena   (6 posts)  [Biography] bio
Date Mon 05 Apr 2010 12:11 AM (UTC)
Message
I'm trying to display a hyperlink with a script that when clicked will then run a script in the same plug-in. I just can't get it to work.

It keeps sending information to the MUD rather than to the script.
[Go to top] top

Posted by Nick Gammon   Australia  (21,652 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 05 Apr 2010 02:52 AM (UTC)
Message
It can be done as documented here:

Template:function=Hyperlink Hyperlink

The documentation for the Hyperlink script function is available online. It is also in the MUSHclient help file.



You need the !! notation as explained halfway down that page. If you are already using that can you post exactly what you did? The syntax has to match fairly exactly what is explained there.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Ilyena   (6 posts)  [Biography] bio
Date Reply #2 on Mon 05 Apr 2010 02:57 AM (UTC)
Message
I have a function called 'Enque' (supposed to be enqueue, but bad spelling, eh). I wanted to pass in a string to that function as a parameter, but I understand that that would normally be as 'wildcards[1]' since it's normally coming from a trigger.

I have:

Hyperlink ("!!" .. pluginid .. ":Enque(skillName)", skillName, "Click to Add", "red", "black", 0)

at the moment, which sends the following to the MUD when I click on the link:

!!e1c7beb0cc624e2a68010fda:Enque(skillName)

[Go to top] top

Posted by Nick Gammon   Australia  (21,652 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Mon 05 Apr 2010 06:48 AM (UTC)
Message
I tested that and it seemed to work. What version of MUSHclient are you using?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Ilyena   (6 posts)  [Biography] bio
Date Reply #4 on Mon 05 Apr 2010 08:54 AM (UTC)
Message
I'm using 4.40. =\
[Go to top] top

Posted by Nick Gammon   Australia  (21,652 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Tue 06 Apr 2010 04:55 AM (UTC)
Message
Can you post a bit more of your script? It worked for me but depending on what was in pluginid and skillName maybe there is a problem there.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Ilyena   (6 posts)  [Biography] bio
Date Reply #6 on Tue 06 Apr 2010 08:58 AM (UTC)

Amended on Tue 06 Apr 2010 09:22 AM (UTC) by Ilyena

Message
--function to color skill list based on percentage, there may be a better way to do this, but I couldn't make a repeat-on-same-line trigger work properly
function Linker(name, line, wildcards)
-- first skill variables
skillName = wildcards[1]
spacing = wildcards[2]
percentage = wildcards[3]
-- second skill variables, if applicable
skillName2 = wildcards[4]
spacing2 = wildcards[5]
percentage2 =wildcards[6]
--third skill variables, if applicable
skillName3 =wildcards[7]
spacing3 =wildcards[8]
percentage3 =wildcards[9]

if (tonumber(percentage) == 0) then --color first skill based on percentage, 0 = red, 1-89 = orange, 90-100 = lime
pluginid = GetPluginID()
Hyperlink ("!!" .. pluginid .. ":Enque(skillName)", skillName, "Click to Add", "red", "black", 0)
-- ColourTell("red","", skillName..spacing..percentage.."%") -- Old code
elseif (tonumber(percentage) > 0) and (tonumber(percentage) < 90) then
ColourTell("orange","", skillName..spacing..percentage.."%")
else
ColourTell("lime","", skillName..spacing..percentage.."%")
end --if


I'm editing someone else's code here, but essentially the purpose is to try to get the 'practice' list from a MUD to show up as coloured hyperlinks, so that you can click on the hyperlink to add the skill to a queue to do something with it.
[Go to top] top

Posted by Nick Gammon   Australia  (21,652 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Tue 06 Apr 2010 11:21 PM (UTC)
Message
I don't get why that doesn't work. It is running in a plugin is it? Not just the main script file?

Can you change the word 'Hyperlink' to 'print' and then run it and show me the exact output? (That will tell us what Hyperlink is doing exactly).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Ilyena   (6 posts)  [Biography] bio
Date Reply #8 on Tue 06 Apr 2010 11:25 PM (UTC)

Amended on Wed 07 Apr 2010 12:39 AM (UTC) by Ilyena

Message
!!e1c7beb0cc624e2a68010fda:Enque(skillName) advanced electronics Click to Add red black 0



Yes. This is in an .xml plugin.
[Go to top] top

Posted by Ilyena   (6 posts)  [Biography] bio
Date Reply #9 on Tue 20 Apr 2010 11:02 PM (UTC)
Message
Hi. For some reason it is sending the commands rather than executing them. Is there any reason why it would do that?
[Go to top] top

Posted by Nick Gammon   Australia  (21,652 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Wed 21 Apr 2010 01:28 AM (UTC)
Message
No reason I can think of. I'd have to see the whole plugin to comment further.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Redryn   (15 posts)  [Biography] bio
Date Reply #11 on Sun 09 Jan 2011 07:40 AM (UTC)
Message
Hiya, apologies for digging up an old thread, but I've had a similar problem, and I think I found some extra information..

The problem seems somewhat reproducible, if the hyperlink contains more than 1 word, and the words are on different lines, and you click on the second word (not on first).

For example, I had:
Hyperlink
("!!507b81a882f5015779c84474:Execute("..mobspeedwalk..")", mobspeedwalk, "Execute "..mobspeedwalk.."" ,"green","black",0)
, where among other things mobspeedwalk had a value of
"Run 3s10e7nese;fstar;run 3s2e2ne3s"

Together, with the rest of the plugin, the script outputted to following:
Name: the prince               Area: Faerie Tales II     Roomname: In A Castle     Speedwalk: Run 
3s10e7nese;fstar;run 3s2e2ne3s


If I click on the part after run, (on new line), it will send
!!507b81a882f5015779c84474:Execute(Run 3s10e7nese;fstar;run 3s2e2ne3s).

If i click on the Run, it sends Run 3s10e7nese
fstar
run 3s2e2ne3s

It doesn't have an issue with the blank space, as some shorter values for mobspeedwalk that appear on 1 line can be clicked anywhere.

Hope that helps :)
[Go to top] top

Posted by Nick Gammon   Australia  (21,652 posts)  [Biography] bio   Forum Administrator
Date Reply #12 on Sun 09 Jan 2011 08:43 PM (UTC)
Message
Thanks for the detailed report. There was a bug in the way the line wrapped, in that the second line was marked as "MUD output" and not "script note" which caused the test for the "!!whatever" to fail. Fixed in version 4.72.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


8,750 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

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]