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, 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.
 Entire forum ➜ MUSHclient ➜ General ➜ Looking for or learning how to make a simple buff script

Looking for or learning how to make a simple buff script

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


Posted by Nauti   (1 post)  Bio
Date Sat 06 Jan 2024 08:33 PM (UTC)
Message
Hey!

I'm trying to find information, but I can't find any, or I'm not gifted enough to realize when I actually find any, or info on how to make them.

What I would like to do, is write an alias like "buff <player>".

Which in turn should:

Cast buff spell A on player.
if trigger for spell is cast successfully is viewed, then cast spell B.
If trigger for spell failed, cast A again. Then continue.

For example:

cast 'shield' <player>
If it returns "You hear a high-pitched shriek as the air hardens around you, forming a shield." -> Cast 'sanctuary' <player>. And so on.

If it returns "You lose your concentration." then cast 'shield' <player> again and continue after successful cast.

Would this be easy attainable? I'm sorry for asking if there are resources out there that already answer this, which there probably is, but I couldn't find out how to do it.
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 07 Jan 2024 11:38 AM (UTC)

Amended on Sun 07 Jan 2024 11:40 AM (UTC) by Nick Gammon

Message
Look at this page for ideas. There are examples of doing something similar.

http://www.gammon.com.au/forum/?id=4957

In particular, this example looks close:


require "wait"

wait.make (function ()  --- coroutine below here

  repeat
    Send "cast heal"
    line, wildcards = 
       wait.regexp ("^(You heal .*|You lose your concentration)$")

  until string.find (line, "heal")

  -- wait a second for luck
  wait.time (1) 

  Note ("heal done!")

end)  -- end of coroutine


It would need a bit of work, but basically once you get the "good" response you send another command.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


1,884 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.