Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="iso-8859-1"?>
- <!DOCTYPE muclient [
- <!ENTITY actions_command "rc" >
- ]>
- <muclient>
- <plugin name="Random_Actions"
- author="Maketa"
- language="vbscript"
- id = "982a81eaaaba28aa527eec80"
- purpose = "Displays a random action when a specific trigger happens"
- save_state = "y"
- version = "1.1"
- >
- <description trim="y">
- <![CDATA[
- Commands (v1.1)
- ---------------
- ra:help - shows this description in the output window
- ra:add X - adds X to the command list
- ra:remove X - removes X from the command list
- ra:axe it all - clears the entire list
- ra:list - lists your actions
- ra:match X - modifies match text to X
- ]]>
- </description>
- </plugin>
- <!-- Get our standard VB constants -->
- <include name="constants.vbs"/>
- <!-- Initialization stuff -->
- <script>
- <![CDATA[
- dim ActionsList ' store list of actions
- Randomize ' Initialize random-number generator.
- dim rcMatch
- rcMatch = world.getvariable ("actionMatch")
- ]]>
- </script>
- <!-- =============================================
- Trigger: Random_Action
- Script: DoRandomAction
- Purpose: Does your action (randomly)action
- ============================================= -->
- <triggers>
- <trigger
- script="DoRandomAction"
- match="*"
- expand_variables="y"
- enabled="y"
- >
- </trigger>
- </triggers>
- <script>
- <![CDATA[
- Sub DoRandomAction (sName, sLine, wildcards)
- if rcMatch = "" then
- exit sub
- end if
- if wildcards(1) = rcMatch then
- ActionsList = split (world.getvariable ("actions")," ")
- If UBound(ActionsList) > -1 Then
- Dim randAction
- Dim loopX
- loopX = 0
- randAction = ""
- Do Until randAction <> "" or loopX > 9
- randAction = ActionsList ( Rnd * Ubound (ActionsList))
- loopX = loopX + 1
- Loop
- if loopX > 9 then
- world.note "You shouldn't be seeing this message - if you do, harass Maketa to fix it somehow."
- end if
- World.Send randAction
- Else
- world.note "No actions in the list! ra:help for more info."
- End If
- end If
- End Sub
- ]]>
- </script>
- <!-- =============================================
- Alias: Add_Action
- Script: Do_Add_Action
- Purpose: Adds stuff when you do ra:add X
- ============================================= -->
- <aliases>
- <alias
- script="Do_Add_Action"
- match="ra:add *"
- enabled="y"
- >
- </alias>
- </aliases>
- <script>
- <![CDATA[
- sub Do_Add_Action (sName, sLine, wildcards)
- if wildcards(1) = "" then
- world.note "Nothing wasn't really added to the list, because it would break if it was!"
- exit sub
- end if
- if instr (wildcards(1), " ") > 1 then
- world.note "No triple-spaces in your actions, please! ...they're the delimiter."
- exit sub
- end if
- If Instr (world.GetVariable ("actions") & " ", wildcards (1) & " ") > 0 then
- world.note "Action (" & wildcards (1) & ") is already in the list!"
- Exit Sub
- End If
- world.setvariable "actions", _
- world.getvariable ("actions") & " " & wildcards (1)
- world.note "Added action " & wildcards (1) & " to the list."
- end sub
- ]]>
- </script>
- <!-- =============================================
- Alias: Remove_Action
- Script: Do_Remove_Action
- Purpose: Removes stuff when you do ra:remove X
- also clears the entire list
- ============================================= -->
- <aliases>
- <alias
- script="Do_Remove_Action"
- match="ra:remove *"
- enabled="y"
- >
- </alias>
- </aliases>
- <script>
- <![CDATA[
- sub Do_Remove_Action (sName, sLine, wildcards)
- if wildcards(1) = "" then
- world.note "Nothing wasn't really removed from the list, because it would break if it was!"
- exit sub
- end if
- if instr (wildcards(1), " ") > 1 then
- world.note "You can't remove triple-spaces from the list ... they're the delimiter!"
- exit sub
- end if
- If not Instr (world.GetVariable ("actions") & " ", wildcards (1) & " ") > 0 then
- world.note "Action " & wildcards (1) & " was not in the list."
- Exit Sub
- End If
- ' Remove the specified action from the list
- world.SetVariable "actions", _
- Trim (world.Replace (world.GetVariable ("actions") & " ", _
- wildcards (1) & " ", "", 1))
- world.note "Removed action '" & wildcards (1) & "' from the list."
- end sub
- ]]>
- </script>
- <aliases>
- <alias
- script="Do_Clear_List"
- match="ra:axe it all"
- enabled="y"
- >
- </alias>
- </aliases>
- <script>
- <![CDATA[
- sub Do_Clear_List (sName, sLine, wildcards)
- If not Instr (world.GetVariable ("actions"), " ") > 0 then
- world.note "The list is empty, so you can't clear it!"
- Exit Sub
- End If
- world.SetVariable "actions", ""
- world.note "Removed everything from the action list."
- end sub
- ]]>
- </script>
- <!-- =============================================
- Alias: ra:help
- Script: OnHelp
- Purpose: Shows plugin help
- ============================================= -->
- <aliases>
- <alias
- script="OnHelp"
- match="ra:help"
- enabled="y"
- >
- </alias>
- </aliases>
- <script>
- <![CDATA[
- sub OnHelp (sName, sLine, wildcards)
- world.note world.getplugininfo (world.getpluginid, 3)
- end sub
- ]]>
- </script>
- <!-- =============================================
- Alias: ra:list
- Script: OnList
- Purpose: Shows match text and list of actions
- ============================================= -->
- <aliases>
- <alias
- script="OnList"
- match="ra:list"
- enabled="y"
- >
- </alias>
- </aliases>
- <script>
- <![CDATA[
- sub OnList (sName, sLine, wildcards)
- Dim varList
- Dim x
- varList = world.GetVariableList
- ActionsList = split (world.getvariable ("actions")," ")
- If UBound(ActionsList) > -1 Then
- world.note "Match on '" & rcMatch & "'"
- world.note "Actions list:"
- For x = LBound(ActionsList) to UBound(ActionsList)
- If ActionsList(x) <> "" Then
- world.note ActionsList(x)
- End If
- Next
- Else
- world.note "No actions in the list! (Match on '" & rcMatch & "')"
- end If
- end sub
- ]]>
- </script>
- <!-- =============================================
- Alias: ra:match
- Script: OnMatch
- Purpose: Changes match text
- ============================================= -->
- <aliases>
- <alias
- script="OnMatch"
- match="ra:match *"
- enabled="y"
- >
- </alias>
- </aliases>
- <script>
- <![CDATA[
- sub OnMatch (sName, sLine, wildcards)
- world.SetVariable "actionMatch", wildcards (1)
- rcMatch = world.getvariable ("actionMatch")
- world.note "Script set to match on '" & rcMatch & "'."
- end sub
- ]]>
- </script>
- </muclient>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement