Buff tracker for Zombiemud

Posted by Antiflower on Wed 20 Aug 2025 03:32 PM — 5 posts, 6,551 views.

#0
I would like to create a buff tracker for Zombiemud. Zombiemud uses a party system and I'd like the tracker to send information to the party channel with the party say command, I did get chatgpt to come up a functional version, but I am unsure how to add more buffs beyond stoneskin to this, any attempt at getting chatgpt to edit it further results in the plugin no longer functioning. So if someone could help me edit this plugin in a way that allows me to add buffs myself without editing a large portion of the code, such as just adding new trigger blocks, that would be preferable, I think? It was difficult to get even this far with chatgpt as it kept trying to use improper formating for plugins and making things up until I gave it an example from the forums here.



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>

<muclient>
<plugin
name="ZombieMUD_BuffTracker"
author="You"
id="a1b2c3d4e5f67890"
language="VBscript"
purpose="Track Stoneskin buff stacks"
save_state="y"
requires="4.00"
version="1.1"
>

<description trim="y"><![CDATA[
Tracks Stoneskin buffs on ZombieMUD and announces stacks to party.

- Triggered by:
"Granite plates form over your skin."
"Your stoneskin crumbles and drops off."

- Supports up to 2 stacks.
- Alias: buffstatus (prints current buff stacks to party channel).
]]></description>
</plugin>

<!-- Triggers -->
<triggers>
<!-- Stoneskin applied -->
<trigger
match="Granite plates form over your skin."
script="OnStoneskinGain"
enabled="y"
/>

<!-- Stoneskin fades -->
<trigger
match="Your stoneskin crumbles and drops off."
script="OnStoneskinLoss"
enabled="y"
/>
</triggers>

<!-- Aliases -->
<aliases>
<alias
match="^buffstatus$"
script="OnBuffStatus"
enabled="y"
regexp="y"
/>
</aliases>

<!-- Script -->
<script>
<![CDATA[
Dim stoneskinStacks

Sub OnPluginInstall
stoneskinStacks = 0
World.Send "party say BuffTracker loaded. Stoneskin stacks = " & stoneskinStacks
End Sub

Sub OnStoneskinGain(name, line, wildcards)
If stoneskinStacks < 2 Then
stoneskinStacks = stoneskinStacks + 1
End If
World.Send "party say Stoneskin applied. Current stacks: " & stoneskinStacks
End Sub

Sub OnStoneskinLoss(name, line, wildcards)
If stoneskinStacks > 0 Then
stoneskinStacks = stoneskinStacks - 1
End If
World.Send "party say Stoneskin faded. Current stacks: " & stoneskinStacks
End Sub

Sub OnBuffStatus(name, line, wildcards)
World.Send "party say Current Stoneskin stacks: " & stoneskinStacks
End Sub
]]>
</script>

</muclient>
Amended on Wed 20 Aug 2025 03:58 PM by Antiflower
USA Global Moderator #1
Do all of your buffs stack or only some?
Amended on Thu 21 Aug 2025 12:19 PM by Fiendish
USA Global Moderator #2
Anyway, probably something like this (not tested)


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>

<muclient>
<plugin
name="ZombieMUD_BuffTracker"
author="Fiendish"
id="5436f54b51d710e47030a41f"
language="Lua"
purpose="Track buffs and announce to party"
save_state="y"
requires="4.00"
version="1.1"
>

<description trim="y"><![CDATA[
Tracks buffs on ZombieMUD and announces stacks to party.

- Alias: buffstatus (prints current buff stacks to party channel).
]]></description>
</plugin>

<!-- Aliases -->
<aliases>
<alias
match="buffstatus"
script="OnBuffStatus"
enabled="y"
regexp="n"
/>
</aliases>

<!-- Script -->
<script>
<![CDATA[
buffDetails = {
    ["stoneskin"] = {
        ["maxStacks"] = 2,
        ["apply"] = "Granite plates form over your skin.",
        ["fade"] = "Your stoneskin crumbles and drops off.",
    }
}
buffStacks = {}


function OnPluginInstall()
    Send("party say BuffTracker loaded.")
    for name, buff in pairs(buffDetails) do
        buffStacks[name] = 0
        AddTriggerEx(
            "gain_" .. name:gsub("[^A-Za-z0-9_]", ""):sub(1, 32),
            buff["apply"],
            "OnBuffGain('" .. name .. "')",
            trigger_flag.Enabled,
            -1, 0, "", "", sendto.script, 100
        )
        AddTriggerEx(
            "loss_" .. name:gsub("[^A-Za-z0-9_]", ""):sub(1, 32),
            buff["fade"],
            "OnBuffLoss('" .. name .. "')",
            trigger_flag.Enabled,
            -1, 0, "", "", sendto.script, 100
        )
    end
end

function OnBuffGain(name)
    if buffStacks[name] < buffDetails[name]["maxStacks"] then
        buffStacks[name] = buffStacks[name] + 1
        Send("party say " .. name .. " gained. Current stacks: " .. buffStacks[name])
    else
        Send("party say " .. name .. " is at max stacks: " .. buffDetails[name]["maxStacks"])
    end
end

function OnBuffLoss(name)
    if buffStacks[name] and buffStacks[name] > 0 then
        buffStacks[name] = buffStacks[name] - 1
        Send("party say " .. name .. " lost. Current stacks: " .. buffStacks[name])
    else
        Send("party say " .. name .. " is not active.")
    end
end

function OnBuffStatus()
    Send("party say Current Buff Status:")
    for name, stacks in pairs(buffStacks) do
        if stacks > 0 then
            Send("party say " .. name .. ": " .. stacks .. "/" .. buffDetails[name]["maxStacks"])
        end
    end
end

]]>
</script>

</muclient>
Amended on Thu 21 Aug 2025 01:01 PM by Fiendish
#3
Fiendish said:

Do all of your buffs stack or only some?


No, but the ones that do only stack to 2 times, so it doesnt need to be anything fancier than that.

Also, This plugin version looks wonderful. I'll give it a test run, and I thank you for your time and help, I really appreciate you being willing to do so.
Amended on Thu 21 Aug 2025 08:09 PM by Antiflower
#4
Fiendish said:

Anyway, probably something like this (not tested)


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>

<muclient>
<plugin
name="ZombieMUD_BuffTracker"
author="Fiendish"
id="5436f54b51d710e47030a41f"
language="Lua"
purpose="Track buffs and announce to party"
save_state="y"
requires="4.00"
version="1.1"
>

<description trim="y"><![CDATA[
Tracks buffs on ZombieMUD and announces stacks to party.

- Alias: buffstatus (prints current buff stacks to party channel).
]]></description>
</plugin>

<!-- Aliases -->
<aliases>
<alias
match="buffstatus"
script="OnBuffStatus"
enabled="y"
regexp="n"
/>
</aliases>

<!-- Script -->
<script>
<![CDATA[
buffDetails = {
    ["stoneskin"] = {
        ["maxStacks"] = 2,
        ["apply"] = "Granite plates form over your skin.",
        ["fade"] = "Your stoneskin crumbles and drops off.",
    }
}
buffStacks = {}


function OnPluginInstall()
    Send("party say BuffTracker loaded.")
    for name, buff in pairs(buffDetails) do
        buffStacks[name] = 0
        AddTriggerEx(
            "gain_" .. name:gsub("[^A-Za-z0-9_]", ""):sub(1, 32),
            buff["apply"],
            "OnBuffGain('" .. name .. "')",
            trigger_flag.Enabled,
            -1, 0, "", "", sendto.script, 100
        )
        AddTriggerEx(
            "loss_" .. name:gsub("[^A-Za-z0-9_]", ""):sub(1, 32),
            buff["fade"],
            "OnBuffLoss('" .. name .. "')",
            trigger_flag.Enabled,
            -1, 0, "", "", sendto.script, 100
        )
    end
end

function OnBuffGain(name)
    if buffStacks[name] < buffDetails[name]["maxStacks"] then
        buffStacks[name] = buffStacks[name] + 1
        Send("party say " .. name .. " gained. Current stacks: " .. buffStacks[name])
    else
        Send("party say " .. name .. " is at max stacks: " .. buffDetails[name]["maxStacks"])
    end
end

function OnBuffLoss(name)
    if buffStacks[name] and buffStacks[name] > 0 then
        buffStacks[name] = buffStacks[name] - 1
        Send("party say " .. name .. " lost. Current stacks: " .. buffStacks[name])
    else
        Send("party say " .. name .. " is not active.")
    end
end

function OnBuffStatus()
    Send("party say Current Buff Status:")
    for name, stacks in pairs(buffStacks) do
        if stacks > 0 then
            Send("party say " .. name .. ": " .. stacks .. "/" .. buffDetails[name]["maxStacks"])
        end
    end
end

]]>
</script>

</muclient>




This works perfectly. I was able to add more buffs to it and it functions great. Thank you again for the assistance.