[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Any Up-to-Date Achaean Autosippers?
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Any Up-to-Date Achaean Autosippers?

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


Posted by Arilles   (5 posts)  [Biography] bio
Date Sun 09 Sep 2012 08:09 PM (UTC)
Message
Does anyone have an up to date Auto-sipper I could use? I have no idea how to go about making one so I was hoping someone would have a Plugin somewhere.
[Go to top] top

Posted by Spider_Curt   USA  (3 posts)  [Biography] bio
Date Reply #1 on Tue 11 Sep 2012 04:43 AM (UTC)
Message
Search the forum for Twisol, he has plugins for Achaea.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #2 on Tue 11 Sep 2012 05:30 AM (UTC)
Message
Spider_Curt said:
Search the forum for Twisol, he has plugins for Achaea.

I don't recall publishing an autosipper though. Sorry!

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Spider_Curt   USA  (3 posts)  [Biography] bio
Date Reply #3 on Tue 11 Sep 2012 05:49 AM (UTC)
Message
Oooops! My screw up. Just noticed a post from Arilles concerning your plugins.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Tue 11 Sep 2012 06:18 AM (UTC)
Message
A search reveals:

http://www.gammon.com.au/forum/bbshowpost.php?id=9038


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Darcon   (26 posts)  [Biography] bio
Date Reply #5 on Sun 11 Nov 2012 07:33 PM (UTC)

Amended on Sun 11 Nov 2012 07:39 PM (UTC) by Darcon

Message
I have made an auto sipper plugin that does work as it is right now. I am new to scripting so there is still a few things that I would like to do with this to make it easier for myself and others to use.

Now, bare in mind that I am new to scripting so I am surprised that I even got this to work. I could not have done it without looking over some of nicks plugins. In fact this plugin is based on nicks ATCP.NJG plugin. If you want to use this you will have to have that plugin. Another note on this is that you will have to manually change each vial ID that your character will use for health and mana.

My question about this plugin is what could I have done to clean it up, make it better...etc. I would also like to streamline this by allowing some variable to store the vial id and a alias that can be used to change the variable. Something like Set HpVial vial("ID number") and Set MaVial vial("Id Number"). Any feedback will be greatly appreciated.

Here is my plugin. Just copy to a blank notepad and save as:

Achaea_Auto_Sipper.xml in the plugins folder for mushclient.


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, November 08, 2012, 10:53 PM -->
<!-- MuClient version 4.84 -->

<!-- Plugin "Achaea_Auto_Sipper" generated by Plugin Wizard -->

<muclient>
<plugin
   name="Achaea_Auto_Health_Sipper"
   author="Jeremy Bable"
   id="5cd2e76a2bb0bd52d49aaf4a"
   language="Lua"
   purpose="Heals when below 70% health or 50% Mana"
   save_state="y"
   date_written="2012-11-08 22:48:36"
   requires="4.84"
   version="1.0"
   >
<description trim="y">
<![CDATA[
This plugin is intended to automate the sipping of health and 
mana vials in Achaea. It is based off of Nick Gammon's ATCP.NJG
plugin for ATCP muds. You will need that plugin in order for this
one to work.

I am still in the begining of learning lua and scripting so I did
copy a few things from the ATCP.NJG file. Particularly the Stats
table and The OnPluginBroadcast funtions. (I believe giving props
where they are due. Thanks Nick!!!)

So far this is version one of this plugin. For now you will have
to manually change the health vial id and the mana vial id to your
own for it to work. As I learn more about scripting I intend to make
this easier by adding an alias that will change the vials for you.

]]>
</description>

</plugin>


<!--  Get our standard constants -->

<include name="constants.lua"/>

<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   group="Base"
   match="The elixir heals and soothes you\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable("SipAllow", 0)</send>
  </trigger>
  <trigger
   enabled="y"
   group="Base"
   match="You may drink another health or mana elixir or tonic\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable("SipAllow", 1)</send>
  </trigger>
  <trigger
   enabled="y"
   group="Defenses"
   match="You close your eyes\, bow your head\, and empty your mind of all thought\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable("Meditate", 1)</send>
  </trigger>
  <trigger
   enabled="y"
   group="Defenses"
   match="You cease your meditation having achieved full will and mana\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable("Meditate", 0)</send>
  </trigger>
  <trigger
   enabled="y"
   group="Defenses"
   match="You snap your head up as you break your meditation\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable ("Meditate", 0)</send>
  </trigger>

</triggers>

<!--  Variables  -->

<variables>
  <variable name="SipAllow">1</variable>
  <variable name="Meditate">0</variable>
</variables>

<!--  Script  -->


<script>
<![CDATA[

require "checkplugin"

stats = {}

function got_vitals (s)
  stats.health, stats.maxhealth, 
  stats.mana, stats.maxmana, 
  stats.endurance, stats.maxendurance, 
  stats.willpower, stats.maxwillpower, 
  stats.exp, stats.maxexp = string.match (s, "^H:(%d+)/(%d+) M:(%d+)/(%d+) E:(%d+)/(%d+) W:(%d+)/(%d+) NL:(%d+)/(%d+)")

   if stats.health then -- Health/Mana Auto-Sipper
   
      hp = tonumber (stats.health)
      max_hp = tonumber (stats.maxhealth)
      HpPer = math.floor ((hp / max_hp) * 100)
      ma = tonumber (stats.mana)
      max_ma = tonumber (stats.maxmana)
      MaPer = math.floor ((ma / max_ma) * 100)
      sipallow = tonumber (GetVariable ("SipAllow"))
      meditate = tonumber (GetVariable ("Meditate"))

      if HpPer < 70 then  -- Health/Mana Percentage Check
         if sipallow == 1 then -- Test for the sip ability
            Send "sip vial317486"  -- Sip health Vial
         end -- Sip Allowed Check 
      elseif meditate == 0 then -- Meditation Check
         if MaPer < 50 then -- Mana Perectage Check
            Send "sip vial373911" -- Sip mana vial
         end -- Defenses Up Check
      end -- Health/Mana Perecentage Check
   
   end -- Health/Mana Auto-Sipper

end -- function got_vitals

function OnPluginBroadcast (msg, id, name, text)
  if id == "85f72d0e263d75df7bde6f00" then
  
    if msg == 1 then
      got_vitals (text)      -- eg. "H:496/496 M:412/412 E:1380/1380 W:960/960 NL:89/100 "
    end -- if   
 
  end -- if ATCP message
end

function OnPluginListChanged ()
  do_plugin_check_now ("85f72d0e263d75df7bde6f00", "ATCP_NJG")    -- check we have ATCP plugin
end -- OnPluginListChanged

]]>
</script>


</muclient>
[Go to top] top

Posted by Darcon   (26 posts)  [Biography] bio
Date Reply #6 on Sun 11 Nov 2012 10:21 PM (UTC)
Message
Ok, after grouping up in a party and experiencing some lag issues I found that my sipper may need a failsafe to stop it from drinking all of your vial if variables didn't update properly. I will work on that and see If I can come up with a solution.
[Go to top] top

Posted by Darcon   (26 posts)  [Biography] bio
Date Reply #7 on Mon 12 Nov 2012 03:22 AM (UTC)
Message
Ok so I am an idiot sometimes. It wasn't a lag issue. I had forgotten a trigger for the mana vial. It wasn't setting the SipAllow variable to 0 like it should have because the trigger wasn't in there. I have fixed that issue.


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, November 08, 2012, 10:53 PM -->
<!-- MuClient version 4.84 -->

<!-- Plugin "Achaea_Auto_Health_Sipper" generated by Plugin Wizard -->

<muclient>
<plugin
   name="Achaea_Auto_Sipper"
   author="Jeremy Bable"
   id="5cd2e76a2bb0bd52d49aaf4a"
   language="Lua"
   purpose="Heals when below 70% health or 50% Mana"
   save_state="y"
   date_written="2012-11-08 22:48:36"
   requires="4.84"
   version="1.0"
   >
<description trim="y">
<![CDATA[
This plugin is intended to automate the sipping of health and 
mana vials in Achaea. It is based off of Nick Gammon's ATCP.NJG
plugin for ATCP muds. You will need that plugin in order for this
one to work.

I am still in the begining of learning lua and scripting so I did
copy a few things from the ATCP.NJG file. Particularly the Stats
table and The OnPluginBroadcast funtions. (I believe giving props
where they are due. Thanks Nick!!!)

So far this is version one of this plugin. For now you will have
to manually change the health vial id and the mana vial id to your
own for it to work. As I learn more about scripting I intend to make
this easier by anding an alias that will change the vials for you.

]]>
</description>

</plugin>


<!--  Get our standard constants -->

<include name="constants.lua"/>

<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   group="Base"
   match="The elixir heals and soothes you\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable("SipAllow", 0)</send>
  </trigger>
  <trigger
   enabled="y"
   group="Base"
   match="Your mind feels stronger and more alert\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable("SipAllow", 0)</send>
  </trigger>
  <trigger
   enabled="y"
   group="Base"
   match="You may drink another health or mana elixir or tonic\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable("SipAllow", 1)</send>
  </trigger>
  <trigger
   enabled="y"
   group="Defenses"
   match="You close your eyes\, bow your head\, and empty your mind of all thought\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable("Meditate", 1)</send>
  </trigger>
  <trigger
   enabled="y"
   group="Defenses"
   match="You cease your meditation having achieved full will and mana\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable("Meditate", 0)</send>
  </trigger>
  <trigger
   enabled="y"
   group="Defenses"
   match="You snap your head up as you break your meditation\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>SetVariable ("Meditate", 0)</send>
  </trigger>

</triggers>

<!--  Variables  -->

<variables>
  <variable name="SipAllow">1</variable>
  <variable name="Meditate">0</variable>
</variables>

<!--  Script  -->


<script>
<![CDATA[

require "checkplugin"

stats = {}

function got_vitals (s)
  stats.health, stats.maxhealth, 
  stats.mana, stats.maxmana, 
  stats.endurance, stats.maxendurance, 
  stats.willpower, stats.maxwillpower, 
  stats.exp, stats.maxexp = string.match (s, "^H:(%d+)/(%d+) M:(%d+)/(%d+) E:(%d+)/(%d+) W:(%d+)/(%d+) NL:(%d+)/(%d+)")

   if stats.health then -- Health/Mana Auto-Sipper
   
      hp = tonumber (stats.health)
      max_hp = tonumber (stats.maxhealth)
      HpPer = math.floor ((hp / max_hp) * 100)
      ma = tonumber (stats.mana)
      max_ma = tonumber (stats.maxmana)
      MaPer = math.floor ((ma / max_ma) * 100)
      sipallow = tonumber (GetVariable ("SipAllow"))
      meditate = tonumber (GetVariable ("Meditate"))

      if HpPer < 70 then  -- Health/Mana Percentage Check
         if sipallow == 1 then -- Test for the sip ability
            Send "sip vial317486"  -- Sip health Vial
         end -- Sip Allowed Check 
      elseif meditate == 0 then -- Meditation Check
         if MaPer < 50 then -- Mana Perectage Check
            Send "sip vial373911" -- Sip mana vial
         end -- Defenses Up Check
      end -- Health/Mana Perecentage Check
   
   end -- Health/Mana Auto-Sipper

end -- function got_vitals

function OnPluginBroadcast (msg, id, name, text)
  if id == "85f72d0e263d75df7bde6f00" then
  
    if msg == 1 then
      got_vitals (text)      -- eg. "H:496/496 M:412/412 E:1380/1380 W:960/960 NL:89/100 "
    end -- if   
 
  end -- if ATCP message
end

function OnPluginListChanged ()
  do_plugin_check_now ("85f72d0e263d75df7bde6f00", "ATCP_NJG")    -- check we have ATCP plugin
end -- OnPluginListChanged

]]>
</script>


</muclient>
[Go to top] top

Posted by Darcon   (26 posts)  [Biography] bio
Date Reply #8 on Thu 15 Nov 2012 09:02 PM (UTC)
Message
There is a fatal flaw in this script that will spam you out that I have to work on. The sipper does work though. As long as you have something in your vials. If the vial is empty then crash city. I will get at that a little later. For now, just make sure you fill your vials so this doesn't happen.
[Go to top] 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.


7,538 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]