Can you show damage numbers?


Problems running or configuring the software, commands & options, compiling, different platforms, using the interface, documentation, etc.

Temple Termagant

Posts: 10

Joined: Saturday, 16th January 2016, 13:48

Post Tuesday, 13th December 2016, 20:28

Can you show damage numbers?

Hi, I'm pretty new to the use of the rc file, but at one point I saw somebody playing an online game and he had something configured that showed numbers for each hit he had taken. It looked really useful and if there's any way I can turn that on(either online or offline, I play both), I would very much appreciate knowing how.

Ziggurat Zagger

Posts: 4432

Joined: Friday, 8th May 2015, 17:51

Post Tuesday, 13th December 2016, 20:35

Re: Can you show damage numbers?

Try adding this to your rc/init file.

  Code:
: local dmg_old_hp = 0

: function DmgTrack()
:   local bot_hp, bot_mhp = you.hp()
:   local dmg_inturn = 0
:   local huge_int = 0
:   local percent_hp = 0
:   local percent_old_hp = 0
:   local percent_hp_txt = "--%"
:   if dmg_old_hp > 0 then
:     if bot_hp < dmg_old_hp then
:       dmg_inturn = dmg_old_hp - bot_hp
:       percent_old_hp = math.ceil((dmg_old_hp*100)/bot_mhp)
:       percent_hp = math.ceil((bot_hp*100)/bot_mhp)
:       percent_hp_txt = percent_hp .. "%"
:       if percent_hp < 30 then
:         percent_hp_txt = "<red>" .. percent_hp_txt .. "</red>"
:       elseif percent_hp < 55 then
:         percent_hp_txt = "<lightred>" .. percent_hp_txt .. "</lightred>"
:       elseif percent_hp < 75 then
:         percent_hp_txt = "<yellow>" .. percent_hp_txt .. "</yellow>"
:       end   
:       percent_hp_txt = percent_hp_txt .. "<darkgray>(" .. bot_hp .. "hp)</darkgray>"
:       if dmg_inturn > (bot_hp*0.25) then
:           crawl.mpr("<white>Huge Dmg:</white> <red>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</red> hp: " .. percent_hp_txt)
:           dmg_old_hp = bot_hp
:           crawl.flush_prev_message()
:           crawl.more()
:       else
:         if dmg_inturn > (bot_hp*0.15) then
:           crawl.mpr("<white>Damage</white>: <yellow>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</yellow>   hp: " .. percent_hp_txt)
:         else
:           crawl.mpr("<white>Damage</white>: -" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "   hp: " .. percent_hp_txt)
:         end
:       end
:       crawl.flush_prev_message()
:     end
:   end
:   dmg_old_hp = bot_hp
: end


If you don't like to get "more" prompt after getting high damage, remove

  Code:
:           crawl.flush_prev_message()
:           crawl.more()
Underestimated: cleaving, Deep Elf, Formicid, Vehumet, EV
Overestimated: AC, GDS
Twin account of Sandman25
User avatar

Zot Zealot

Posts: 991

Joined: Monday, 15th April 2013, 15:10

Location: Augsburg, Germany

Post Tuesday, 13th December 2016, 20:49

Advanced additonal question.

VeryAngryFelid wrote:If you don't like to get "more" prompt after getting high damage, remove [...]

I don't like the "You die..." message after getting high damage. What can I do?

Spoiler: show
;-)

Ziggurat Zagger

Posts: 4432

Joined: Friday, 8th May 2015, 17:51

Post Tuesday, 13th December 2016, 20:52

Re:

Turukano wrote:Advanced additonal question.

VeryAngryFelid wrote:If you don't like to get "more" prompt after getting high damage, remove [...]

I don't like the "You die..." message after getting high damage. What can I do?

Spoiler: show
;-)


Surprisingly you will get a serious answer from me. This is why I wrote "Try" in my previous message. I am not sure that there are no mistakes in that script because I edited out some extra functionality which automatically saves game when I get too high damage. That really helps to prevent "You die..." message, especially if you don't reload the game immediately and take your time to analyze situation instead ;)
Underestimated: cleaving, Deep Elf, Formicid, Vehumet, EV
Overestimated: AC, GDS
Twin account of Sandman25

Temple Termagant

Posts: 10

Joined: Saturday, 16th January 2016, 13:48

Post Wednesday, 14th December 2016, 07:05

Re: Can you show damage numbers?

I vastly appreciate the quick response, but tragically it doesn't seem to be working for me either offline or online. I'm not very good at tinkering with options so it might be an error with the code or simply an error of my ignorance- do I just copy paste the whole thing and put it in the init/rc file?

Mines Malingerer

Posts: 35

Joined: Wednesday, 5th February 2014, 19:07

Post Wednesday, 14th December 2016, 14:04

Re: Can you show damage numbers?

It does not work for me, either. I am not too familiar with lua or crawl's framework around it, but it seems to me like this function is implemented but not called anywhere.

Also, I am not sure when the rcfile is compiled, so it makes things hard to test (when crawl starts? when a game starts? when a save is loaded?) talking offline here.
limboring→optimal sanity = 0

Ziggurat Zagger

Posts: 4432

Joined: Friday, 8th May 2015, 17:51

Post Wednesday, 14th December 2016, 14:34

Re: Can you show damage numbers?

Oh, sorry, guys, I forgot to post another thing, it should be called from "ready" function.
So here is the updated version, I have just tested it and it works.

  Code:
: local dmg_old_hp = 0

: function DmgTrack()
:   local bot_hp, bot_mhp = you.hp()
:   local dmg_inturn = 0
:   local huge_int = 0
:   local percent_hp = 0
:   local percent_old_hp = 0
:   local percent_hp_txt = "--%"
:   if dmg_old_hp > 0 then
:     if bot_hp < dmg_old_hp then
:       dmg_inturn = dmg_old_hp - bot_hp
:       percent_old_hp = math.ceil((dmg_old_hp*100)/bot_mhp)
:       percent_hp = math.ceil((bot_hp*100)/bot_mhp)
:       percent_hp_txt = percent_hp .. "%"
:       if percent_hp < 30 then
:         percent_hp_txt = "<red>" .. percent_hp_txt .. "</red>"
:       elseif percent_hp < 55 then
:         percent_hp_txt = "<lightred>" .. percent_hp_txt .. "</lightred>"
:       elseif percent_hp < 75 then
:         percent_hp_txt = "<yellow>" .. percent_hp_txt .. "</yellow>"
:       end   
:       percent_hp_txt = percent_hp_txt .. "<darkgray>(" .. bot_hp .. "hp)</darkgray>"
:       if dmg_inturn > (bot_hp*0.25) then
:           crawl.mpr("<white>Huge Dmg:</white> <red>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</red> hp: " .. percent_hp_txt)
:           dmg_old_hp = bot_hp
:           crawl.flush_prev_message()
:           crawl.more()
:       else
:         if dmg_inturn > (bot_hp*0.15) then
:           crawl.mpr("<white>Damage</white>: <yellow>-" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "</yellow>   hp: " .. percent_hp_txt)
:         else
:           crawl.mpr("<white>Damage</white>: -" .. (percent_old_hp-percent_hp) .. "%<darkgray>(-" .. dmg_inturn .. "hp)</darkgray>" .. "   hp: " .. percent_hp_txt)
:         end
:       end
:       crawl.flush_prev_message()
:     end
:   end
:   dmg_old_hp = bot_hp
: end

{
function ready()
   DmgTrack()
end
}
Underestimated: cleaving, Deep Elf, Formicid, Vehumet, EV
Overestimated: AC, GDS
Twin account of Sandman25

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 15 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.