Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Yasden
Beginner


Joined: 19 Mar 2005
Posts: 17
Location: TorilMUD

PostPosted: 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!
Reply with quote
Aarlot
Adept


Joined: 30 Dec 2003
Posts: 226

PostPosted: 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.
Reply with quote
Yasden
Beginner


Joined: 19 Mar 2005
Posts: 17
Location: TorilMUD

PostPosted: 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
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
Yasden
Beginner


Joined: 19 Mar 2005
Posts: 17
Location: TorilMUD

PostPosted: 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}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net