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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  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] Refresh page


Posted by Nauti   (1 post)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] 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
[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.


1,334 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 HostDash]