I need to know if it would be possible if someone could tell me how to automatically say if someone tells group HH with * as the wild card itll cast haste on them but if I lose concentration how do I get it to repeat till it hits? Thanks.
How to repeat lost concentration triggers?
Posted by Valis on Mon 01 Oct 2012 10:17 PM — 8 posts, 30,154 views.
Quote:
if I lose concentration how do I get it to repeat till it hits?
if I lose concentration how do I get it to repeat till it hits?
You have to show us what it looks like on your MUD when you lose concentration. Copy/paste starting from before you see HH on your group channel until after you lose concentration.
Below is a short script I put together. This MUD replies with "You lose your concentration while casting..."
The spell number can be replaced to actual spell name. Add more spells if needed. Be sure to change 'nosp' count from 2 to whatever if array is changed to a different count.
-- castfight: cast before fighting
require "wait"
wait.make (function() -- start of coroutine
ca = "cast "
-- enter spell number in quotes to identify as strings
a= {[1]="100", [2]="101"}
nosp = 2 -- nosp = number of spells in array
-- run loop to call all spells in array
for b = 1, nosp do
-- concatenate "cast " and spell number or name
sum = (ca..a)
-- Try again if you lose your concentration
repeat
Send (sum)
local x = wait.match("You lost your concentration*", 1)
if not x then
Note (a.." done.")
c = 0
else
wait.time(1)
c = 1
end -- if
until c == 0
c = 1
end -- for b, outer loop
end) -- of Coroutine
The spell number can be replaced to actual spell name. Add more spells if needed. Be sure to change 'nosp' count from 2 to whatever if array is changed to a different count.
-- castfight: cast before fighting
require "wait"
wait.make (function() -- start of coroutine
ca = "cast "
-- enter spell number in quotes to identify as strings
a= {[1]="100", [2]="101"}
nosp = 2 -- nosp = number of spells in array
-- run loop to call all spells in array
for b = 1, nosp do
-- concatenate "cast " and spell number or name
sum = (ca..a)
-- Try again if you lose your concentration
repeat
Send (sum)
local x = wait.match("You lost your concentration*", 1)
if not x then
Note (a.." done.")
c = 0
else
wait.time(1)
c = 1
end -- if
until c == 0
c = 1
end -- for b, outer loop
end) -- of Coroutine
the line:
sum = (ca..a)
should be:
sum = (ca..a)
I don't know how to post codes in code format. Sorry.
sum = (ca..a)
should be:
sum = (ca..a)
I don't know how to post codes in code format. Sorry.
Hope quoting works..
Avocado said:
the line:
sum = (ca..a)
should be:
sum = (ca..a)
I don't know how to post codes in code format. Sorry.
the line:
sum = (ca..a)
should be:
sum = (ca..a)
I don't know how to post codes in code format. Sorry.
it isn't posting right.
sum = (ca..a[_b_])
it should be like that but remove the underscores.
I wish I could edit the posts here.
sum = (ca..a[_b_])
it should be like that but remove the underscores.
I wish I could edit the posts here.
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
It's all there.
Thank you Nick.
Here it is again. I changed the spell to be tried only 3 times. It isn't what exactly Valis had requested, but it could be a part of something he or many of us could use.
Here it is again. I changed the spell to be tried only 3 times. It isn't what exactly Valis had requested, but it could be a part of something he or many of us could use.
<aliases>
<alias
match="castfight"
enabled="y"
send_to="12"
sequence="100"
>
<send>-- castfight: cast before fighting
require "wait"
wait.make (function() -- start of coroutine
ca = "cast "
-- enter spell or spell number in quotes to identify as strings
a= {[1]="bless", [2]="haste"}
nosp = 2 -- nosp = number of spells in array
-- run loop to call all spells in array
for b = 1, nosp do
-- concatenate "cast " and spell string in array
sum = (ca..a[b])
-- Try again up to three times if you lose your concentration
repeat
Send (sum)
local x = wait.match("You lost your concentration*", 1)
if not x then
Note (a[b].." done.")
c = 3
else
wait.time(1)
c = c + 1
end -- if
until c == 3
c = 0
end -- for b, outer loop
end) -- of Coroutine
</send>
</alias>
</aliases>