Looking for or learning how to make a simple buff script

Posted by Nauti on Sat 06 Jan 2024 08:33 PM — 2 posts, 7,214 views.

#0
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.
Australia Forum Administrator #1
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.