In the mud I play the prompt line doesn't allow you to see your current health/max health current movement/max movement and that always bugged me. So, with about 2 hours of forum searching, examples here and there, I got this to work. Sort of...
Original prompt:
57H 122V 1596X 23C Exits:D> -- looks ugly
New prompt:
76/76H 122/122V 3727X 21C Exits:D -- much prettier
How I did it:
Into my scriptfile.lua goes:
On my mud when you type 'score' you will get a line like: "You have 70(76) hit and 120(122) movement points." So for every time I hit score I'm defining max health/moves for myprompt_line function.
The problems:
In the 2nd trigger I posted I wanted to delay the ColourNote 2 seconds, but I couldn't figure out how to do that with DoAfter.
The bigger problem, though, is manipulating the 'new' prompt line. If I want to have the hp change color depending on the % of health left I'm not quite sure if I can do it since the prompt line is now a colournote(not coming from the mud) and I can't use triggers.
Anyway, I had fun trying to get this thing to work even if it took me almost 2 hours. :)
Original prompt:
57H 122V 1596X 23C Exits:D> -- looks ugly
New prompt:
76/76H 122/122V 3727X 21C Exits:D -- much prettier
How I did it:
Into my scriptfile.lua goes:
function myprompt_line (name, line, wildcards)
ColourNote ("white", "black", wildcards.health .. "/" .. GetVariable("maxhealth") ..
"H " .. wildcards.moves .. "/" .. GetVariable("maxmoves") ..
"V " .. wildcards.exp .. "X " .. wildcards.coins .. "C "
.. wildcards.other)
end
Triggers:
<triggers>
<trigger
enabled="y"
expand_variables="y"
group="Prompt_Line"
keep_evaluating="y"
match="(?P<health>\d+)H (?P<moves>\d+)V (?P<exp>\d+)X (?P<coins>\d+)C (?P<other>.*?)\>$"
omit_from_output="y"
regexp="y"
script="myprompt_line"
send_to="12"
sequence="100"
>
</trigger>
</triggers>
<triggers>
<trigger
enabled="y"
expand_variables="y"
group="Prompt_Line"
match="^You have (\d+)\((\d+)\) hit and (\d+)\((\d+)\) movement points\.$"
regexp="y"
send_to="12"
sequence="100"
>
<send>SetVariable("maxhealth", "%2")
SetVariable("maxmoves", "%4")
ColourNote("silver", "blue", "Maximum health and movement defined")
</send>
</trigger>
</triggers>
On my mud when you type 'score' you will get a line like: "You have 70(76) hit and 120(122) movement points." So for every time I hit score I'm defining max health/moves for myprompt_line function.
The problems:
In the 2nd trigger I posted I wanted to delay the ColourNote 2 seconds, but I couldn't figure out how to do that with DoAfter.
The bigger problem, though, is manipulating the 'new' prompt line. If I want to have the hp change color depending on the % of health left I'm not quite sure if I can do it since the prompt line is now a colournote(not coming from the mud) and I can't use triggers.
Anyway, I had fun trying to get this thing to work even if it took me almost 2 hours. :)