Register forum user name Search FAQ

Gammon Forum

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 ➜ Plugins ➜ Hyperlink_URL2.xml -- Line wrapping error.

Hyperlink_URL2.xml -- Line wrapping error.

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


Posted by NanbanJim   (2 posts)  Bio
Date Tue 27 Jan 2009 10:32 PM (UTC)
Message
Consider: With a standard linewidth of 80 characters and the Plugin "Hyperlink_URL2.xml" enabled. MUSHclient receives:
> think Blah http://testtesttesttesttesttesttesttesttesttesttesttesttesttesttest http://test2test2test2test2test2

MUSHclient notices the single line is too long, makes it 2 lines. You get "Blah http://test" and so on on the first line, and the shorter "http://test2" and so on on the second line. Normal behaviour, and Hyperlink_URL2 doesn't have a problem. However, if the first link itself causes MUSHclient to linewrap/make another line, and if there is another URL on the same wrapped line, such as:

> think Blah blahblah blah blah http://testtesttsttesttesttesttesttesttesttesttesttesttesttesttest blah http://testtesttesttesttest

You get as output:
---Start Output---

Blah blahblah blah blah http://testtesttsttesttesttesttesttesttesttesttesttesttesttesttest
blah Run-time error
Plugin: Hyperlink_URL2 (called from world: A Cleverly Named MUSH)
Function/Sub: OnHyperlink called by trigger
Reason: processing trigger ""
[string "Plugin"]:62: attempt to concatenate field '?' (a nil value)
stack traceback:
[string "Plugin"]:62: in function <[string "Plugin"]:1>
Error context in script:
58 :
59 : for x, y in pairs (newstyle) do -- x is the style number, y is the style-data table.
60 : NoteStyle (y.style)
61 : if y.hypernumber ~= nil then
62*: Hyperlink(hyperlinks[y.hypernumber], y.text, "Go to " .. hyperlinks[y.hypernumber]
63 : , RGBColourToName(y.textcolour), RGBColourToName(y.backcolour), 1)
64 : else
65 : ColourTell (RGBColourToName(y.textcolour), RGBColourToName(y.backcolour), y.text)
66 : end

---End Output---
Or alternately an error box, but that's not so easy to copy-paste. ;) In any event, Hyperlink_URL2 not only ceases to function until you close and re-open that world, but any line that has a URL on it gets replaced with bright red "Trigger function "OnHyperlink" not found or had a previous error."

Suggesting one of:
1.) Change this "replace with bright red error message" behaviour.
2.) Re-load the plugin or scripting engine on error (since sometimes you get this error from the MOTD or other uncontrollable circumstance when you first open a game, but may never encounter the above sort of situation unless you log out and log back in again).
3.) Update Hyperlink_URL2 to not be confused by MUSHclient's line wrapping. (I tried, but couldn't even figure out how to address the issue of "when is a line not a line." Meep.)

Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 27 Jan 2009 11:03 PM (UTC)
Message
I didn't write that one, and got a bit confused looking at it, but this seems to fix the reported problem ...

In the middle of the plugin, look for these lines:


function OnHyperlink (name, line, wildcards, styles)
 
  hyperlinks = {}
  newstyle = {}
  i = 1
  hyperlinkcount = 0
  doingURL = 0


Change to:


function OnHyperlink (name, line, wildcards, styles)
 
  local hyperlinks = {}
  local newstyle = {}
  local i = 1
  local hyperlinkcount = 0
  local doingURL = 0


It seems the function recurses, I am not sure why. However making its variables local seems to fix the problem.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Tue 27 Jan 2009 11:09 PM (UTC)

Amended on Tue 27 Jan 2009 11:10 PM (UTC) by Nick Gammon

Message
The amended plugin is now uploaded to the plugins page.

Oh, and thanks for the detailed error report. That is exactly the sort of stuff we like to see. :)

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by NanbanJim   (2 posts)  Bio
Date Reply #3 on Tue 27 Jan 2009 11:54 PM (UTC)
Message
... I'm floored. Wow. 31 minute turnaround? Thank you so much! I didn't even expect it to be looked at for days (I wouldn't have, it's someone else's code)!

I guess that just goes to show, time spent troubleshooting never goes to waste; even if you find yourself at a dead end, someone else may be able to pick up where you left off.

Thanks again!
Top

Posted by ThumpieBunnyEve   (10 posts)  Bio
Date Reply #4 on Thu 14 May 2009 10:32 PM (UTC)
Message

MUSHclient v4.37


world: "tapestries"
tapestries (dot) fur (dot) com
porttwozerosixnine

issue:
Web URL http: www hypertext links were not "clickable".

resolution:
Installed plugin:
Plugin name: Hyperlink_URL2
id: 520bc4f29806f7af0017985f

ISSUE:
This plug in seems to be making links underlined and clickable. But there is no way to change there color? they are the same color as the test on the line provided.

request:
How do i alter the color of highlighted links with this plug in? Or.. if abandoning this plug in, how do i activate link highlighting with version MUSHclient v4.37??
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #5 on Fri 15 May 2009 07:23 AM (UTC)
Message
This is really a new topic, right?

Edit the plugin file with a text editor. Near the bottom you will find the lines:


 Hyperlink(hyperlinks[y.hypernumber], y.text, "Go to " .. hyperlinks[y.hypernumber]
               , RGBColourToName(y.textcolour), RGBColourToName(y.backcolour), 1)


It deliberately tries to keep the existing colours. To change that, put in the foreground and background colours you want, eg.


 Hyperlink(hyperlinks[y.hypernumber], y.text, "Go to " .. hyperlinks[y.hypernumber]
               , "blue", "black", 1)


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by ThumpieBunnyEve   (10 posts)  Bio
Date Reply #6 on Fri 15 May 2009 11:00 AM (UTC)
Message
Thank you. And yes i appended my seemingly new topic to this older one, because it addresses the same Plug-in, and it's updates, which you made. This keeps the topics together for the sake of congeniality. :}

In short, it seemed relevant. *^-^*


now, furthering my prior question, in hopes of furthering my own understanding of how XML plugins interact with MushClient, I've 3 more questions i would like to ask.

[Q.1]
Would the following also work?
 Hyperlink(hyperlinks[y.hypernumber], y.text, "Go to " .. hyperlinks[y.hypernumber]
               , "#8daaf0", "#000000", 1)


[Q.2]
Would the following work to set the link colors to this worlds "Custom 8" color set?
               , Custom8.textcolour, Custom8.backcolour, 1)


[Q.3]
Can this XML access variables stored in this worlds scripting variables section, to look something like this:
               , ScriptVar.LinkColor.textcolour, ScriptVar.LinkColor.backcolour, 1)




I'm sure my formatting is off, as I'm entirely new to this, and I'm just trying to look at all this logically to get some idea of what's going on inside. But i hope you can follow my 3 questions above, as I'm struggling just to understand my options.

And thank you for your diligent response time.
As well as your contribution to the Mush community.
This is a really nice program, with the options I've been longing for. Thank you, Thank you, Thank you!
~tbe
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #7 on Fri 15 May 2009 08:57 PM (UTC)
Message
Quote:

Would the following also work?

Hyperlink(hyperlinks[y.hypernumber], y.text, "Go to " .. hyperlinks[y.hypernumber]
, "#8daaf0", "#000000", 1)


Yes that will work.

Quote:

Would the following work to set the link colors to this worlds "Custom 8" color set?

, Custom8.textcolour, Custom8.backcolour, 1)


No, but you can use GetCustomColourName and GetCustomColourBackground to get the custom colours:

http://www.gammon.com.au/scripts/doc.php?function=GetCustomColourName

eg.


    , GetCustomColourName (8), GetCustomColourBackground (8), 1)


Quote:

Can this XML access variables stored in this worlds scripting variables section, to look something like this:

, ScriptVar.LinkColor.textcolour, ScriptVar.LinkColor.backcolour, 1)


Not quite like that, but you can access the main world's scripting variables with GetPluginVariable and using an empty string as the plugin ID.

http://www.gammon.com.au/scripts/doc.php?function=GetPluginVariable

eg.


    , GetPluginVariable ("", "textcolour"), GetPluginVariable ("", "backcolour"), 1)


- 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.


21,573 views.

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

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.