Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ How to add A Script/Plugin to Mushclient

How to add A Script/Plugin to Mushclient

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Yasha   (8 posts)  Bio
Date Thu 11 Aug 2005 04:55 PM (UTC)
Message

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!
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #1 on Thu 11 Aug 2005 08:16 PM (UTC)
Message
What does the script look like? Does it have triggers/aliases included with the script? or is it just a script?

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Yasha   (8 posts)  Bio
Date Reply #2 on Thu 11 Aug 2005 08:59 PM (UTC)
Message
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>
Top

Posted by Yasha   (8 posts)  Bio
Date Reply #3 on Thu 11 Aug 2005 09:02 PM (UTC)
Message
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
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,763 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.