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 ➜ Lua ➜ (Newb) Lua Questions

(Newb) Lua Questions

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


Posted by Renny   Canada  (26 posts)  Bio
Date Tue 01 Oct 2013 07:07 AM (UTC)
Message
I'll just preface this by saying that I've been playing mud(s) for a grand total of 2 weeks now, so I don't know a lot about them let alone MUSHclient or lua. That being said I have watched all of the youtube tutorials by Gammon.


1. My current goal is to make a trigger for healing. I have seen a few plugins posted by others but they are not automated.

Here is my current attempt


<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   group="Potions"
   match="[*/*hp */*mn */*mv]"
   send_to="12"
   sequence="100"
  >
  <send>require "wait"

function cr ()
  if ((%1/%2) &lt; 0.75) then
    Execute "drink_heal"
    wait.match ("You quaff potion", 10)
  end
end

wait.make (cr)</send>
  </trigger>
</triggers>


I must have something wrong because it tries to drink multiple potions instead of waiting for the string match for 10 seconds? Basically I want to drink a potion to heal but have a failsafe so it doesn't fire off again before drinking the first one.

2. If I were to make a trigger for using Spellup, how would I go about doing this? seeing as there are different timers/messages for each spell.

3. Lets say I download a plugin that someone else has made, and I want to make changes to it/see how it works, how can i see all the different aliases/triggers/scripts that it is made up of? Do I just open the xml with a word editor?

4. What is GMCP? Can GMCP be used with triggers to get data without using regex?

Thanks if anyone can answer some of these questions.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 01 Oct 2013 10:50 PM (UTC)
Message
Quote:

2. If I were to make a trigger for using Spellup, how would I go about doing this? seeing as there are different timers/messages for each spell.


I did a spellup plugin a while back. See if you can search for it here.

Quote:

3. Lets say I download a plugin that someone else has made, and I want to make changes to it/see how it works, how can i see all the different aliases/triggers/scripts that it is made up of? Do I just open the xml with a word editor?


Yes the aliases etc are there in the XML. It is normal to edit it with an editor. If you want you can copy and paste the triggers from the XML into the GUI. Make sure you include the <triggers> ... </triggers> part.

Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


Quote:

4. What is GMCP? Can GMCP be used with triggers to get data without using regex?


It is a protocol used by a few MUDs (eg. Aardwolf and the Iron Realms ones) to supply some data in a different format "out of band". It does tend to make writing plugins easier.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #2 on Tue 01 Oct 2013 10:55 PM (UTC)
Message
Quote:

I must have something wrong because it tries to drink multiple potions instead of waiting for the string match for 10 seconds? Basically I want to drink a potion to heal but have a failsafe so it doesn't fire off again before drinking the first one.


OK, that trigger waits 10 seconds, however if another prompt line arrives the new trigger does another heal.

What you want to do is remember (in a variable) when you last healed.

Probably something like this:

* One trigger detects the prompt and sends a heal, if more than 10 seconds have elapsed since the last heal. Once it does a heal it saves the current time.

* Another trigger detects the "You quaff potion" line and does something with it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Renny   Canada  (26 posts)  Bio
Date Reply #3 on Wed 02 Oct 2013 02:08 AM (UTC)
Message
Thanks for the replies. I'll take a look around for a gmcp tutorial if there are any, otherwise I can look at a few plugins and see what other people have done.

As for the trigger, I didn't realize that it was running a new one. I'll check out how to store the current time in a variable...would it have to be a Mushclient variable?
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.


14,985 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.