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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
Talmark
Novice


Joined: 22 Nov 2003
Posts: 34

PostPosted: Wed Oct 06, 2004 7:59 am   

A Quick Text Highlighter
 
This is a quick way to highlight text. Say you're looking for an object and have to run around a lot to find it. Just enter it into the highlighter and you'll see it right away. I find new uses for it all the time.

There are only two commands.

hl <text>
hl

It works like a toggle. When you want to highlight something, just type:

hl bastard sword

To stop highlighting, just type it again:

hl bastard sword

and bastard sword will no longer be highlighted.

To see a list of all the strings you are currently highlighting, just type:

hl


Code:

#CLASS {Highlight}
#ALIAS hl {
  #GAG
  #IF {%null( %-1)} {
    #SH %cr
    #IF {%null( @hl)} {#SH Nothing is currently being highlighted.} {
      #SH The following strings are currently being highlighted:
      #FOR %sort( @hl) {#SH %i}
      }
    #ABORT 1
    }
  #IF {%ismember( %-1, @hl)} {
    #UNTRIGGER {%-1} Highlight
    #DELI hl {%-1}
    #SH %-1 is no longer being highlighted.
    } {
    #ADDI hl {%-1}
    #TR {%-1} {#CW orange} Highlight
    #SH %-1 is now being highlighted.
    }
  }
#CLASS 0
Reply with quote
Talmark
Novice


Joined: 22 Nov 2003
Posts: 34

PostPosted: Thu Oct 14, 2004 7:59 pm   
 
Here's an improved version of the above script. It does the same thing without creating a new trigger for each string highlighted, since that was completely unnecessary.

Code:

#CLASS {Highlight}
#ALIAS hl {
  #IF {%null( %-1)} {
    #SH %cr
    #IF {%null( @hl)} {#SH Nothing is currently being highlighted.} {
      #SH The following strings are currently being highlighted:
      #FOR %sort( @hl) {#SH %i}
      }
    #ABORT 1
    }
  #IF {%ismember( %-1, @hl)} {
    #DELI hl {%-1}
    #SH %-1 is no longer being highlighted.
    } {
    #ADDI hl {%-1}
    #SH %-1 is now being highlighted.
    }
  }
#VAR hl {}
#TRIGGER {{@hl}} {#CW orange}
#CLASS 0
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts 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