|
Yasden Beginner
Joined: 19 Mar 2005 Posts: 17 Location: TorilMUD
|
Posted: Thu Apr 28, 2005 4:14 am
http:// and www. |
I'm looking for code that will work for 4.62/7.05 that will underline and activate text on your output window based on an http:// or www.* string...i.e. I want to be able to single or double click on these to open them, and drag the mouse over them to underline.
Any of you supergurus that can make this happen? :D
Thanks in advance! |
|
|
|
Aarlot Adept
Joined: 30 Dec 2003 Posts: 226
|
Posted: Thu Apr 28, 2005 7:04 am |
This:
#TRIGGER {({http://|www.})(%x)} {#SUBSTITUTE {~<a "%1%2"~>%1%2~</a~>}} "" {notrig}
Would work, as long as there is a space or a linebreak right after the web address. You could probably tweak it in some way to make it work otherwise, but I don't have time tonight. |
|
_________________ Everyone is entitled to their beliefs - until they die. Then only the truth matters. |
|
|
|
Yasden Beginner
Joined: 19 Mar 2005 Posts: 17 Location: TorilMUD
|
Posted: Thu Apr 28, 2005 8:18 pm |
Thanks for the code! Anyone else wanna suggest how to make it where you don't have to have the space right after? :D
Example: Most of the time a url is given through a comm line as a single statement.
You say 'www.google.com'
You OOC: 'www.google.com'
You tell Bob 'www.google.com'
I guess basically what I'm trying to ask is how do you make zMUD ignore that ' after the url if it's there? I could write a second trigger but I'd rather learn something new. :P |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Apr 28, 2005 11:29 pm |
Well, for 7.05 you could probably do it with #PSUB.
#trigger {You say '(%*)'} {#psub blah, blah, blah}
Quote: |
I want to be able to single or double click on these to open them, and drag the mouse over them to underline.
|
This is impossible. Hyperlinks in ZMud are ALWAYS underlined. Clicking on it will execute the code, and I believe double-clicking will execute the code twice. To get this functionality, you'd somehow have to intercept the mouse-click, do your stuff, and then return control to ZMud. This is definitely not something the average savvy zmud user will even begin to understand. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Yasden Beginner
Joined: 19 Mar 2005 Posts: 17 Location: TorilMUD
|
Posted: Fri Apr 29, 2005 12:10 am |
I didn't realize the mouseover automatically underlined the text...this works as I had hoped.
However, when trying to color the #sub, the url link gets twisted somehow...when I click "www.google.com" it turns into "www.google.com&&www.google.com"
Here's a snippet of the change I made:
Code: |
#TRIGGER {({http://|www.})(%x)} {#SUBSTITUTE {~<a "%1%2"~><color orange>%1%2~</color></a~>}} "" {notrig}
|
Any way to fix this so the link is displayed in orange and doesn't get changed? *lol*
***FIXED***
Just moved the initial color switch to the beginning, and the /color to the end!
Code: |
#TRIGGER {({http://|www.})(%x)} {#SUBSTITUTE {~<color orange>~<a "%1%2"~>%1%2~</a~></color~>}} "" {notrig}
|
|
|
|
|
|
|