Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- At the end of this process, you will be able to use the @otgMH tag in Svo's custom prompt to display denizen health.
- Firstly, you need to adjust the default prompt to use Achaea's internal custom prompt. Don't worry, this won't break Svo's custom prompt or defence tracking. Enter the following line into the command box of Mudlet when connected to Achaea:
- CONFIG PROMPT CUSTOM *hh, *mm *b*d-*r-((*T))
- -- NEW! Importable xml file: http://1drv.ms/1scGUXh
- Create a trigger, call it something sensible like Grab mob health from prompt
- Pattern (set to perl regex):
- ^(\d+)h, (\d+)m (\w+)-(?:\w+|-|)-\(\((\d+)\%\)\)-
- Script:
- mobHealthPct = matches[6] or matches[5]
- This has now assigned the mob health percentage from the prompt to variable mobHealthPct
- Create a new script, copy in the following functions (to just before the line ========= ):
- mobHealthPct = mobHealthPct or 0 --sets up the variable, without this your prompt is blank until yout hit something
- function promptMobHealth()
- local h = tonumber(mobHealthPct)
- mhc = "blanched_almond"
- if h == 0 then
- mhc = ""
- return mhc --this will hide the tag when the mob is killed
- elseif h < 5 then
- mhc = "red" --nearly dead
- elseif h < 25 then
- mhc = "orange_red" --grievously wounded
- elseif h < 50 then
- mhc = "dark_orange" --injured
- elseif h < 75 then
- mhc = "orange" --slightly injured
- end
- mhc = " <"..mhc..">("..h.."%)<reset>"
- return mhc
- end
- function clearMobHealth() --sets the mobHealthPct to 0 when the mob is killed
- if gmcp.Char.Items.Remove.location == "room" then
- if gmcp.Char.Items.Remove.item.id == gmcp.Char.Status.target then
- mobHealthPct = 0
- promptMobHealth()
- end
- end
- end
- function addPromptDef()
- svo.adddefinition("@otgMH", "promptMobHealth()")
- end
- registerAnonymousEventHandler("svo system loaded", "addPromptDef")
- registerAnonymousEventHandler("gmcp.Char.Items.Remove", "clearMobHealth")
- =========
- Assuming you have a prompt trigger somewhere to fire updates, add in the line
- promptMobHealth()
- If not, create a new trigger, give it a name like "Fire on prompt" and enter the following:
- Pattern (set to Lua function):
- return isPrompt()
- Script:
- promptMobHealth()
- Once all this is done, you need to register the custom prompt tag (only this time, it will be autoregisted when Svo next loads) by entering the following on the command line of Mudlet:
- vlua addPromptDef()
- You should now be able to use @otgMH in your Svo custom prompt.
- If you think this is useful, feel free to make any donations to Klendathu :)
- If there's any bugs, or you need some help, send me a message.
Advertisement
Add Comment
Please, Sign In to add comment