Advertisement
Guest User

Untitled

a guest
Dec 31st, 2008
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.53 KB | None | 0 0
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE muclient [
  3. <!ENTITY actions_command "rc" >
  4. ]>
  5.  
  6.  
  7. <muclient>
  8. <plugin name="Random_Actions"
  9. author="Maketa"
  10. language="vbscript"
  11. id = "982a81eaaaba28aa527eec80"
  12. purpose = "Displays a random action when a specific trigger happens"
  13. save_state = "y"
  14. version = "1.1"
  15. >
  16. <description trim="y">
  17. <![CDATA[
  18.  
  19.  
  20. Commands (v1.1)
  21. ---------------
  22. ra:help - shows this description in the output window
  23. ra:add X - adds X to the command list
  24. ra:remove X - removes X from the command list
  25. ra:axe it all - clears the entire list
  26. ra:list - lists your actions
  27. ra:match X - modifies match text to X
  28. ]]>
  29. </description>
  30. </plugin>
  31.  
  32. <!-- Get our standard VB constants -->
  33. <include name="constants.vbs"/>
  34.  
  35.  
  36. <!-- Initialization stuff -->
  37. <script>
  38. <![CDATA[
  39. dim ActionsList ' store list of actions
  40. Randomize ' Initialize random-number generator.
  41. dim rcMatch
  42. rcMatch = world.getvariable ("actionMatch")
  43. ]]>
  44. </script>
  45.  
  46. <!-- =============================================
  47.  
  48. Trigger: Random_Action
  49. Script: DoRandomAction
  50. Purpose: Does your action (randomly)action
  51.  
  52. ============================================= -->
  53.  
  54. <triggers>
  55. <trigger
  56. script="DoRandomAction"
  57. match="*"
  58. expand_variables="y"
  59. enabled="y"
  60. >
  61. </trigger>
  62. </triggers>
  63. <script>
  64. <![CDATA[
  65. Sub DoRandomAction (sName, sLine, wildcards)
  66. if rcMatch = "" then
  67. exit sub
  68. end if
  69. if wildcards(1) = rcMatch then
  70. ActionsList = split (world.getvariable ("actions")," ")
  71. If UBound(ActionsList) > -1 Then
  72. Dim randAction
  73. Dim loopX
  74. loopX = 0
  75. randAction = ""
  76. Do Until randAction <> "" or loopX > 9
  77. randAction = ActionsList ( Rnd * Ubound (ActionsList))
  78. loopX = loopX + 1
  79. Loop
  80. if loopX > 9 then
  81. world.note "You shouldn't be seeing this message - if you do, harass Maketa to fix it somehow."
  82. end if
  83. World.Send randAction
  84. Else
  85. world.note "No actions in the list! ra:help for more info."
  86. End If
  87. end If
  88. End Sub
  89. ]]>
  90. </script>
  91.  
  92.  
  93. <!-- =============================================
  94.  
  95. Alias: Add_Action
  96. Script: Do_Add_Action
  97. Purpose: Adds stuff when you do ra:add X
  98.  
  99. ============================================= -->
  100.  
  101. <aliases>
  102. <alias
  103. script="Do_Add_Action"
  104. match="ra:add *"
  105. enabled="y"
  106. >
  107. </alias>
  108. </aliases>
  109. <script>
  110. <![CDATA[
  111.  
  112. sub Do_Add_Action (sName, sLine, wildcards)
  113. if wildcards(1) = "" then
  114. world.note "Nothing wasn't really added to the list, because it would break if it was!"
  115. exit sub
  116. end if
  117. if instr (wildcards(1), " ") > 1 then
  118. world.note "No triple-spaces in your actions, please! ...they're the delimiter."
  119. exit sub
  120. end if
  121. If Instr (world.GetVariable ("actions") & " ", wildcards (1) & " ") > 0 then
  122. world.note "Action (" & wildcards (1) & ") is already in the list!"
  123. Exit Sub
  124. End If
  125. world.setvariable "actions", _
  126. world.getvariable ("actions") & " " & wildcards (1)
  127. world.note "Added action " & wildcards (1) & " to the list."
  128. end sub
  129.  
  130. ]]>
  131. </script>
  132.  
  133. <!-- =============================================
  134.  
  135. Alias: Remove_Action
  136. Script: Do_Remove_Action
  137. Purpose: Removes stuff when you do ra:remove X
  138. also clears the entire list
  139.  
  140. ============================================= -->
  141.  
  142. <aliases>
  143. <alias
  144. script="Do_Remove_Action"
  145. match="ra:remove *"
  146. enabled="y"
  147. >
  148. </alias>
  149. </aliases>
  150.  
  151. <script>
  152. <![CDATA[
  153. sub Do_Remove_Action (sName, sLine, wildcards)
  154. if wildcards(1) = "" then
  155. world.note "Nothing wasn't really removed from the list, because it would break if it was!"
  156. exit sub
  157. end if
  158. if instr (wildcards(1), " ") > 1 then
  159. world.note "You can't remove triple-spaces from the list ... they're the delimiter!"
  160. exit sub
  161. end if
  162.  
  163. If not Instr (world.GetVariable ("actions") & " ", wildcards (1) & " ") > 0 then
  164. world.note "Action " & wildcards (1) & " was not in the list."
  165. Exit Sub
  166. End If
  167. ' Remove the specified action from the list
  168. world.SetVariable "actions", _
  169. Trim (world.Replace (world.GetVariable ("actions") & " ", _
  170. wildcards (1) & " ", "", 1))
  171. world.note "Removed action '" & wildcards (1) & "' from the list."
  172. end sub
  173. ]]>
  174. </script>
  175.  
  176.  
  177. <aliases>
  178. <alias
  179. script="Do_Clear_List"
  180. match="ra:axe it all"
  181. enabled="y"
  182. >
  183. </alias>
  184. </aliases>
  185.  
  186. <script>
  187. <![CDATA[
  188. sub Do_Clear_List (sName, sLine, wildcards)
  189. If not Instr (world.GetVariable ("actions"), " ") > 0 then
  190. world.note "The list is empty, so you can't clear it!"
  191. Exit Sub
  192. End If
  193. world.SetVariable "actions", ""
  194. world.note "Removed everything from the action list."
  195. end sub
  196. ]]>
  197. </script>
  198.  
  199. <!-- =============================================
  200.  
  201. Alias: ra:help
  202. Script: OnHelp
  203. Purpose: Shows plugin help
  204.  
  205. ============================================= -->
  206.  
  207. <aliases>
  208. <alias
  209. script="OnHelp"
  210. match="ra:help"
  211. enabled="y"
  212. >
  213. </alias>
  214. </aliases>
  215.  
  216. <script>
  217. <![CDATA[
  218. sub OnHelp (sName, sLine, wildcards)
  219. world.note world.getplugininfo (world.getpluginid, 3)
  220. end sub
  221. ]]>
  222. </script>
  223.  
  224. <!-- =============================================
  225.  
  226. Alias: ra:list
  227. Script: OnList
  228. Purpose: Shows match text and list of actions
  229.  
  230. ============================================= -->
  231.  
  232. <aliases>
  233. <alias
  234. script="OnList"
  235. match="ra:list"
  236. enabled="y"
  237. >
  238. </alias>
  239. </aliases>
  240. <script>
  241. <![CDATA[
  242. sub OnList (sName, sLine, wildcards)
  243. Dim varList
  244. Dim x
  245. varList = world.GetVariableList
  246. ActionsList = split (world.getvariable ("actions")," ")
  247. If UBound(ActionsList) > -1 Then
  248. world.note "Match on '" & rcMatch & "'"
  249. world.note "Actions list:"
  250. For x = LBound(ActionsList) to UBound(ActionsList)
  251. If ActionsList(x) <> "" Then
  252. world.note ActionsList(x)
  253. End If
  254. Next
  255. Else
  256. world.note "No actions in the list! (Match on '" & rcMatch & "')"
  257. end If
  258. end sub
  259. ]]>
  260. </script>
  261.  
  262. <!-- =============================================
  263.  
  264. Alias: ra:match
  265. Script: OnMatch
  266. Purpose: Changes match text
  267.  
  268. ============================================= -->
  269.  
  270. <aliases>
  271. <alias
  272. script="OnMatch"
  273. match="ra:match *"
  274. enabled="y"
  275. >
  276. </alias>
  277. </aliases>
  278. <script>
  279. <![CDATA[
  280. sub OnMatch (sName, sLine, wildcards)
  281. world.SetVariable "actionMatch", wildcards (1)
  282. rcMatch = world.getvariable ("actionMatch")
  283. world.note "Script set to match on '" & rcMatch & "'."
  284. end sub
  285. ]]>
  286. </script>
  287. </muclient>
  288.  
  289.  
  290.  
  291.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement