Difference between revisions of "CMud WikiSearch"

From AvatarWiki
Jump to navigation Jump to search
(Wiki Search Script)
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
This trigger opens your default web browser to an AvatarWiki search of your selected text when you choose an option from the right-click menu. It also removes articles (the, an, a) at the beginning of search terms as per wiki standards.<BR>
 +
[[Image:Wikisearch.jpg]]
 +
 +
== The Script ==
 +
 
Save the following code as an .xml file, and import it into Cmud:
 
Save the following code as an .xml file, and import it into Cmud:
  
Line 16: Line 21:
 
       <caption>Search for '%selected' on AvatarWiki</caption>
 
       <caption>Search for '%selected' on AvatarWiki</caption>
 
       <value>#VAR wikistring %selected;
 
       <value>#VAR wikistring %selected;
#IF {%begins( @wikistring, "an ")} {#VAR wikistring %remove( "an ", @wikistring)};
+
#IF %begins( @wikistring, "an ") {#VAR wikistring %remove( "an ", @wikistring)};
 
#IF %begins( @wikistring, "a ") {#VAR wikistring %remove( "a ", @wikistring)};
 
#IF %begins( @wikistring, "a ") {#VAR wikistring %remove( "a ", @wikistring)};
#IF {%begins( @wikistring, "the ")} {#VAR wikistring %remove( "the ", @wikistring)};
+
#IF %begins( @wikistring, "the ") {#VAR wikistring %remove( "the ", @wikistring)};
 
#IF %begins( @wikistring, "A ") {#VAR wikistring %remove( "A ", @wikistring)};
 
#IF %begins( @wikistring, "A ") {#VAR wikistring %remove( "A ", @wikistring)};
 
wiki @wikistring</value>
 
wiki @wikistring</value>
 
     </menu>
 
     </menu>
     <var name="wikistring"> </var>
+
     <var name="wikistring">grand serpent hood</var>
 
   </class>
 
   </class>
 
</cmud>
 
</cmud>
  
 
</pre>
 
</pre>
 +
 +
== Usage ==
 +
 +
Just select some text in the mud, right click on it and choose the "Search for 'x' on AvatarWiki" option. For single word searches, just right click the word, no need to select it.<BR>
 +
 +
You can also do manual searches by typing wiki followed by your search term in quotations.<br> EX: <tt>wiki "search requirements"</tt>
 +
 +
Updated for CMud v3.32.
  
 
[[Category: Cmud Scripting]]
 
[[Category: Cmud Scripting]]

Latest revision as of 11:26, 4 December 2010

This trigger opens your default web browser to an AvatarWiki search of your selected text when you choose an option from the right-click menu. It also removes articles (the, an, a) at the beginning of search terms as per wiki standards.
Wikisearch.jpg

The Script

Save the following code as an .xml file, and import it into Cmud:


<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <class name="wikisearch">
    <alias name="wiki">
      <value>#URL http://avatar.melanarchy.info/index.php/Special:Search?search=%1</value>
    </alias>
    <menu priority="290">
      <caption>Search for '%selword' on AvatarWiki</caption>
      <value>#URL http://avatar.melanarchy.info/index.php/Special:Search?search=%selword</value>
    </menu>
    <menu priority="300">
      <caption>Search for '%selected' on AvatarWiki</caption>
      <value>#VAR wikistring %selected;
#IF %begins( @wikistring, "an ") {#VAR wikistring %remove( "an ", @wikistring)};
#IF %begins( @wikistring, "a ") {#VAR wikistring %remove( "a ", @wikistring)};
#IF %begins( @wikistring, "the ") {#VAR wikistring %remove( "the ", @wikistring)};
#IF %begins( @wikistring, "A ") {#VAR wikistring %remove( "A ", @wikistring)};
wiki @wikistring</value>
    </menu>
    <var name="wikistring">grand serpent hood</var>
  </class>
</cmud>

Usage

Just select some text in the mud, right click on it and choose the "Search for 'x' on AvatarWiki" option. For single word searches, just right click the word, no need to select it.

You can also do manual searches by typing wiki followed by your search term in quotations.
EX: wiki "search requirements"

Updated for CMud v3.32.