Lua error


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

User avatar

Tomb Titivator

Posts: 778

Joined: Thursday, 13th March 2014, 20:15

Post Monday, 14th July 2014, 10:51

Lua error

Have this lines in my rc:
  Code:
: local dmg_old_hp = 0

<
  function ready()
    DmgTrack()
  end
>
 
: 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
:         huge_dmg_note(dmg_inturn)
:         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()
:         crawl.more_autoclear()         
:       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 huge_dmg_note(x)
:   crawl.take_note("Huge Dmg: " .. x .. " dmg")
: end

It works fine in 0.14, but in the 0.15 I got this message:
  Code:
Lua error: [string "/dgldir/rcfiles/crawl-git/SaintRoka.rc"]:268: bad argument
#1 to 'more_autoclear' (needs a boolean argument)
How to fix it ?
~online scoring~

Pig's in zen
Pig is nude
Unashamed

Crypt Cleanser

Posts: 720

Joined: Friday, 6th September 2013, 09:17

Post Monday, 14th July 2014, 11:13

Re: Lua error

change
  Code:
crawl.more_autoclear()

to
  Code:
crawl.more_autoclear(true)

For this message the author stickyfingers has received thanks:
Eyesburn
User avatar

Tomb Titivator

Posts: 778

Joined: Thursday, 13th March 2014, 20:15

Post Monday, 14th July 2014, 11:17

Re: Lua error

Thanks! :thumbsup:
~online scoring~

Pig's in zen
Pig is nude
Unashamed

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 7 guests

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