rc file causing lag on webtiles


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

Temple Termagant

Posts: 13

Joined: Thursday, 23rd April 2015, 05:07

Post Sunday, 26th April 2015, 02:54

rc file causing lag on webtiles

Here is my rc: http://dobrazupa.org/rcfiles/crawl-git/ayayaya.rc

Config is posted below for convenience.

  Code:
# For just the damage announcements
include += HDamage.rc

# For just the ===HDAtravel autotravel replacement macro
include += HDAtravel.rc

# For both the Message colors and Item colors
include += HDAColors.rc
# For just the Message colors
include += HDAMessageColors.rc
# For just the Item colors
include += HDAItemColors.rc

# For just the Force More prompts
include += HDAForceMore.rc

# Sources:
# https://github.com/crawl/crawl/tree/master/crawl-ref/source
# http://dobrazupa.org/rcfiles/crawl-git/qw.rc
# https://github.com/HilariousDeathArtist/DCSSConfigFile
# todo: unseen enemies, items other than bread, swap to old weapon, dont use is_traversable to check

# While wielding bread and if not at full HP and mana and if no enemies are nearby

<
function ready()
   if is_wielding_nonweapon() and (not is_hp_full() or not is_mp_full()) and not is_enemy_near() then
      local a = 0
      local b = 0
      for x = -1,1 do
         for y = -1,1 do
            if is_traversable(x,y) and not (x == 0 and y == 0) then
               a = x
               b = y
            end
         end
      end
      if a == 0 and b == 0 then
         return
      end
      magic(control(delta_to_vi(a, b)))
   end
end

function is_wielding_nonweapon()
   local weapon = items.equipped_at("Weapon")
   if (weapon == nil) then
      return
   end
   return (contains_string_in(weapon:name(), {"bread","meat","beef","fruit","jelly","pizza","scroll"}))
end

function is_hp_full()
   local hp, hmp = you.hp()
   return (hp == hmp)
end

function is_mp_full()
   local mp, mmp = you.mp()
   return (mp == mmp)
end

function is_enemy_near()
   local enemy_near = false
   for x = -8,8 do
         for y = -8,8 do
         m = monster.get_monster_at(x, y)
         local attitude_hostile = 0
         if m and (m:attitude() == attitude_hostile) and not (m:is_firewood()) then
            enemy_near = true
         end
      end
   end
   return enemy_near
end

function magic(command)
   crawl.process_keys(command .. string.char(27) .. string.char(27) .. string.char(27))
end

function is_traversable(x,y)
   local feat = view.feature_at(x,y)
   return feat ~= "unseen" and travel.feature_traversable(feat)
end

function control(c)
  return string.char(string.byte(c) - string.byte('a') + 1)
end

function delta_to_vi(dx, dy)
  local d2v = {
    [-1] = { [-1] = 'y', [0] = 'h', [1] = 'b'},
    [0]  = { [-1] = 'k',            [1] = 'j'},
    [1]  = { [-1] = 'u', [0] = 'l', [1] = 'n'},
  } -- hack
  return d2v[dx][dy]
end

function contains_string_in(name,t)
  for _, value in ipairs(t) do
    if string.find(name, value) then
      return true
    end
  end
  return false
end
>


My rc uses bits of Hilarious Death Artist's rc and qw's rc. There is some custom code I wrote to automate breadswinging: when the player wields food or a scroll, the player swings that item until they're at full health. The lag occurs when player wields food or a scroll, and it often takes seconds to see a response from the server. Another issue I'm having is that my custom code seems to be suppressing some of HDA's rc from working--namely, announcements of how much damage I've taken in the last turn. Could someone check my code and see what needs to change to fix these issues? I wish there was more documentation to make debugging easier.
User avatar

Vestibule Violator

Posts: 1509

Joined: Wednesday, 21st September 2011, 01:10

Location: St. John's, NL, Canada

Post Sunday, 26th April 2015, 03:09

Re: rc file causing lag on webtiles

I don't know about the lag, but you need to make your ready() function use HDAs AnnounceDamage() function.
Won all race/bg, unwon (online): Nem* Hep Uka
Favourites: 15-rune Trog, OgNe/OgIE/OgSu (usually Ash), Ds, Ru, SpEn, Ce of Chei, Qaz

Temple Termagant

Posts: 14

Joined: Sunday, 29th March 2015, 16:00

Post Saturday, 2nd May 2015, 06:35

Re: rc file causing lag on webtiles

* Probably related to message spam. Swinging at nothing generates a lot of messages, which seem to take a disproportionate amount of time to be sent to you and rendered. Use message_colour ^= mute:You swing at nothing to mute them, for example.

* You do know that you can bind a function that just does sendkeys('5') in a loop until at full health to a macro key, right? Hit Ctrl-D and enter ===functionname (without the () ) as the action. Should be easier than wielding bread every time you want to rest.

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 34 guests

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