How to add A Script/Plugin to Mushclient

Posted by Yasha on Thu 11 Aug 2005 04:55 PM — 4 posts, 20,237 views.

#0

Hi,

I am new to Mushclient and scripting in general. I posted this in VBscript but realized it may have been the wrong place. I am wondering how does one add a script/plugin to Mushclient? There is a script I found on this forum for displaying prot duration of various spells. A script was posted as a reply but I am having trouble trying to implement it. Can someone point me to a good faq or post how to do it?

Thanx!
USA #1
What does the script look like? Does it have triggers/aliases included with the script? or is it just a script?
#2
Hi

Sorry if this is long/spam but I thought it would be easier to just copy/paste for you to see.

What I am having trouble with is where exactly to put the commands he is referring to. Any help would be appreciated!

Thanx,

Yasha



Mon 05 Apr 2004 05:38 AM (UTC)
Message
Yep, that makes a bit more sense. Oookay... the 'timer' alias looks like some twisted way of getting a timediff, lets see...

Here's a plugin that does all the same things as your script, has the same 'check' and 'clear' aliases to control it, plus 2 triggers to add/remove the Heavy Weight prot. Both triggers should send to scripting, adding trigger should call the AddProt sub and send the report directly to the world, this is the contents of its Send box:


call AddProt("prot_name")
world.send "party report say prot_name active!"



removing trigger calls the RemoveProt sub and do an opposite announce:


call RemoveProt("prot_name")
world.send "party report say prot_name expires!"



You can copy the bellow code, paste it into an empty text file, save as "ProtsReport.xml" in your plugins folder, and install the resulting file as Mushclient's plugin. Note that only the script was tested - triggers and aliases might be off.


<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE muclient >

<muclient>
<plugin name="ProtsReport" author="Keldar" language="vbscript" purpose="Reporting the status of prots"
save_state="y" date_written="2004-04-05" requires="3.42" version="1.0" id="783968f7b4c746ec0f6d2bdf">
</plugin>

<aliases>
<alias
name="check_prots"
match="check"
enabled="y"
send_to="12"
sequence="100"
><send>call ReportProts</send></alias>
<alias
name="clear_prots"
match="clear"
enabled="y"
send_to="12"
sequence="100"
><send>call ClearProts</send></alias>
</aliases>

<triggers>
<trigger
match="You suddenly feel magically heavier\."
regexp="y"
enabled="y"
send_to="12"
sequence="100"
><send>call AddProt(&quot;HW&quot;)
world.send &quot;party report say Heavy Weight Active.&quot;</send></trigger>
<trigger
match="You feel lighter, but it doesn't seem to affect your weight\!"
regexp="y"
enabled="y"
send_to="12"
sequence="100"
><send>call RemoveProt(&quot;HW&quot;)
world.send &quot;party report say Heavy Weight Expires.&quot;</send></trigger>
</triggers>

<script>
<![CDATA[
dim start_times
set start_times = CreateObject("Scripting.Dictionary")

function GetTimeDiff(prot)
time_now = Timer
if start_times.Exists(prot) then
GetTimeDiff = time_now - start_times.Item(prot)
end if
end function

function FormatTime(diff)
tmp_time = cint(diff)
if (tmp_time) < 60 then
mins = "0"
secs = tmp_time
else
mins = cint((tmp_time)/60)
secs = tmp_time Mod 60
end if
if secs < 10 then
secs = "0" & secs
end if
FormatTime = cstr(mins) & ":" & cstr(secs)
end function

sub ReportProts
dim tmp_time, prot, output
output = ""
for each prot in start_times.Keys
tmp_time = FormatTime(GetTimeDiff(prot))
output = output & prot & " (" & tmp_time & ") "
next
world.send "party report say " & output
end sub

sub AddProt(prot)
if (not start_times.Exists(prot)) then
start_times.Add prot, Timer
end if
end sub

sub RemoveProt(prot)
if start_times.Exists(prot) then
start_times.Remove(prot)
end if
end sub

sub ClearProts
start_times.RemoveAll
end sub
]]>
</script>

</muclient>
#3
Oh I forgot to mention. Is the above script for just ONE prot? And if so, do I need to add in the triggers for all the prots I want to use?

Yasha