Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Lua
➜ Hyperlinks to run scripts!
|
Hyperlinks to run scripts!
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Ilyena
(6 posts) 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. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Mon 05 Apr 2010 02:52 AM (UTC) |
| Message
| It can be done as documented here:
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 | | Top |
|
| Posted by
| Ilyena
(6 posts) 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)
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) 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 | | Top |
|
| Posted by
| Ilyena
(6 posts) Bio
|
| Date
| Reply #4 on Mon 05 Apr 2010 08:54 AM (UTC) |
| Message
| |
| Posted by
| Nick Gammon
Australia (23,173 posts) 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 | | Top |
|
| Posted by
| Ilyena
(6 posts) 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. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) 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 | | Top |
|
| Posted by
| Ilyena
(6 posts) 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. | | Top |
|
| Posted by
| Ilyena
(6 posts) 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? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) 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 | | Top |
|
| Posted by
| Redryn
(15 posts) 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 :) | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) 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 | | 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.
42,932 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top