Nyyrazzilyss's Mudlet Script - Adding offensive spells to the ShaScript function

Scripts and support for your favorite MUD client.
Gyrx
Sojourner
Posts: 457
Joined: Mon Apr 08, 2002 5:01 am
Location: MI, USA

Nyyrazzilyss's Mudlet Script - Adding offensive spells to the ShaScript function

Postby Gyrx » Wed Mar 22, 2017 5:02 am

Here are the additions I've made to Nyyrazzilyss's "ShaScript" function to add single target damage spells beyond Totem Darts for exp trains.

The same approach can be used for other caster classes by swapping out the shaman spell names for the spell you want to add.

See this link for Nyyrazzilyss's script: viewtopic.php?f=4&t=25455

Mudlet Script Version used with ShaScript below: Script version: 3/17/2017 NyyLIB011dev https://github.com/Nyyrazzilyss/NyyLIB

Thanks a ton to Nyyrazzilyss for his hard work and generosity in sharing his Mudlet script!


----------------------------------
At a base level, to add a unique spell to the "automissile" list two separate pieces of code need to be added. Example:

1st Piece. Search for and place after line - if prompt:get("enemy") ~= "" and spell:count() == 0 then :

if getSpellCount("spirit_wrack") > 0 then
spell:setNext("sw")
return
end



2nd Piece. Search for and place after the section - function group_heal(xcommand) :

function spirit_wrack(xcommand)
shiftButton("spirit_wrack", "automissile", xcommand)
end



----------------------------------

When adding multiple spells, choose the spell you cast first by placing it directly after if prompt:get("enemy") ~= "" and spell:count() == 0 then . Choose the 2nd spell to cast by adding after that, etc.


----------------------------------

For the LazyTown residents, such as myself, here's a copy/paste of the entire ShaScript function I am using locally which has all of the single target shaman spells added for 1st through 10th circle on Script version: 3/17/2017 NyyLIB011dev https://github.com/Nyyrazzilyss/NyyLIB :


-------------------------------------------------
-- Put your Lua functions here. --
-- --
-- Note that you can also use external Scripts --
-------------------------------------------------
function initSha()
addbutton("totem_darts", 7, 1)


-- 9 harm spells
checkHarmSpell()

addbutton("group_heal", 10, 41)
addbutton("earthquake", 11, 16)

addbutton("stoneskin", 12, 26)
addbutton("ancestral_fury",13, 46)

--addbutton("vitality", 14, 31)

NyyLIB.equipicon=14

mud:send("powers info vit")
end


-- this function will be called when shaman should cast
function SpellsSha()
-- gheal if i'm blind

if buff:get("blind") or buff:get("blindness") then
if getSpellCount("group_heal") > 0 then
spell:setNext("gh")
return
end
end

-- check if anyone blind
for k,char in pairs(groupList:pc()) do
if buff:get("blind", char) or buff:get("blindness", char) then
if charData:get("autogh") then
if getSpellCount("group_heal") > 0 then
spell:setNext("gh")
return
end
end
end
end

-- earthquakes
if castQuake() then
return
end

-- stone if not stoned/scaled
if scr_stoneskin(true) then
return
end

-- group heal if multiple characters damaged
local damaged=0
for k,char in pairs(groupList:pc()) do
local hp=tonumber(groupList:getHP(char))
local maxhp= tonumber(groupList:getMaxHP(char))
local percent = hp/maxhp

if hp < .9 * maxhp then
damaged = damaged + 1
end
end

if damaged >= 3 and getSpellCount("group_heal") > 0 and charData:get("autogh") then
spell:setNext("gh")
return
end

-- stone remaining characters
if scr_stoneskin() then
return
end

-- vit self if needed / autovit enabled

if charData:get("autovit") and charData:get("level") >= 21 then
if spell:attempt(whoami(), "vitality", "vit") then
return
end
end

-- cast heal on self?

local hp=prompt:get("hp")
local maxhp=prompt:get("maxhp")
local percent=hp/maxhp

if percent < .8 then
if getSpellCount("group_heal") > 0 and charData:get("autogh") then
spell:setNext("gh")
return
end

if getSpellCount("heal") > 0 then
spell:setNext("heal me")
return
end
end

-- queue vitality
if charData:get("autovit") and charData:get("level") >= 21 then
scr_vitality()
end

-- if fighting and no other spells cast - cast ancestral fury
if charData:get("autofury") then
if prompt:get("enemy") ~= "" and spell:count() == 0 then
if getSpellCount("ancestral_fury") > 0 then
spell:setNext("afu")
return
end
end
end

-- totemdarts
if charData:get("automissile") then
if prompt:get("enemy") ~= "" and spell:count() == 0 then
if getSpellCount("spirit_wrack") > 0 then
spell:setNext("sw")
return
end
-- //Area spell// if getSpellCount("soul_tempest") > 0 then
-- spell:setNext("stp")
-- return
-- end
if getSpellCount("puppet") > 0 then
spell:setNext("pp")
return
end
if getSpellCount("unleash_fetish") > 0 then
spell:setNext("uf")
return
end
if getSpellCount("jar_the_soul") > 0 then
spell:setNext("js")
return
end
if getSpellCount("spiritknife") > 0 then
spell:setNext("sk")
return
end
if getSpellCount("totem_darts") > 0 then
spell:setNext("td")
return
end
end
end

-- if fighting and no other spells cast - harm
if charData:get("autoharm") then
if harmSpells() then
return
end
end
end

function earthquake(xcommand)
shiftButton("earthquake", "autoquake", xcommand)
end

function ancestral_fury(xcommand)
shiftButton("ancestral_fury", "autofury", xcommand)
end

function group_heal(xcommand)
shiftButton("group_heal", "autogh", xcommand)
end

function spirit_wrack(xcommand)
shiftButton("spirit_wrack", "automissile", xcommand)
end

-- //area spell// function soul_tempest(xcommand)
-- shiftButton("soul_tempest", "automissile", xcommand)
-- end

function puppet(xcommand)
shiftButton("puppet", "automissile", xcommand)
end

function unleash_fetish(xcommand)
shiftButton("unleash_fetish", "automissile", xcommand)
end

function jar_the_soul(xcommand)
shiftButton("jar_the_soul", "automissile", xcommand)
end

function spiritknife(xcommand)
shiftButton("spiritknife", "automissile", xcommand)
end

function totem_darts(xcommand)
shiftButton("totem_darts", "automissile", xcommand)

if xcommand == "update" then
checkMissileSpells()
end
end

function hex(xcommand)
local fname="hex"

if xcommand == "update" then
updateButton(fname)
return
end

if xcommand == "init" then
setLabelImage(fname, "hex-off.png")
_G[fname]("update")
else
spell:cast("hex")
end
end

function silence_person(xcommand)
local fname="silence_person"

if xcommand == "update" then
updateButton(fname)
return
end

if xcommand == "init" then
setLabelImage(fname, "silence_person-off.png")
_G[fname]("update")
else
spell:setNext("sp")
end
end
Nyyrazzilyss
Sojourner
Posts: 30
Joined: Tue May 19, 2015 6:30 am

Re: Nyyrazzilyss's Mudlet Script - Adding offensive spells to the ShaScript function

Postby Nyyrazzilyss » Tue Apr 18, 2017 2:39 am

I've got shaman (+ all casters!) spell casting included in the latest dev script - I've re-written how it handles it, so it's also a bit more readable now / much less code. Thanks!
Vides
Sojourner
Posts: 1
Joined: Mon May 15, 2017 10:57 am

Re: Nyyrazzilyss's Mudlet Script - Adding offensive spells to the ShaScript function

Postby Vides » Mon May 22, 2017 5:46 am

Nyyrazzilyses wrote:I've got shaman (+ all casters!) spell casting included in the latest dev script - I've re-written how it handles it, so it's also a bit more readable now / much less code. Thanks!


Brilliant, thanks for sharing the script Gyrx.
Last edited by Vides on Tue Oct 26, 2021 2:21 pm, edited 1 time in total.
NathanielMay
Sojourner
Posts: 1
Joined: Fri Sep 28, 2018 7:48 am

Re: Nyyrazzilyss's Mudlet Script - Adding offensive spells to the ShaScript function

Postby NathanielMay » Fri Sep 28, 2018 7:53 am

Nyyrazzilyss wrote:I've got shaman (+ all casters!) spell casting included in the latest dev script - I've re-written how it handles it, so it's also a bit more readable now / much read phenq reviews here and less code. Thanks!

Thanks for your efforts and re-writing the script. Where can I get the second version of your script? Or have you modified your original post?
Last edited by NathanielMay on Thu Oct 04, 2018 12:26 pm, edited 1 time in total.
Nyyrazzilyss
Sojourner
Posts: 30
Joined: Tue May 19, 2015 6:30 am

Re: Nyyrazzilyss's Mudlet Script - Adding offensive spells to the ShaScript function

Postby Nyyrazzilyss » Tue Oct 02, 2018 1:05 am

NathanielMay wrote:
Nyyrazzilyss wrote:I've got shaman (+ all casters!) spell casting included in the latest dev script - I've re-written how it handles it, so it's also a bit more readable now / much less code. Thanks!

Thanks for your efforts and re-writing the script. Where can I get the second version of your script? Or have you modified your original post?


This is actually a thread from March earlier this year, previous to the last stable i'd posted towards the end of April. The changes referred to are all present in my posted script (4/22).

While I do have a development script again at this time, it's not been publicly posted. Eventually, yes, but probably not for another month or two (it's currently Oct/1)

Return to “MUD Client Help”

Who is online

Users browsing this forum: No registered users and 3 guests