{----------------------------------------------------------------------------------------------webtiles pre- movecareful=AP
--WIP rc file, no promises
--"The difference between the <> and {} is when the code gets executed.
--Code {}, it is executed right away. Other Lua code is executed only
--after the entire init file is read in."
--order: {...}; read options; execute options, :... and <...> in order.
VERSION=tonumber(crawl.version("major"))
--intended for 0.26+
LAST_DEST=(VERSION<.31 and "\13" or "\9") --key to select the last destination in the goto menu. Enter or Tab
----------------------------------------------------------------------------------------------
--movekeys
--enter the move keys you use here, similar to bindkey format
--
movekeys={
["CMD_MOVE_UP_LEFT"] = "u",
["CMD_MOVE_LEFT"] = "j",
["CMD_MOVE_DOWN_LEFT"] = "m",
["CMD_MOVE_UP"] = "i",
["CMD_MOVE_DOWN"] = ",",
["CMD_MOVE_UP_RIGHT"] = "o",
["CMD_MOVE_RIGHT"] = "l",
["CMD_MOVE_DOWN_RIGHT"] = "."}
----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
-- utilities
--
----------------------------------------------------------------------------------------------
function utf8char(unicode)
-- mostly cited from https://github.com/Stepets/utf8.lua/blob/master/utf8.lua
if unicode <= 0x7F then return string.char(unicode) end
if (unicode <= 0x7FF) then
local Byte0 = 0xC0 + math.floor(unicode / 0x40);
local Byte1 = 0x80 + (unicode % 0x40);
return string.char(Byte0, Byte1);
end;
if (unicode <= 0xFFFF) then
local Byte0 = 0xE0 + math.floor(unicode / 0x1000);
local Byte1 = 0x80 + (math.floor(unicode / 0x40) % 0x40);
local Byte2 = 0x80 + (unicode % 0x40);
return string.char(Byte0, Byte1, Byte2);
end;
if (unicode <= 0x10FFFF) then
local code = unicode
local Byte3= 0x80 + (code % 0x40);
code = math.floor(code / 0x40)
local Byte2= 0x80 + (code % 0x40);
code = math.floor(code / 0x40)
local Byte1= 0x80 + (code % 0x40);
code = math.floor(code / 0x40)
local Byte0= 0xF0 + code;
return string.char(Byte0, Byte1, Byte2, Byte3);
end;
error 'Unicode cannot be greater than U+10FFFF!'
end
----------------------------------------------------------------------------------------------
--get_command
--depends on utf8char
--dummy_keys_made=0
dummy_keys_made=1 --TD:modularize
function get_command(cmd,nodummy,bindkey)
--returns key combo of cmd, ready to be plugged into sendkeys
--makes dummy keys from U+10FFFF downward if it can't get the keycode, or that keycode can't be send with sendkeys
--because sendkeys is less buggy than do_commands
--use bindkey to plug into bindkey instead
local ok=true
local result=crawl.get_command(cmd)
result=result:gsub("Space",' ')
--theoretical To-Do: Reverse all special cases of keycode_to_name in https://github.com/crawl/crawl/blob/master/crawl-ref/source/macro.cc
--just add special cases in that line above as needed. Or accept adding dummy keys!
local modifier=""..(result:match("Ctrl.") and (bindkey and "^" or "\*") or "")..(result:match("Shift.") and "\/" or "")
if modifier=="\*\/" or modifier:match("\/") and bindkey then ok=false else
result=result:gsub("Ctrl.",""):gsub(".ppercase.",""):gsub("Shift.","")
--if result=="0" then
----crawl.setopt("bindkey [
--error 'error in rc function get_command, no bound key'
--end
--if result:match("Numpad") then result=result:gsub("Numpad ","100") end
if not(result==result:match("[%w%s%p]"))
and not pcall(function()
if #result==1 then
--pcall(function() result=utf8char(string.byte(result)) end)
result=utf8char(string.byte(result))
elseif result:match("%d") and not(result:match("F")) and not(result:match("%-")) then
result=utf8char(tonumber(result:match("%d+")))
else--if bindkey and result==result:match("F%d+") then --TD check if works
ok=false
end
end)
then ok=false end
end
if not ok then --make a dummy key instead
if nodummy then
error 'get_command can not get command.' --TD ask player and use crawl.getch and save result and use result next time
else
local number=1114111-dummy_keys_made
dummy_keys_made=dummy_keys_made+1
crawl.setopt("bindkey=[\\{"..tostring(number).."}] "..cmd)
return utf8char(number)
end
else
return modifier..result
end
end
----------------------------------------------------------------------------------------------------------------
--r_td
--usage: add r_run_r_td() at the very end of ready()
r_td={}
--table of functions to call in ready()
--table.insert(r_td,functionname) to run functionname() once in ready
--functionname may add itself to r_td to be run next time again
--r_td is empty by the time the loop through the functions is running
--r_td[functionname]=n can be used to remember how often the function was added, for example.
--only the ipairs sequence starting at 1 will be run. Don't have positive keys outside of the sequence.
function r_run_r_td()
if next(r_td) then
local td={}
for k in pairs(r_td) do
td[k]=r_td[k]
r_td[k]=nil
end
for k in ipairs(td) do
td[k]()
td[k]=nil
end
end
end
----------------------------------------------------------------------------------------------------------------
--r_funcs
--usage: add r_run_r_funcs() to ready()
r_funcs={}
function r_run_r_funcs()
for k in ipairs(r_funcs) do
r_funcs[k]()
end
end
----------------------------------------------------------------------------------------------------------------
--cmsg_funcs
--usage: add cmsg_run_cmsg_funcs(msg, ch) to c_message(msg, ch)
cmsg_funcs={}
function cmsg_run_cmsg_funcs(msg, ch)
for k in ipairs(cmsg_funcs) do
cmsg_funcs[k](msg, ch)
end
end
------------------------------------------------------------------------------------------------------------
--interrupt
--some things depend on it.
--intent: call do_interrupt(string) if out-of-combat automatic actions should stop doing something asap, because of information your code just detected.
--depends on r_td
interrupt=false
lastinterrupt={}
interrupt_num=0
--local interrupt_turn=-100
interrupt_was={}
function reset_interrupt()
--echoall("---"..tostring(interrupt))--
if interrupt then interrupt_was=interrupt end
interrupt=false
--interrupt_turn=you.turns()
interrupt_num=0
end
function do_interrupt(reason)
if reason then
interrupt_num=interrupt_num+1
if not(interrupt) then interrupt={} end
interrupt[interrupt_num]=reason
if interrupt then lastinterrupt=interrupt end
for k in pairs(r_td) do
local v=r_td[k]
if v==reset_interrupt then
table.remove(r_td,k)
end
end
table.insert(r_td, (function() table.insert(r_td, 1, reset_interrupt) end)) --TD reset should be at the very end of next turns ready, or very beginning of the ready after that. This only does that in respect to r_td, assuming that other ready functions don't use do_interrupt... redo this with an r_interrupt function
end
end
function tallmatch(t, ...)
--return a match if all elements of t match with some argument
local args={...}
local res=nil
for _,e in pairs(t) do
local res_e=nil
for _,s in pairs(args) do
local m=e:match(s)
if m then res_e=m end
end
if not res_e then return end
res=res_e
end
return res
end
function tmatch(t, ...)
--return a match if one element of t matches with an argument
local args={...}
for _,e in pairs(t) do
for _,s in pairs(args) do
local m=e:match(s)
if m then return m end
end
end
end
----------------------------------------------------------------------------------------------------------------
function autopickup_item_within(r)
for x = -r,r do
for y = -r,r do
for k,it in pairs(items.get_items_at(x,y) or {}) do
if not(it.dropped) and ch_force_autopickup(it, it:name()) then return true end
end
end
end
return false
end
----------------------------------------------------------------------------------------------------------------
function delta_to_cmd(dx, dy) --cited from autofight lua
local d2v = {
[-1] = { [-1] = "CMD_MOVE_UP_LEFT", [0] = "CMD_MOVE_LEFT", [1] = "CMD_MOVE_DOWN_LEFT"},
[0] = { [-1] = "CMD_MOVE_UP", [1] = "CMD_MOVE_DOWN"},
[1] = { [-1] = "CMD_MOVE_UP_RIGHT", [0] = "CMD_MOVE_RIGHT", [1] = "CMD_MOVE_DOWN_RIGHT"}, }
return d2v[dx][dy]
end
function delta_to_safe_cmd(dx, dy)
local d2v = {
[-1] = { [-1] = "CMD_SAFE_MOVE_UP_LEFT", [0] = "CMD_SAFE_MOVE_LEFT", [1] = "CMD_SAFE_MOVE_DOWN_LEFT"},
[0] = { [-1] = "CMD_SAFE_MOVE_UP", [1] = "CMD_SAFE_MOVE_DOWN"},
[1] = { [-1] = "CMD_SAFE_MOVE_UP_RIGHT", [0] = "CMD_SAFE_MOVE_RIGHT", [1] = "CMD_SAFE_MOVE_DOWN_RIGHT"}, }
return d2v[dx][dy]
end
function target_delta_to_cmd(dx, dy)
local d2v = {
[-1] = { [-1] = "CMD_TARGET_UP_LEFT", [0] = "CMD_TARGET_LEFT", [1] = "CMD_TARGET_DOWN_LEFT"},
[0] = { [-1] = "CMD_TARGET_UP", [1] = "CMD_TARGET_DOWN"},
[1] = { [-1] = "CMD_TARGET_UP_RIGHT", [0] = "CMD_TARGET_RIGHT", [1] = "CMD_TARGET_DOWN_RIGHT"}, }
return d2v[dx][dy]
end
-------------------------------------------------------------------------------------------------------------
--utilities end
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
--move careful
--move careful, automatically!
--more prompt when danger starts, including things trying to be invisible
--other warnings, such as yes/no prompts for being slowed
--rebinds movement keys to CMD_SAFE_MOVE keys while out of danger
--also what warn_more_monsters does. TD:modularize warn_more_monsters?
--TD:generalize bindkeys. Done?
--depends on: movekeys, utilities, (TD: r_funcs, cmsg_funcs, start_funcs, save_funcs), macro_save
--assumes manual entries in ready, cmsg, chmon, and manual calls at start and save macro
----------------------------------------------------------------------------------------------------------------
move_careful = false --mostly you.feel_safe, true if manual exploring is expected and enforced to be "careful" with --more--
dma_table={} --for compatibility with disable_move_attack
local AUTO_WMM=true --setting this to false here probably deactivates the warn_more_monsters part
local wmm_on = false
local monster_warning = false
local reset_more_message_options = false
local resume_ap=true --true: resume AP when move_careful would resume. False: Don't automatically resume AP. Only false if AP is off.
local shouldnt_feel_safe=false --only true if you.feel_safe is true, but it's kinda wrong.
--initialised by c_persist
local autopickup_is_on = true --the last known state of options.autopick_on
local td_start_deactivate_autopickup=true
function r_meta_move_careful()
--the only function actually called in ready()
--echoall("mmc")--
r_cmsg_warnings()
r_warnings()
r_chmon_warn_more_monsters()
r_is_autopickup_on()
r_chk_fov()
r_move_careful()
r_warn_more_monsters()
r_monster_warning()
end
--local movekeys={}--getting this via get_command does not work depending on keybinds. Basically ignores that movekeys are usually bound to both letters and number keys
function set_safe_move_keys(safe_move_keys)
if not(safe_move_keys) then
for x = -1,1 do
for y = -1,1 do
local cmd=delta_to_cmd(x,y)
if cmd then
local key=movekeys[cmd]
crawl.setopt("bindkey = ["..key.."] "..delta_to_cmd(x,y))
end
end
end
else
for x = -1,1 do
for y = -1,1 do
local cmd=delta_to_cmd(x,y)
if cmd then
if not movekeys[cmd] then
movekeys[cmd]=get_command(cmd,true,true)
echoall(movekeys[cmd], cmd)--TD
end
local key=movekeys[cmd]
crawl.setopt("bindkey = ["..key.."] "..delta_to_safe_cmd(x,y))
end
end
end
end
end
function toggle_move_careful_on()
if resume_ap then crawl.setopt("default_autopickup=true"); autopickup_turns_on() end
if AUTO_WMM and wmm_on then toggle_warn_more_monsters(true) end
move_careful = true
--crawl.setopt("force_more_message -= into view")
--crawl.setopt("force_more_message += You are feeling hungry")
set_safe_move_keys(true)
--crawl.setopt("bindkey = [j] CMD_SAFE_MOVE_LEFT")
--crawl.setopt("bindkey = [,] CMD_SAFE_MOVE_DOWN")
--crawl.setopt("bindkey = [i] CMD_SAFE_MOVE_UP")
--crawl.setopt("bindkey = [l] CMD_SAFE_MOVE_RIGHT")
--crawl.setopt("bindkey = [u] CMD_SAFE_MOVE_UP_LEFT")
--crawl.setopt("bindkey = [o] CMD_SAFE_MOVE_UP_RIGHT")
--crawl.setopt("bindkey = [m] CMD_SAFE_MOVE_DOWN_LEFT")
--crawl.setopt("bindkey = [.] CMD_SAFE_MOVE_DOWN_RIGHT")
dma_table={}
crawl.mpr("No danger in sight...")
end
function toggle_move_careful_off()
crawl.flush_input()
you.stop_activity()
if autopickup_is_on then deactivate_autopickup() end
--if not(wmm_on) then crawl.more() end
if not(monster_warning) then
monster_warning = true
crawl.mpr("!")
crawl.more()
end
--if AUTO_WMM and wmm_on==false then toggle_warn_more_monsters(true) end --already done in next line
toggle_move_careful_off_noprompt()
end
function toggle_move_careful_off_noprompt()
crawl.flush_input()
you.stop_activity()
if autopickup_is_on then deactivate_autopickup() end
if AUTO_WMM and wmm_on==false then toggle_warn_more_monsters(true) end
move_careful = false
--reset_more_message_options = true
set_safe_move_keys(false)
--crawl.setopt("bindkey = [j] CMD_MOVE_LEFT")
--crawl.setopt("bindkey = [,] CMD_MOVE_DOWN")
--crawl.setopt("bindkey = [i] CMD_MOVE_UP")
--crawl.setopt("bindkey = [l] CMD_MOVE_RIGHT")
--crawl.setopt("bindkey = [u] CMD_MOVE_UP_LEFT")
--crawl.setopt("bindkey = [o] CMD_MOVE_UP_RIGHT")
--crawl.setopt("bindkey = [m] CMD_MOVE_DOWN_LEFT")
--crawl.setopt("bindkey = [.] CMD_MOVE_DOWN_RIGHT")
dma_table={}
end
function r_move_careful()
--force more if danger starts
--move careful, aka explore manually. Also used to decide whether it is safe to equip things
if move_careful then
if (not(you.feel_safe()) or shouldnt_feel_safe or you.silenced()) then
toggle_move_careful_off() --this also sends a --more--
else
if not(autopickup_is_on) then
toggle_move_careful_off()
end
end
else
if you.feel_safe() and not(shouldnt_feel_safe or you.silenced()) then
if autopickup_is_on or resume_ap then
toggle_move_careful_on()
else
crawl.mpr("AP is off.",4)
end
end
end
--
--if not(move_careful) and reset_more_message_options then --reset to default: Here used when there is danger
--reset_more_message_options = false
--if not(AUTO_WMM) then crawl.setopt("force_more_message += into view") end
--crawl.setopt("force_more_message -= You are feeling hungry")
--end
end
function r_chk_fov()
--react to "indirectly" visible invisible monster
--also safeguards against you.feel_safe false positives
if resume_ap then
shouldnt_feel_safe=false
local detected=false
local LOS=you.los()
for x = -LOS,LOS do
for y = -LOS,LOS do
if you.see_cell_no_trans(x, y) then
local monster=monster.get_monster_at(x,y)
if view.invisible_monster(x,y) then
crawl.mpr("There is something invisible around!")
if autopickup_is_on then deactivate_autopickup() else crawl.more() end
resume_ap=false
detected=true; break
elseif
you.feel_safe()
and monster
and not(
monster:is_firewood()
or monster:attitude()>2
or monster:name():match("fire vortex") --TD:deduplicate
or monster:name():match("spatial vortex")
)
then
crawl.mpr(" you.feel_safe() is true.")
shouldnt_feel_safe=true
--detected=true; break
end
end
end
if detected then break end
end
end
end
------------------------------------------------------------------------------------------------------------
function start_deactivate_autopickup()
if c_persist.ap==nil then
c_persist.ap={}
end
if c_persist.ap[you.name()]==nil then
c_persist.ap[you.name()]=true
end
--autopickup_is_on = c_persist.ap[you.name()]
td_start_deactivate_autopickup=not(c_persist.ap[you.name()])
c_persist.ap[you.name()]=nil
--if save_is_autopickup_off then autopickup_is_on=false td_start_deactivate_autopickup=true end
--if not(autopickup_is_on) then autopickup_turns_off() end
if td_start_deactivate_autopickup then
if not(you.turns()==0) then
crawl.mpr("Autopickup was off when saving.")
deactivate_autopickup()
resume_ap=false
end
--if not(autopickup_is_on) then td_start_deactivate_autopickup=false end
end
end
function save_is_autopickup_on()
c_persist.ap[you.name()]=(autopickup_is_on or resume_ap)
end
local cmsg_sending = false
function deactivate_autopickup()
--crawl.mpr("lua detected that AP should be OFF:")
--crawl.do_commands({"CMD_TOGGLE_AUTOPICKUP"})
--crawl.sendkeys( get_command("CMD_TOGGLE_AUTOPICKUP") )
crawl.setopt("default_autopickup = false") --this does turn AP off, not just the default
if autopickup_is_on then
if not(cmsg_sending) then--todo
cmsg_sending=true
--crawl.mpr("Turning AP off.")
cmsg_sending=false
end
autopickup_turns_off()
end
end
function r_is_autopickup_on()
if not(options.autopick_on==autopickup_is_on) then
if autopickup_is_on then
resume_ap=false --this should only be done here if you turned it off manually, or crawl turned it off for you.
autopickup_turns_off()
else
autopickup_turns_on()
end
end
--if used_deactivate_autopickup then crawl.mpr("Turning AP off."); used_deactivate_autopickup=false end
end
function cmsg_is_autopickup_on(msg) --goes in c_message(msg, ch)
--if not(msg:match("%-%-%-")) then crawl.mpr("---"..msg) end
if msg:match("utopickup is now off") then resume_ap=false end
if msg:match("utopickup is now on") then resume_ap=true end
if
msg:match(".omething.?.?.?.?.?.?.?.?.?.?.?.?.?.?.?.? misses you%p") or
msg:match(".omething enters a") or
msg:match(".omething sets off the alarm") or
msg:match(".omething launches a net") or
msg:match("web moves frantically as something is caught in it") or
msg:match("ou feel you are being watched by something")
then
crawl.setopt("default_autopickup = false")
if resume_ap then
resume_ap=false
if not(cmsg_sending) then
cmsg_sending=true
crawl.mpr("There is something invisible around!!")
cmsg_sending=false
end
end
if autopickup_is_on then
--deactivate_autopickup()
autopickup_turns_off()
else
crawl.more()
end
end
end
--function r_reset_cmsg_sending()
--cmsg pauses and calls itself if it sends a message
--always check cmsg_sending and set cmsg_sending=true before sending something in cmsg
--actually, because it pauses you can just reset it immediately, so this function is unnecessary
--unused, this can be deleted
--cmsg_sending = false
--end
local wmm_noap_on = false
function autopickup_turns_off()
autopickup_is_on=false
if AUTO_WMM and not(resume_ap) then
if wmm_on==false then --TD:is this ever nil? replace comp with not
toggle_warn_more_monsters(true)
else
toggle_warn_more_monsters(true)
toggle_warn_more_monsters(true)
end
end
--crawl.setopt("force_more_message -= into view")
end
function autopickup_turns_on()
autopickup_is_on=true
if not(AUTO_WMM) and wmm_on then toggle_warn_more_monsters(true) end
--if not(move_careful) and not(AUTO_WMM) then crawl.setopt("force_more_message += into view") end
end
-------------------------------------------------------------------------------------------------------------
--warn_more_monsters: info about monsters entering sight that are new since wmm was activated, sending a more prompt if needed
--limitations: Only identifies monsters by name. Doesn't count down as monsters die or leave FOV, but that's also kinda the point sometimes
local wmm_just_on = false
local wmm_list = {}
local r_wmm_list = {}
local new_monsters = ""
function toggle_warn_more_monsters(silent) --silent means called by ap turning off, or AUTO_WMM. state of silent is noted in wmm_noap_on, but that is unused otherwise.
--must be silent if called from cmsg!
if wmm_on then
wmm_on = false
wmm_list={}
if not(silent) then crawl.mpr("warn_more_monsters off") end
wmm_noap_on=false
else
wmm_on = true
wmm_just_on = true
if not(silent) then
crawl.mpr("warn_more_monsters on")
else
wmm_noap_on=true
end
end
end
--crawl.setopt("runrest_ignore_monster ^= fire vortex:2") --overwritten by ch_mon
--crawl.setopt("runrest_ignore_monster ^= spatial vortex:2")
local wmm_options="of distortion, carrying a wand of"
if VERSION<.28 then
crawl.setopt("flash_screen_message +=".." is wielding.*distortion, there is a.*distortion, of distortion comes into view, carrying a wand of")
end
function is_in_wlist(name,id,wlist)
if not(wlist[name]==nil) and wlist[name]>=id then
return true
else
return false
end
end
function wmm_count_monster(monster)
local x=monster:x_pos()
local y=monster:y_pos()
if
not(monster:attitude()>2)
and not(monster:status():match("summoned"))
--and not(monster:name():match("fire vortex"))
--and not(monster:name():match("spatial vortex"))
and you.see_cell_no_trans(x, y)
then
local w_monster_name = monster:name()
local wmm_count = (r_wmm_list[w_monster_name] or 0)+1
r_wmm_list[w_monster_name] = wmm_count
--crawl.mpr(w_monster_name.."w"..tostring(wmm_count))--
if not(is_in_wlist(w_monster_name,wmm_count,wmm_list)) then
wmm_list[w_monster_name] = wmm_count
if not(new_monsters=="") then new_monsters = new_monsters..", " end
if VERSION>.27 then
new_monsters = new_monsters..monster:target_desc().." "..tostring(wmm_count)
--TD monster:speed_description() for abominations?
else
new_monsters = new_monsters..w_monster_name.." "..tostring(wmm_count)
--TD add status?
end
end
end
end
local wmm_turn_knowledge={} --wmm_turn_knowledge[name][n]={ x, y }
local wmm_turn_endstate={} --[x][y]=name
local wmm_chmon_turnover=false
local wmm_turn_knowledge2={} --debug
function chmon_warn_more_monsters(monster, is_safe, moving, dis)
--[[
1. things as before your action
2. things as they are after your action instantly happened
3. things that change in between (still same timestamp)
4. things as they are when your turn starts (next timestamp)
could identify 1 with the last 4, not used
starttime, notturnover: 1,2
starttime, turnover: 2,3
endtime, turnover: 4 sometimes
endtime, notturnover: 4
currently assumes that only one turn happens between ready() calls
--TD: make wmm_chmon_turnover less hacky, add timestamps for ready and chmon calls
]]
if true then--debug
local v=tostring(you.time()).." "..tostring(wmm_chmon_turnover).." "..tostring(you.turn_is_over())..": "..tostring(monster:x_pos()).." "..tostring(monster:y_pos()).." "..monster:name().." "..monster:status()..(is_safe and " is_safe" or "")..(monster:attitude()>2 and " "..tostring(monster:attitude()) or "")
if wmm_turn_knowledge2[v]==nil then
wmm_turn_knowledge2[v]=false
table.insert(wmm_turn_knowledge2, v)
end
end
if
monster:name():match("fire vortex")
or monster:name():match("spatial vortex")
then
return dis>2
end
if
not(is_safe)
or not(monster:attitude()>2)
and (
monster:name():match("tentacle segment")
or monster:status("slightly transparent")
)
then
if wmm_on==false and AUTO_WMM then toggle_warn_more_monsters(true) end
local x=monster:x_pos()
local y=monster:y_pos()
local name=monster:name()
--if monster:status("slightly transparent") and not(you.see_invisible()) thentodo
--crawl.mpr("ch_mon info leak: "..name.." "..tostring(x).." "..tostring(y))
--if autopickup_is_on then deactivate_autopickup() end
--if resume_ap then resume_ap=false; crawl.more() end
----TD does this happen outside of wizmode?
--end
if not(wmm_chmon_turnover) then
wmm_chmon_turnover=you.time()
you.stop_activity()
--crawl.flush_input() --TD necessary? works? annoys xsummon?
do_interrupt("chmon_saw_monster")
end
if move_careful and autopickup_item_within(0) then deactivate_autopickup() end--this prevents AP picking up something you just moved onto, even though a monster entered and left the screen
if wmm_chmon_turnover==you.time() then
if you.turn_is_over() then
if not(wmm_turn_knowledge[name]) then
wmm_turn_knowledge[name]={}
end
local len=#wmm_turn_knowledge[name]
if
len==0
or not( wmm_turn_knowledge[name][len][1]==x
and wmm_turn_knowledge[name][len][2]==y )
then
table.insert(wmm_turn_knowledge[name],{ x, y })
end
end
elseif not(you.turn_is_over()) then
if not(wmm_turn_endstate[name]) then
wmm_turn_endstate[name]=1
end
if not(wmm_turn_endstate[x]) then
wmm_turn_endstate[x]={}
end
if wmm_turn_endstate[x][y]==nil then
wmm_turn_endstate[x][y]=name
wmm_count_monster(monster)
--
--local v=tostring(you.time()).." "..tostring(you.turn_is_over()).." "..tostring(monster:x_pos()).." "..tostring(monster:y_pos()).." "..monster:name().." "..monster:status()
--table.insert(wmm_turn_knowledge2, v)
elseif wmm_turn_endstate[x][y]~=name then
echoall("chmon_warn_more_monsters warning: "..name.." where there is expected to be "..wmm_turn_endstate[x][y].."at"..tostring(x).." "..tostring(y))
wmm_turn_endstate[x][y]=name
wmm_count_monster(monster)
end
end
if is_safe and monster:name():match("tentacle segment") then
return is_safe --otherwise the game spams "N tentacle segments come into view"
else
return false
end
end
return is_safe
end
local cleartrail=false
function r_chmon_warn_more_monsters()
wmm_chmon_turnover=false
wmmtest=""
for k in ipairs(wmm_turn_knowledge2) do--debug
--if wmm_turn_knowledge2[k] then crawl.mpr(wmm_turn_knowledge2[k]) end
if wmm_turn_knowledge2[k] then wmmtest=wmmtest..","..wmm_turn_knowledge2[k] end
wmm_turn_knowledge2[k] = nil
end
wmm_turn_knowledge2={}
if wmm_on then
local leaving
for name in pairs(wmm_turn_knowledge) do
if not(wmm_turn_endstate[name]) then
local path=wmm_turn_knowledge[name]
local x=path[#path][1]
local y=path[#path][2]
--if monster.get_monster_at(x, y) and monster.get_monster_at(x, y):name()==name then
--wmm_count_monster(monster.get_monster_at(x, y))
--false positive if multiple monsters of the same name
--this would only be needed for, bats, maaaybe
--else
--crawl.mpr("that "..name.." was in your LOS!")
leaving=(leaving and leaving..", " or "")..name.." at "..tostring(x).." "..tostring(y)
if not(move_careful) and not(is_in_wlist(name,(r_wmm_list[name] or 0)+1,wmm_list)) then
crawl.mpr(""..name.." last seen at "..tostring(x).." "..tostring(y).."")
end
if VERSION<.28 then
if not(you.branch()=="Abyss") then --no exclusions in Abyss
for k in pairs(path) do
pcall(function() travel.set_exclude(path[k][1],path[k][2],0) end)
end
--else
--crawl.mpr(name.." last seen at "..tostring(x).." "..tostring(y))
end
else
cleartrail=true
for k in pairs(path) do
if not(pcall(function()
travel.set_travel_trail(path[k][1],path[k][2])
end)) then
crawl.mpr("couldn't mark "..tostring(path[k][1]).." "..tostring(path[k][2]))
end
end
if #path==1 then
if not(pcall(function()
travel.set_travel_trail( x-( y==0 and (x==0 and 0 or math.abs(x)/x) or 0) , y-(y==0 and 0 or math.abs(y)/y) )
end)) then
crawl.mpr("couldn't mark delta at "..tostring(x).." "..tostring(y))
end
end
--echoall("markings set?")--
end
--end
else
wmm_turn_knowledge[name] = nil
end
end
wmm_turn_endstate={}
if leaving then
if VERSION<.28 then crawl.redraw_screen() end
if move_careful and new_monsters=="" then
--do_interrupt("lua_saw_monster") --done in ch_mon
crawl.mpr("Lua eyes saw: "..leaving.."")
--if autopickup_is_on and autopickup_item_within(0) then deactivate_autopickup() end --this runs too late to ever matter
if not(monster_warning) then
crawl.redraw_screen()
monster_warning = true
crawl.more()
end
end
if VERSION<.28 then
if not(you.branch()=="Abyss") then
for name in pairs(wmm_turn_knowledge) do
local path=wmm_turn_knowledge[name]
for k in pairs(path) do
travel.del_exclude(path[k][1],path[k][2])
end
end
end
--else
--travel.clear_travel_trail()
end
--if VERSION<.28 then crawl.redraw_screen() end
else
if VERSION>=.28 and cleartrail then travel.clear_travel_trail(); cleartrail=false; end
end
wmm_turn_knowledge={}
else
if VERSION>=.28 and cleartrail then travel.clear_travel_trail(); cleartrail=false; end
end
end
function r_warn_more_monsters()
if wmm_on then
if new_monsters=="" then
r_wmm_list={}
local w_monster
local LOS=you.los()
for x = -LOS,LOS do
for y = -LOS,LOS do
local w_monster_obj = monster.get_monster_at(x, y)
if
not(w_monster_obj==nil)
and not(w_monster_obj:is_safe())
then
wmm_count_monster(w_monster_obj)
end
end
end
end
if not(new_monsters=="") and (VERSION>.27 or not(wmm_just_on)) then
if VERSION>.27 then crawl.setopt("flash_screen_message +="..wmm_options) end
crawl.mpr(new_monsters)
if VERSION>.27 then crawl.setopt("flash_screen_message -="..wmm_options) end
if not(monster_warning) and not(wmm_just_on) then
monster_warning = true
crawl.more()
end
end
new_monsters = ""
wmm_just_on = false
r_wmm_list = {}
end
end
-------------------------------------------------------------------------------------------------------------
function monster_warning_td()
if not(monster_warning) then
monster_warning = "td"
elseif monster_warning=="skip" then
monster_warning = "skipchk"
end
end
--crawl.setopt("message_color += yellow:out of view")
last_msg, last_ch = "", ""
function cmsg_warnings(msg, ch)
--if not(msg:match("%-%-%-")) then
--crawl.mpr("---"..msg.."-"..last_msg)
--if last_ch=="monster_warning" and not(msg:match("out of view")) then
--if false and monster_warning=="skip" then
--monster_warning = "skipchk"
--else
--monster_warning=true
--crawl.more()
--end
--elseif
if last_msg:match("ou are slowing down") and you.status("petrifying") then
if not(cmsg_sending) then
cmsg_sending = true
--crawl.mpr("You are petrifying soon!")
while not(crawl.yesno("-- Do you realize you are petrifying? --",true,"n",true)) do end
crawl.mpr("...",2)
cmsg_sending = false
end
elseif last_msg:match("ou feel yourself slow down") then
if not(cmsg_sending) then
cmsg_sending = true
if you.slowed() then
if you.hasted() then
while not(crawl.yesno("-- Do you realize your haste was cancelled out? --",true,"n",true)) do end
else
while not(crawl.yesno("-- Do you realize you are SLOWED? --",true,"n",true)) do end
end
else
while not(crawl.yesno("-- Do you realize your haste has expired? --",true,"n",true)) do end
end
crawl.mpr("...",2)
cmsg_sending = false
end
--elseif last_msg:match("flickers and vanishes") and not(autopickup_is_on) then
--crawl.more()
elseif last_msg:match("finished your manual") then
if not(cmsg_sending) then
cmsg_sending = true
while not(crawl.yesno("-- press y --",true,"n",true)) do end
crawl.mpr("...",2)
cmsg_sending = false
end
end
--alternative to the last_ch handling, sometimes one less more, but sometimes slower at interrupting input, doesnt catch all out of view with the more
if--TD replace(d)?
ch=="monster_warning"
then
spotted_monster()
end
--if msg:match("out of view") and not(msg:match("ortex")) then
--if not(cmsg_sending)then
--cmsg_sending=true
----crawl.mpr(msg:gsub("moves out of view.","is about to move out of view!"):gsub("lightgrey","yellow"),2)
--crawl.mpr(msg:gsub("moves out of view.","is about to move out of view!"):gsub("%a+>","yellow>"),2)
--monster_warning=true
--crawl.more()
--cmsg_sending = false
--end
--end
last_msg, last_ch = msg, ch
--end
end
local deltable={}
if VERSION>=.28 then deltable=nil end
function mark_positions(x,y)
local function f(x,y)
if VERSION<.28 then
if not(you.branch()=="Abyss") then --no exclusions in Abyss
travel.set_exclude(x,y,0)
table.insert(deltable, { x, y })
end
else
--table.insert(deltable, { x, y })
--table.insert(deltable, true)
travel.set_travel_trail( x+( y==0 and (x==0 and 0 or math.abs(x)/x) or 0) , y+(y==0 and 0 or math.abs(y)/y) )
travel.set_travel_trail(x,y)
end
if not(r_td[rtd_mark_positions]) then
table.insert(r_td, rtd_mark_positions)
r_td[rtd_mark_positions]=1
end
end
if not(x) then
local LOS=you.los()
for x = -LOS,LOS do
for y = -LOS,LOS do
if
not( monster.get_monster_at(x, y)==nil )
and not( ( monster.get_monster_at(x, y):is_safe()
and monster.get_monster_at(x, y):is_stationary() ) )
and not(monster.get_monster_at(x, y):attitude()>2)
and you.see_cell(x, y)
then
f(x,y)
end
end
end
else
f(x,y)
end
end
function rtd_mark_positions()
if VERSION<.28 then
for k in pairs(deltable) do
travel.del_exclude(deltable[k][1],deltable[k][2])
end
deltable={}
else
travel.clear_travel_trail()
end
end
function spotted_monster(x,y)
mark_positions(x,y)
monster_warning_td()
end
function r_cmsg_warnings()
cmsg_warnings("","")
end
function r_warnings()
if monster_warning=="td" then
crawl.more()
elseif monster_warning=="skipchk" and you.feel_safe() then --something went into view, and out of view. would work with "out of view" handling above, but that's not needed since mark_positions is used
crawl.mpr("you immediately lose sight...")
crawl.more()
end
end
function r_monster_warning()
if monster_warning then
--if monster_warning=="td" then
--crawl.more()
--else
monster_warning=false
end
end
--move careful end
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
--disable move attack
--depends on movekeys and utilities: r_funcs, get_command, delta_to_cmd, delta_to_safe_cmd
--should work with and without move_careful
move_careful=false
dma_table={}
--local movekeys={} --TD:does not work depending on keybinds. Basically ignores that movekeys are usually bound to both letters and number keys
function r_disable_move_attack()
--crawl.mpr("rdma")
local LOS=you.los()
for x = -1,1 do
for y = -1,1 do
local monster_obj = monster.get_monster_at(x, y)
local cmd=delta_to_cmd(x,y) --nil if 0, 0, but there's never a monster at 0, 0 so it's fine
if
not( monster_obj==nil )
and not(monster_obj:attitude()>2)
or view.invisible_monster(x,y)
then
if not(dma_table[cmd]) then
if not movekeys[cmd] then movekeys[cmd]=get_command(cmd,true,true) end
local key=movekeys[cmd]
crawl.setopt("bindkey = ["..key.."] CMD_NO_CMD_DEFAULT")
--crawl.mpr("bindkey = ["..key.."] CMD_NO_CMD_DEFAULT")
dma_table[cmd]=true
end
else
if dma_table[cmd] then
local current_cmd
if not(move_careful) then
current_cmd=delta_to_cmd(x,y)
else
current_cmd=delta_to_safe_cmd(x,y)
end
local key=movekeys[cmd]
crawl.setopt("bindkey = ["..key.."] "..current_cmd)
--crawl.mpr("bindkey = ["..key.."] "..current_cmd)
dma_table[cmd]=false
end
end
end
end
end
table.insert(r_funcs, r_disable_move_attack)
------------------------------------------------------------------------------------------------------------
--===show_enemy_beam_path
--dependencies: r_td if crawl version below .28
local path
function show_enemy_beam_path()
crawl.mpr("Select enemy:",2)
local x, y = crawl.get_target()
local x0=0
local y0=0
if x==nil and y==nil then return
elseif monster.get_monster_at(x, y)==nil or monster.get_monster_at(x, y):attitude()>3 then
x0, y0 = x, y
crawl.mpr("Selected Start. Select enemy:",2)
x, y = crawl.get_target()
end
path=spells.path("Magic Dart",x0,y0,x,y)
--path=spells.path("Lightning Bolt",x0,y0,x,y)
if VERSION<.28 then
if not(you.branch()=="Abyss") then --no exclusions in Abyss
for k in pairs(path) do
travel.set_exclude(path[k][1],path[k][2],0)
end
end
table.insert(r_td, rtd_show_enemy_beam_path)
else
for k in pairs(path) do
travel.set_travel_trail(path[k][1],path[k][2])
end
end
end
function rtd_show_enemy_beam_path()
if not(you.branch()=="Abyss") then
for k in pairs(path) do
travel.del_exclude(path[k][1],path[k][2])
end
else
local found=false
crawl.mpr("Select tile:",2)
local x, y = crawl.get_target()
while x do
for k in pairs(path) do
if x==path[k][1] and y==path[k][2] then
crawl.mpr("Tile is in beam path.",2)
found=true
break;
end
end
if found then break end
crawl.mpr("Tile is not in beam path.",6)
x, y = crawl.get_target()
end
end
end
-------------------------------------------------------------------------------------------------------------
--===wait_weapon
--===wait_ring
--===wait_ring2
--unequips or reequips the respective item. Automatically selects a "weapon" for felids at load.
--depend on: nothing
--assume: default bindkeys for w, P and R
--TD remember states
local function get_toymouse()
local inv=items.inventory()
for _,it in pairs(inv) do
if it:class()=="Miscellaneous" then return items.index_to_letter(it.slot) end
end
for _,it in pairs(inv) do
if it:class()=="Wands" then return items.index_to_letter(it.slot) end
end
for _,it in pairs(inv) do
if it:class()=="Potions" or it:class()=="Scrolls" then return items.index_to_letter(it.slot) end
end
return ""
end
wait_x_last=""--just for info, used in rest_for
wait_x_equip_off=false
wait_weapon_equip=(you.race()=="Felid" and get_toymouse() or "")
if wait_weapon_equip:match(".") then wait_x_last="wait_weapon" end
function wait_weapon()
if you.transform()=="snake" then crawl.mpr("you're a snake."); crawl.more(); wait_x_last=""; return end
if you.transform()=="ice" then crawl.mpr("you're an ice beast."); crawl.more(); wait_x_last=""; return end
wait_x_last="wait_weapon"
--r_meta_move_careful()
if not(items.equipped_at(0)==nil) then
wait_weapon_equip=items.index_to_letter(items.equipped_at(0).slot)
crawl.sendkeys("w-")
wait_x_equip_off=not(you.race()=="Felid")
else
crawl.sendkeys("w*"..wait_weapon_equip)
wait_x_equip_off=(you.race()=="Felid")
end
end
wait_ring_equip=""
function wait_ring()
wait_x_last="wait_ring"
--r_meta_move_careful()
if not(items.equipped_at(7)==nil) then
wait_ring_equip=items.index_to_letter(items.equipped_at(7).slot)
if (items.equipped_at(8)==nil) and not(wait_ring_equip2=="none") then
crawl.sendkeys("R")
else
crawl.sendkeys("R"..wait_ring_equip)
wait_x_equip_off=true
end
else
crawl.sendkeys("P"..wait_ring_equip)
wait_x_equip_off=false
end
end
wait_ring_equip2=""
function wait_ring2()
wait_x_last="wait_ring2"
--r_meta_move_careful()
if not(items.equipped_at(8)==nil) then
wait_ring_equip2=items.index_to_letter(items.equipped_at(8).slot)
if (items.equipped_at(7)==nil) and not(wait_ring_equip=="none") then
crawl.sendkeys("R")
else
crawl.sendkeys("R"..wait_ring_equip2)
wait_x_equip_off=true
end
else
crawl.sendkeys("P"..wait_ring_equip2)
wait_x_equip_off=false
end
end
function start_wait_x()
if c_persist.wait_x==nil then
c_persist.wait_x={}
end
if c_persist.wait_x[you.name()]==nil then
c_persist.wait_x[you.name()]={}
return
end
wait_x_last = c_persist.wait_x[you.name()][1]
wait_x_equip_off = c_persist.wait_x[you.name()][2]
--c_persist.wait_x[you.name()]=nil
end
function save_wait_x()
c_persist.wait_x[you.name()][1] = wait_x_last
c_persist.wait_x[you.name()][2] = wait_x_equip_off
end
------------------------------------------------------------------------------------------------------------
--===remindMe
--reminder that was once used for PoG abuse. PoG rework when?
--depends: r_td
--issues: doesn't interrupt anything. Idc about this one
local reminding = false
local remind_start=0
function remindMe()
reminding=true
remind_start=you.time()
crawl.mpr("reminder set!")
table.insert(r_td,rtd_remindMe)
end
function rtd_remindMe()
if reminding then
--if you.time()>remind_start+1500 then
if you.time()+10>remind_start+230 then
--crawl.mpr("time to eat!")
crawl.mpr("Reminder reminding you to do the thing!",4)
reminding = false
crawl.more()
else
table.insert(r_td,rtd_remindMe)
end
end
end
-------------------------------------------------------------------------------------------------------------
--rested() tries to return true exactly when there would be no point in resting.
--not perfect
--depends: cmsg_funcs
--currently assumes: hell effect rework happened
--TD: understand hp drain...
local cooldownstatus=0
function rested(minmpmult)
return ( (({you.hp()})[1]==({you.hp()})[2] or you.status("non-regenerating"))
and ( ({you.mp()})[1]==({you.mp()})[2]
or minmpmult and ({you.mp()})[1]>=({you.mp()})[2]*minmpmult )
and you.contaminated()==0 and you.swift()==0
and (you.corrosion()==0 or (you.branch()=="Dis" and you.corrosion()<=2))
and not( you.slowed() or you.confused() or you.breath_timeout() or you.on_fire() or you.poisoned()
or you.petrifying() or you.teleporting() or you.silencing() or you.exhausted()
or you.status("can't hop") or you.status("doom-hounded") or you.status("frozen")
or (you.status("weak-willed") and not you.branch()=="Tar")
or you.status("no potions") --only the killer clown effect
or you.status("sap magic")
or you.status("barbed spikes")
or you.transform()=="pig" or you.transform()=="fungus" or you.transform()=="wisp"
or you.status():match("vulnerable") --only fire vulnerable atm, I think
or you.status("berserk cooldown") or you.status("berserking")
or you.status():match("weakened")--"Weak"
--or (you.status("glowing") and TD:notalwaysglowing)
-- -Recite, -Vortex -TD
-- -Dragoncall:
or cooldownstatus>0
))
end
function cmsg_cooldownstatus(msg, ch)
if msg:match("roar of the dragon horde subsides") then
cooldownstatus=cooldownstatus+1
elseif msg:match("ou can once more reach out to the dragon horde") then
cooldownstatus=math.max(cooldownstatus-1,0)
end
end
table.insert(cmsg_funcs,cmsg_cooldownstatus)
-------------------------------------------------------------------------------------------------------------
--===rest_for_turn
--waits in a way that disrupts spells that need waiting.
--uses the last used of the below functions, if any
--depends: wait_weapon, wait_ring, wait_ring2
function rest_for_turn()
if wait_x_last=="" then
crawl.mpr("You wait.")
crawl.do_commands({"CMD_WAIT"})
else
_G[wait_x_last]()
end
end
-------------------------------------------------------------------------------------------------------------
--===k_rest_for
--TD:document
restfor=100
function k_rest_for()
--rest_for(230)
rest_for(restfor)
end
local restingf = false
local restingf_start=0
local restingf_end=0
local restingf_till_reminding=false
local restingf_useless_anyway=false
function rest_for(n)
restingf = true
restingf_start=you.time()
restingf_end=restingf_start+n
if reminding then restingf_till_reminding=true end
crawl.mpr("You start waiting...")
end
function r_rest_for()
local hp, mhp = you.hp()
local mp, mmp = you.mp()
local interrupt = (interrupt and not(tallmatch(interrupt,"mod.rr warning.<.*>You feel")))
if restingf then
if
not(move_careful) or interrupt
or (not(restingf_till_reminding) and you.time()+1>restingf_end)
--or rested() or you.hunger()<1 or (restingf_till_reminding and not(reminding)) then--HUNGER
or (rested() and not(restingf_useless_anyway))
or (restingf_till_reminding and not(reminding))
--or rested()
then
restingf = false
restingf_till_reminding=false
restingf_useless_anyway=false
crawl.mpr("You stop waiting.")
if you.time()==restingf_start then
--if crawl.yesno("Really wait?",true,"N") then
crawl.more()
restingf_useless_anyway=true
restingf = true
--rest_for_turn()
--else
--crawl.mpr("You don't start waiting.")
--end
else
if (wait_x_equip_off and move_careful and not(interrupt)) then
rest_for_turn()
end
--wait_x_last="" --toggle for reset every time
end
else
rest_for_turn()
end
end
end
-------------------------------------------------------------------------------------------------------------
--===togglable_wait
--===toggle_togglable_wait
--...
function togglable_wait_base()
crawl.mpr("waiting...")
crawl.sendkeys("h")
end
togglable_wait=rest_for_turn
function toggle_togglable_wait()
if togglable_wait==rest_for_turn then
togglable_wait=togglable_wait_base
crawl.mpr("wait=normal or channeling")
else
togglable_wait=rest_for_turn
crawl.mpr("wait=possibly swapping")
end
end
function cmsg_toggle_togglable_wait(msg,ch)
if togglable_wait==rest_for_turn and (
msg:match("to maintain the ray")
or msg:match("to continue charging")
or msg:match("to intensify the flame waves")
)
then
table.insert(r_td, toggle_togglable_wait)
end
end
table.insert(cmsg_funcs, cmsg_toggle_togglable_wait)
-------------------------------------------------------------------------------------------------------------
function you_wait()
crawl.mpr("You wait.")
crawl.do_commands({"CMD_WAIT"})
wait_x_last=""
end
-------------------------------------------------------------------------------------------------------------
function rest_with_prompt()
if autopickup_is_on then
if
rested()
then
if crawl.yesno("Really wait for up to 100 decaAut?",true,"N") then
--crawl.do_commands({"CMD_REST"})
crawl.sendkeys(get_command("CMD_REST"))
else
crawl.mpr("You don't start waiting.")
end
else
--crawl.do_commands({"CMD_REST"}) --leads to a bug in an older version when you use the repeating command
crawl.sendkeys(get_command("CMD_REST"))
end
else
crawl.mpr("You don't start waiting.")
end
end
------------------------------------------------------------------------------------------------------------
local rest_wait_percent = 100
function toggle_rest_wait_percent()
if rest_wait_percent == 100 then
rest_wait_percent = 98
crawl.setopt("rest_wait_percent = 98")
crawl.mpr("rest_wait_percent = 98")
else
rest_wait_percent = 100
crawl.setopt("rest_wait_percent = 100")
crawl.mpr("rest_wait_percent = 100")
end
end
function start_rest_wait_percent()
--if you.xl()<14 then
if true then
rest_wait_percent = 100
crawl.setopt("rest_wait_percent = 100")
else
rest_wait_percent = 98
crawl.setopt("rest_wait_percent = 98")
end
end
-------------------------------------------------------------------------------------------------------------
--local super_resting = false
function super_rest()
--super_resting=true
--crawl.setopt("rest_wait_both = true")
--crawl.setopt("runrest_ignore_message ^= magic, HP, contam")
crawl.setopt("rest_wait_percent = 100")
--crawl.do_commands({"CMD_REST"})
rest_with_prompt()
table.insert(r_td,rtd_super_rest)
end
function rtd_super_rest()
--super resting
--if super_resting then
--crawl.setopt("rest_wait_both = false")
--crawl.setopt("runrest_ignore_message -= magic, HP, contam")
--crawl.setopt("rest_wait_percent = 98")
crawl.setopt("rest_wait_percent = "..tostring(rest_wait_percent))
--super_resting = false
--end
end
------------------------------------------------------------------------------------------------------------
local togglable_rest_is="normal"
function toggle_togglable_rest()
if togglable_rest_is=="normal" then
togglable_rest_is="until"
crawl.mpr("using equip rest")
else
togglable_rest_is="normal"
crawl.mpr("using regular rest")
end
end
function togglable_rest()
if togglable_rest_is=="normal" then
rest_with_prompt()
else
rest_until()
end
end
-------------------------------------------------------------------------------------------------------------
local avoidapproach="approach"
local travel_open_doors = avoidapproach
crawl.setopt("travel_open_doors = open") --it's only set to travel_open_doors in explore_simpler
function toggle_travel_open_doors()
if travel_open_doors == avoidapproach then
travel_open_doors = "open"
--crawl.setopt("travel_open_doors = open") --commeted out bc explore function sets it.
crawl.mpr("travel_open_doors = open")
else
travel_open_doors = avoidapproach
--crawl.setopt("travel_open_doors = "..avoidapproach)
crawl.mpr("travel_open_doors = "..avoidapproach)
end
end
function toggle_avoidapproach()
if avoidapproach == "avoid" then
avoidapproach = "approach"
if travel_open_doors == "avoid" then
travel_open_doors=avoidapproach
end
else
avoidapproach = "avoid"
if travel_open_doors == "approach" then
travel_open_doors=avoidapproach
end
end
crawl.mpr("travel_open_doors = "..(((travel_open_doors:match("open") or "")..", would be "):match("open, would be ") or "")..avoidapproach)
end
-------------------------------------------------------------------------------------------------------------
local just_exploring = false
local exploring = false
function r_meta_explore()
r_just_explore()
r_explore_simpler()
end
crawl.setopt("explore_auto_rest = true")
function just_explore()
just_exploring=true
crawl.setopt("explore_auto_rest = false")
explore_simpler()
end
function r_just_explore()
if just_exploring then
crawl.setopt("explore_auto_rest = true")
just_exploring=false
end
end
function explore_simpler() --TD merge with just_explore
exploring=true
monster_warning="skip" --skip it during next round, but only if monsters are in view
--toggle_move_careful_off_noprompt()
if travel_open_doors == avoidapproach then crawl.setopt("travel_open_doors = "..avoidapproach) end
if not(you.branch()=="Shoals" and you.flying()) or crawl.yesno("Really autoexplore?",true,"N") then crawl.sendkeys( get_command("CMD_EXPLORE") ) end
end
function r_explore_simpler()
if exploring then
crawl.setopt("travel_open_doors = open")
exploring=false
end
end
------------------------------------------------------------------------------------------------------------
local ctrl_exploring=false --says whether it should run
local ctrl_explore_timestamp=-1 -- negatives tell you that the rtd isn't active and for what reason
function ctrl_explore()
ctrl_exploring=true
if ctrl_explore_timestamp<0 then
--table.insert(r_td,rtd_ctrl_explore)
rtd_ctrl_explore()
--ctrl_explore_timestamp=-1
--toggle_move_careful_off_noprompt()
crawl.setopt("message_color ^= mute:ove the cursor to view the level map")
crawl.setopt("message_color ^= mute:eturning to the game...")
end
end
function rtd_ctrl_explore()
--crawl.mpr("cx")--
if ctrl_exploring then
if ctrl_explore_timestamp-1) then
if move_careful then
table.insert(r_td,rtd_ctrl_explore)
ctrl_explore_timestamp=you.time()
--if travel_open_doors == avoidapproach then crawl.setopt("travel_open_doors = "..avoidapproach) end
crawl.sendkeys(get_command("CMD_DISPLAY_MAP")..get_command("CMD_MAP_EXPLORE"))
return
else
if ctrl_explore_timestamp<0 then
crawl.mpr("Not exploring.",6); crawl.more()
end
ctrl_explore_timestamp=-1 --default, or danger if not move_careful
ctrl_exploring=false
end
else
ctrl_explore_timestamp=-3 --ctrl_explore was deactivated by interrupt
ctrl_exploring=false
end
else
ctrl_explore_timestamp=-2 --player exited map mode
ctrl_exploring=false
end
else
ctrl_explore_timestamp=-4 --ctrl_explore in particular was deactivated by something
end
crawl.setopt("message_color -= mute:ove the cursor to view the level map")
crawl.setopt("message_color -= mute:eturning to the game...")
--echoall(ctrl_explore_timestamp)--
--if crawl.kbhit()==1 then crawl.flush_input(); crawl.more() end
--if crawl.flush_input() then crawl.more() end --TD?
--crawl.setopt("travel_open_doors = open")
end
--crawl.setopt("runrest_stop_message ^= into view")
--crawl.setopt("runrest_stop_message ^= [Ff]ound")
------------------------------------------------------------------------------------------------------------
--TD: deal with longer doors
--TD: don't rely on waypoints not changing this turn.
local mcxtot_exclusions=0
local mcxtot_exclusions_table={} --exclusions at waypoint 0, at waypoint 9, and at coords in this table, relative to 0
function map_cx_try_other_target()--
--crawl.sendkeys(get_command("CMD_DISPLAY_MAP")..get_command("CMD_MAP_EXPLORE")..get_command("CMD_MAP_EXCLUDE_AREA")..get_command("CMD_MAP_EXCLUDE_AREA")..get_command("CMD_MAP_ADD_WAYPOINT").."0\27"..get_command("CMD_DISPLAY_MAP")..get_command("CMD_MAP_EXPLORE"))--sets the waypoint wrong??
local function tideup()--
--echoall(mcxtot_exclusions)
if mcxtot_exclusions>1 then
if mcxtot_exclusions>2 then
local len=#mcxtot_exclusions_table
--echoall("remove rel", mcxtot_exclusions_table[len][1], mcxtot_exclusions_table[len][2])
local x=-({ travel.waypoint_delta(0) })[1]+mcxtot_exclusions_table[len][1]
local y=-({ travel.waypoint_delta(0) })[2]+mcxtot_exclusions_table[len][2]
travel.del_exclude(x,y)
table.remove(mcxtot_exclusions_table)
else
local x=-({ travel.waypoint_delta(9) })[1]
local y=-({ travel.waypoint_delta(9) })[2]
travel.del_exclude(x,y)
--echoall("remove 9:", x, y)
end
mcxtot_exclusions=mcxtot_exclusions-1
else
crawl.setopt("message_color -= mute:prompt:.*")
crawl.setopt("message_color -= mute:[Ww]aypoint")
crawl.setopt("message_color -= mute:\\(")
local x=-({ travel.waypoint_delta(0) })[1]
local y=-({ travel.waypoint_delta(0) })[2]
travel.del_exclude(x,y)
--echoall("remove 0:", x, y)
mcxtot_exclusions=0
end
end
if mcxtot_exclusions>0 then
if mcxtot_exclusions>1 then
local x=-({ travel.waypoint_delta(9) })[1]+({ travel.waypoint_delta(0) })[1]
local y=-({ travel.waypoint_delta(9) })[2]+({ travel.waypoint_delta(0) })[2]
table.insert(mcxtot_exclusions_table, {x,y})
--echoall("add rel:", x, y)
end
crawl.sendkeys(get_command("CMD_DISPLAY_MAP")..get_command("CMD_MAP_EXPLORE")..get_command("CMD_MAP_ADD_WAYPOINT").."9\27"..get_command("CMD_DISPLAY_MAP")..get_command("CMD_MAP_EXPLORE")..get_command("CMD_MAP_EXCLUDE_AREA")..get_command("CMD_MAP_EXCLUDE_AREA")..get_command("CMD_MAP_EXPLORE"))
mcxtot_exclusions=mcxtot_exclusions+1
else
crawl.setopt("message_color ^= mute:prompt:.*")
crawl.setopt("message_color ^= mute:[Ww]aypoint")
crawl.setopt("message_color ^= mute:\\(")
--crawl.setopt("message_color ^= mute:ove the cursor to view")--
--crawl.setopt("message_color ^= mute:urning to the game")
crawl.sendkeys(get_command("CMD_DISPLAY_MAP")..get_command("CMD_MAP_EXPLORE")..get_command("CMD_MAP_ADD_WAYPOINT").."0\27"..get_command("CMD_DISPLAY_MAP")..get_command("CMD_MAP_EXPLORE")..get_command("CMD_MAP_EXCLUDE_AREA")..get_command("CMD_MAP_EXCLUDE_AREA")..get_command("CMD_MAP_EXPLORE"))
mcxtot_exclusions=1
end
table.insert(r_td, 1, tideup)
end
--function map_cx_try_other_target()--
--map_cx_try_other_target2()
--crawl.sendkeys("\27")
--table.insert(r_td, (function()
--local x=-({ travel.waypoint_delta(0) })[1]
--local y=-({ travel.waypoint_delta(0) })[2]
--echoall("add 0:", x, y)
--map_cx_try_other_target2()
--crawl.sendkeys("\27")
--table.insert(r_td, (function()
--map_cx_try_other_target2()
--crawl.sendkeys("\27")
--table.insert(r_td, (function()
--map_cx_try_other_target2()
--table.insert(r_td, (function()
--local x=-({ travel.waypoint_delta(9) })[1]
--local y=-({ travel.waypoint_delta(9) })[2]
--echoall("add 9:", x, y)
--end))
--table.insert(r_td, tideup)
--table.insert(r_td, tideup)
--table.insert(r_td, tideup)
--table.insert(r_td, tideup)
--end))
--end))
--end))
--end
------------------------------------------------------------------------------------------------------------
local manual_explore=false --only used in explore_summon so far
local togglable_explore_is = "ctrl_explore"
function togglable_explore()
manual_explore=false
_G[togglable_explore_is]()
end
function toggle_togglable_explore()
if togglable_explore_is=="just_explore" then
togglable_explore_is = "ctrl_explore"
else
togglable_explore_is = "just_explore"
end
echoall(togglable_explore_is)
end
------------------------------------------------------------------------------------------------------------
--compatible with wait_weapon
xsummon=nil--="k"--spell key, to be set using ingame lua console
xsummon2=nil--="k" --second spell key, set nil if unused
xsummonsbeforedelay=2--TD save persistently?
minresummondauts = 10 --left global for setting ingame, probably could be local
local function min_resummon_aut_delay() return 10*minresummondauts*(xsummon2 and 1 or 2) end
local RESUMMON_LIMIT = 16 --should be even. Safeguard against auto-explore running in circles because summons keep interrupting it.
local resummons=0 --TD:rename to xsummons
local xsummonalt=false
local xsummonfloor=""
local xsummontime
--local extra_ready_run=false
xdog=false
local xdogpet=false
function explore_summon()
if xsummon then
if resummons~=0 then
--end the running rtd
--xsummonfloor=false
--if not(extra_ready_run) then
--extra_ready_run=true
--ready()
----r_run_r_td()
--extra_ready_run=false
--end
explore_summon_reset(false)
--for k in pairs(r_td) do
--local v=r_td[k]
--if v==rtd_explore_summon then
--table.remove(r_td,k)
--crawl.mpr("restarting explore_summon.")
--break
--end
--end
crawl.mpr("restarting explore_summon.")
do_interrupt("stop_explore_summon")
end
xsummonfloor=you.where()
xsummontime=you.time()
if VERSION>.30 and you.spell_table()[xsummon]=="Call Canine Familiar" then xdog=true else xdog=false end
interrupt=false
explore_summon_parameter()
else
togglable_explore()
end
end
function explore_summon_manual()
if resummons~=0 then return end
xsummonfloor=you.where()
xsummontime=you.time()-min_resummon_aut_delay()
--explore_summon_parameter(false,true)
manual_explore=true
if VERSION>.30 and you.spell_table()[xsummon]=="Call Canine Familiar" then xdog=true else xdog=false end
table.insert(r_td,rtd_explore_summon)
end
function pet_dog()
--if dog in range, pet to reset CD
--return whether successful
for x=-1,1 do
for y=-1,1 do
mo=monster.get_monster_at(x,y)
if not(mo==nil) then
if mo:name()=="inugami" and mo:attitude()==4 then
--crawl.mpr(mo:name())
crawl.setopt("message_color ^= mute:prompt:.*")
crawl.setopt("message_color ^= mute:our.* disappears in a puff of smoke") --TD chk if this solves last_dest hiccups
table.insert(r_td, (function()
crawl.setopt("message_color -= mute:prompt:.*")
crawl.setopt("message_color -= mute:our.* disappears in a puff of smoke")
end))
local direction=get_command(target_delta_to_cmd(x, y))
--crawl.mpr(get_command("CMD_PRIMARY_ATTACK")..direction..get_command("CMD_TARGET_SELECT_FORCE_ENDPOINT"))
crawl.sendkeys(get_command("CMD_PRIMARY_ATTACK")..direction..get_command("CMD_TARGET_SELECT_FORCE_ENDPOINT"))
return true
end
end
end
end
crawl.mpr("Inugami out of reach.")
return false
end
function ans_pet_dog(msg)
if msg:match("eally attack while wielding") and wait_x_equip_off and wait_x_last=="wait_weapon"
--and xdogpet
then return true end
end
local xsummon_resume_ctrl_x=false
function explore_summon_parameter(autocall,manual) --summons, then schedules rtd_explore_summon
if autocall and interrupt and tmatch(interrupt,"stop_explore_summon") then return end
if not(xsummon) or you.where()~=xsummonfloor then
explore_summon_reset(xsummonfloor)
return
end
if move_careful and (not(interrupt) or tallmatch(interrupt,"full_mp","xsummon_interrupt","no_allies")) then
--execute summon or inugami shenanigans
if xsummonalt and xsummon2 then
crawl.sendkeys("y"..xsummon2)
xsummonalt=false
else
if xdog then
if xdogpet then
xdogpet=false
else
xdogpet=true
if pet_dog() then
--if autocall then
--table.insert(r_td,rtd_explore_summon);
--else
table.insert(r_td, (function()
explore_summon_parameter(autocall,manual)
end))
return
--end
end
end
end
if not( xdog and (you.status():match("inugami") or you.status():match("unable to call your familiar")) ) then
crawl.sendkeys("y"..xsummon)
xsummonalt=true
else
crawl.mpr("Can't resummon.")
explore_summon_reset(true)
return
end
end
resummons=resummons+1
--echoall(resummons,you.time()-xsummontime,manual)--
xsummontime=you.time()+10--always called before input is processed, so +10
if not(manual) then --resume travel if applicalbe, schedule rtd
--local interrupt_at_call=interrupt --unused
table.insert(r_td, (function()
if interrupt and tmatch(interrupt,"stop_explore_summon") then return end
--echoall("r esp")--
--echoall(autocall)--
if move_careful then
if not(interrupt) then
if togglable_explore_is=="ctrl_explore" and autocall
and tmatch(lastinterrupt,"full_mp","xsummon_interrupt") and tallmatch(lastinterrupt,"full_mp","xsummon_interrupt","no_allies")
--no_allies only applies when summoning inugami
--TD auto-rest if no_allies otherwise?
then
--assert(ctrl_explore_timestamp>=0) --wrong if already G running
--rtd_ctrl_explore()
--echoall("G")
crawl.sendkeys(get_command("CMD_INTERLEVEL_TRAVEL")..LAST_DEST)
manual_explore=false --now works similar to just_explore, until at the target
xsummon_resume_ctrl_x=true
else
manual_explore=false
togglable_explore()
--if ctrl_explore_timestamp>0 then ctrl_explore_timestamp=ctrl_explore_timestamp+10 end
end
if autocall or resummons==1 then table.insert(r_td,rtd_explore_summon) end
elseif not( tmatch(interrupt,"miscast") and tallmatch(interrupt,"miscast","full_mp","no_allies") ) then
crawl.mpr("Cancelling due to interrupt."); testinterrupt=interrupt; dump(interrupt); dump(interrupt_was)
explore_summon_reset()
else
manual_explore=true
if autocall or resummons==1 then table.insert(r_td,rtd_explore_summon) end
end
else
explore_summon_reset(true)
end
end))
else
table.insert(r_td,rtd_explore_summon)
end
else
if interrupt then crawl.mpr("Summon interrupted."); testinterrupt=interrupt; dump(interrupt); dump(interrupt_was) end
explore_summon_reset(true)
end
end
function rtd_explore_summon()
if interrupt and tmatch(interrupt,"stop_explore_summon") then return end
--does one of: reschedule itself, reschedule itself and explore, explore_summon_parameter, explore_summon_reset
--echoall("xs")--
xsummon_interrupt_chk(true)
if not(xsummon) or you.where()~=xsummonfloor then
explore_summon_reset(xsummonfloor)
return
end
local restedv=( ({you.mp()})[1]==({you.mp()})[2] )
--rested()--TD ignore hp and low contamination... only mp?
--echoall("xs",move_careful, restedv, resummons)
if move_careful and ( not(restedv) or xsummon_delay_condition() ) then
--echoall("xsm")
manual_explore=not(ctrl_exploring or xsummon_resume_ctrl_x)
table.insert(r_td,rtd_explore_summon)
--echoall(xsummon_resume_ctrl_x)--
if xsummon_resume_ctrl_x then
xsummon_resume_ctrl_x=false
togglable_explore()
end
else --not movecarful or rested
--ctrl_expl is going to be interrupted this round
--if ctrl_exploring then manual_explore=false end--unn bc already done when starting cx
--if we just ended map mode, r fires, we aren't in this else block yet,
--but manual is set as false bc cx fires after this.
--If we take a step in the next round, it might go in this block, so we need to check that cx wasn't ended by interrupt, because otherwise manual=false is intended.
--echoall(ctrl_explore_timestamp)--
if togglable_explore_is=="ctrl_explore" and ctrl_explore_timestamp<0 and ctrl_explore_timestamp~=-3 then
--echoall(ctrl_explore_timestamp)--
manual_explore=true
end
--echoall(resummons,xsummonalt)
if restedv then
if resummons=xsummonsbeforedelay and you.time()0
and xsummon_delay_condition()
then
xsummon_interrupt=true
else
crawl.mpr("MP restored.")
result=true
end
end
end
--if iname=="full_mp" then echoall(xsummon, (ctrl_exploring or just_exploring)) end
if result then
--echoall("cia cx false")--
--echoall("---n "..tostring(iname))
--echoall("---c "..tostring(cause))--
--echoall("---e "..tostring(extra))
do_interrupt(iname..(iname=="message" and (" "..tostring(cause).." "..tostring(extra)) or ""))
end
return result
end
end
--echoall("m",chk_interrupt_activity.macro)
--local old_chk_interrupt_activity_macro = chk_interrupt_activity.macro
--chk_interrupt_activity.macro = function(iname,cause,extra)
--return chk_interrupt_activity.travel(iname,cause,extra)
--and move_careful
----and old_chk_interrupt_activity_macro(iname,cause,extra)
--or false --ensure that it never sends nil
--end
--chk_interrupt_activity.run = chk_interrupt_activity.travel
--chk_interrupt_activity.rest = chk_interrupt_activity.run
--local old_chk_interrupt_activities=chk_interrupt_activities
--function chk_interrupt_activities(iname, cause, extra)
--return chk_interrupt_activity.run(iname, cause, extra) and old_chk_interrupt_activities(iname, cause, extra) end
--local old_c_interrupt_activity= c_interrupt_activity
--function c_interrupt_activity(aname, iname, cause, extra)
--echoall(aname)
--return old_c_interrupt_activity(aname, iname, cause, extra)
--end --
function xsummon_interrupt_chk(nostop)
if xsummon_interrupt then
if not(xsummon_delay_condition()) then
if you.turn_is_over() and not(nostop) then you.stop_activity() end
--echoall("xsic")--
do_interrupt("xsummon_interrupt")
xsummon_interrupt=false
end
end
end
function ch_mon_is_safe(monster, is_safe, moving, dis) --hook
xsummon_interrupt_chk() --hack to do the check while travelling with ally in view
return chmon_warn_more_monsters(monster, is_safe, moving, dis)
--return is_safe
end
local function mod_rr_handle_message(mess,ch)
--local ch, mess = rr_split_channel(cause)
chnum=crawl.msgch_num(ch)
for _, x in ipairs(g_rr_ignored) do
if chnum and x.filter:matches(mess, chnum) then
return x.value
end
end
return false
end
local function ally_attacked_out_of_view_msg_test(msg, ch)
--TD what if ally is destroyed before identified? test
--assumes rr_handle_message found the message sus
--used to decide whether to send a monster warning more prompt
local LOS=you.los()
for x = -LOS,LOS do
for y = -LOS,LOS do
local monster_obj = monster.get_monster_at(x, y)
if
not( monster_obj==nil )
and monster_obj:attitude()>3
and you.see_cell(x, y)
then
local name = monster_obj:name()
if msg:find("your "..name,0,true) then return true end
end
end
end
return false
end
function no_other_ally_in_view(msg)
--stationaries dont count
local LOS=you.los()
local found=false
for x = -LOS,LOS do
for y = -LOS,LOS do
local monster_obj = monster.get_monster_at(x, y)
if
not( monster_obj==nil )
and monster_obj:attitude()>3
and you.see_cell(x, y)
then
local name = monster_obj:name()
--echoall("---"..name)
if msg:find(name,0,true) then
if not(found) then
found=true
else
return false --found two with that name
end
elseif not(monster_obj:is_stationary()) then
return false --found a different one that's mobile
end
end
end
end
return true
end
crawl.setopt("runrest_ignore_message ^= prompt:[Ww]here to\?")
local first_turn=you.time()
function cmsg_xsummon(msg, ch)
--if msg:match("you miscast") then
if move_careful then
if
xsummon
and msg:match("our.* disappears in a puff of smoke")
and no_other_ally_in_view(msg)
--it still exists during the message
--when resummoning, for this brief moment both new and old exist
--so it's false in that case
--which is desired, but feels hacky to rely on that phenomon
--but otherwise it would be no_ally_in_view, and then it would also just work.
then
if you.turn_is_over() then you.stop_activity() end
--echoall("---cm xf")
table.insert(r_td, (function() crawl.mpr("No more allies in sight.") end))
do_interrupt("no_allies")
xsummonalt=false
elseif mod_rr_handle_message(msg,ch) then
--if not(you.time()==first_turn and ch:match("god")) then --TD: make that unnecessary, done?
you.stop_activity() --so that you don't check again in chk_interrupt
--echoall("---cm xff"..msg)
do_interrupt("mod_rr "..ch..":"..msg)
if ally_attacked_out_of_view_msg_test(msg, ch) then
monster_warning_td()
end
--end
end
end
end
table.insert(cmsg_funcs,cmsg_xsummon)
------------------------------------------------------------------------------------------------------------
function start_explore_summon()
if c_persist.xs==nil then
c_persist.xs={}
end
if c_persist.xs[you.name()]==nil then
c_persist.xs[you.name()]={ xsummon, xsummon2, xsummonalt }
end
xsummon=c_persist.xs[you.name()][1]
xsummon2=c_persist.xs[you.name()][2]
xsummonalt=c_persist.xs[you.name()][3]
c_persist.xs[you.name()]=nil
if not(xsummon) then crawl.mpr("no explore summon set.") end
end
function save_explore_summon()
c_persist.xs[you.name()]={ xsummon, xsummon2, xsummonalt }
end
-------------------------------------------------------------------------------------------------------------
function explore_chk_and_summon_toggle()
local function f()
crawl.setopt("message_color ^= mute:prompt:.*")
crawl.setopt("message_color ^= mute:[Ww]aypoint")
crawl.setopt("message_color ^= mute:ove the cursor to view")
crawl.setopt("message_color ^= mute:urning to the game")
crawl.setopt("message_color ^= mute:\\(")
crawl.sendkeys(get_command("CMD_DISPLAY_MAP")..get_command("CMD_MAP_EXPLORE")..get_command("CMD_MAP_ADD_WAYPOINT").."0\27")
table.insert(r_td, (function()
crawl.setopt("message_color -= mute:prompt:.*")
crawl.setopt("message_color -= mute:[Ww]aypoint")
crawl.setopt("message_color -= mute:ove the cursor to view")
crawl.setopt("message_color -= mute:urning to the game")
crawl.setopt("message_color -= mute:\\(")
if ({ travel.waypoint_delta(0) })[1]==0 and ({ travel.waypoint_delta(0) })[2]==0 then
just_explore()
else
crawl.mpr("not fully explored.")
end
end))
end
if xsummon and you.where()==xsummonfloor then
--xsummonfloor=""
explore_summon_reset(true)
do_interrupt("stop_explore_summon")
f()
else
crawl.mpr("starting explore_summon")
explore_summon_manual()
table.insert(r_td, 1, f)
end
end
-------------------------------------------------------------------------------------------------------------
local rest_until_normal_mp = {}
rest_until_normal_mp.a = false --if true, run rest_until again
rest_until_normal_mp.z = false --if true, the original equip should be reequipped when rested
local mp_buff=0
local original_equip={}
local old_original_equip={}
function rest_until()
----equips staff at p, rings at Y, and then Z, if those are of magical power, then regenerates as if these weren't equipped
-- then equips back to old stuff unless you were interrupted by a monster
-- basically calls itself in ready() by setting variables
---uses rest_with_prompt(), but could be crawl.sendkeys( get_command("CMD_REST") )
---inscribe mpp, mpY or mpZ repectively
---to do this with artefacts
---atm this is always necessary because !R autoinsciption is not considered
---to undo change the three conditions back
mp_buff=0 --will be increased according to your equip, so that the function knows how much to rest
------------if you have +mp equip that isn't at slots p, Y or Z, it will not be taken into account; this is a feature.
local turn_free=true --will be toggled to false if we equip something
local badletters=false --will be toggled to true if you named the ring on your left hand Z or the ring on your right hand Y
--the next code blocks check the equip and slots, then equip something if necessary
if (not(items.inslot(items.letter_to_index("p"))==nil)) and (items.inslot(items.letter_to_index("p")):name():match("staff of powernever") or items.inslot(items.letter_to_index("p")).inscription:match("mpp")) then
crawl.mpr("mpp")
if (items.equipped_at(0)==nil) then
turn_free=false
crawl.process_keys("wp")
else
if not(items.equipped_at(0):name()=="staff of power" or items.equipped_at(0).inscription:match("mpp")=="mpp") then
original_equip.weapon=items.index_to_letter(items.equipped_at(0).slot)
turn_free=false
crawl.process_keys("wp")
crawl.mpr("test")
end
end
if items.inslot(items.letter_to_index("p")):name()=="staff of power" then
mp_buff=mp_buff+15
else
mp_buff=mp_buff+9
end
end
if turn_free and (not(items.inslot(items.letter_to_index("Y"))==nil)) and (items.inslot(items.letter_to_index("Y")):name():match("ring of magical powernever") or items.inslot(items.letter_to_index("Y")).inscription:match("mpY")) then
if not(items.equipped_at(8)==nil) and items.index_to_letter(items.equipped_at(8).slot)=="Y" then
crawl.mpr("Please assign correct letters for your rings and check your equip.")
rest_until_normal_mp.a=false
rest_until_normal_mp.z=false
badletters=true
original_equip={}
else
if (items.equipped_at(7)==nil) then
turn_free=false
crawl.process_keys("PY")
else
if not(items.equipped_at(7):name()=="ring of magical power" or items.equipped_at(7).inscription:match("mpY")) then
original_equip.lring=items.index_to_letter(items.equipped_at(7).slot)
turn_free=false
crawl.process_keys("R"..original_equip.lring.."PY")
end
end
mp_buff=mp_buff+9
end
end
if turn_free and (not(items.inslot(items.letter_to_index("Z"))==nil)) and (items.inslot(items.letter_to_index("Z")):name():match("ring of magical powernever") or items.inslot(items.letter_to_index("Z")).inscription:match("mpZ")) then
if not(items.equipped_at(7)==nil) and items.index_to_letter(items.equipped_at(7).slot)=="Z" then
crawl.mpr("Please assign correct letters for your rings and check your equip.")
rest_until_normal_mp.a=false
rest_until_normal_mp.z=false
badletters=true
original_equip={}
else
if (items.equipped_at(8)==nil) then
turn_free=false
crawl.process_keys("PZ")
else
if not(items.equipped_at(8):name()=="ring of magical power" or items.equipped_at(8).inscription:match("mpZ")=="mpZ") then
original_equip.rring=items.index_to_letter(items.equipped_at(8).slot)
turn_free=false
crawl.process_keys("R"..original_equip.rring.."PZ")
end
end
mp_buff=mp_buff+9
end
end
--now to use the variables we set, and set globals to call the function again in the next turn, if needed:
--local hp, mhp = you.hp()
local mp, mmp = you.mp()
if not(badletters) then
if mp_buff==0 then
rest_with_prompt()
else
if turn_free then
local percent = math.floor(100*(mmp-mp_buff)/mmp)
crawl.setopt("rest_wait_percent = "..percent)
rest_until_normal_mp.z=true
if not(mp>(mmp-mp_buff-2)) then
rest_with_prompt()
end
else
crawl.mpr("equipped something")
rest_until_normal_mp.a=true
end
end
end
end
function r_rest_until() --this runs in ready()
local hp, mhp = you.hp()
local mp, mmp = you.mp()
if rest_until_normal_mp.a then
rest_until_normal_mp.a=false
if move_careful then
rest_until()
end
else
if rest_until_normal_mp.z and ( mp>(mmp-mp_buff-2) or not(you.feel_safe()) or not(move_careful) ) then
--crawl.mpr("test2")
crawl.setopt("rest_wait_percent = "..rest_wait_percent)
if not(you.feel_safe()) or not(move_careful) then
rest_until_normal_mp.z=false
if
not(original_equip.weapon==nil)
and not(original_equip.lring==nil)
and not(original_equip.rring==nil)
then
old_original_equip=original_equip
original_equip={}
else
crawl.mpr("original_equip=={}")
end
crawl.mpr("Danger! Your equip may be inadequate!")
else
if not(original_equip.weapon==nil) then
crawl.process_keys("w"..original_equip.weapon)
original_equip.weapon=nil
elseif not(original_equip.lring==nil) then
crawl.process_keys("RYP"..original_equip.lring)
original_equip.lring=nil
elseif not(original_equip.rring==nil) then
crawl.process_keys("RZP"..original_equip.rring)
original_equip.rring=nil
rest_until_normal_mp.z=false
end
if original_equip.weapon==nil and original_equip.lring==nil and original_equip.rring==nil then
rest_until_normal_mp.z=false
end
end
end
end
end
function rest_until_restore_equip()
original_equip=old_original_equip
rest_until_normal_mp.z=true
if not(original_equip.weapon==nil) then
crawl.process_keys("w"..original_equip.weapon)
original_equip.weapon=nil
else
if not(original_equip.lring==nil) then
crawl.process_keys("RYP"..original_equip.lring)
original_equip.lring=nil
else
if not(original_equip.rring==nil) then
crawl.process_keys("RZP"..original_equip.rring)
original_equip.rring=nil
rest_until_normal_mp.z=false
end
end
end
if original_equip.weapon==nil and original_equip.lring==nil and original_equip.rring==nil then rest_until_normal_mp.z=false end
end
-------------------------------------------------------------------------------------------------------------
local crystal_ball_notified = false
function r_crystal_ball_notify()
if (not(items.inslot(items.letter_to_index("c"))==nil)) and items.inslot(items.letter_to_index("c")):name()=="crystal ball of energy" then
local mp, mmp = you.mp()
local evo = you.skill("evocations")
if ( (mp-9)/mmp<(76-2*math.floor(evo))/100 ) then
if not(crystal_ball_notified) then
crawl.mpr("You need to stay over "..tostring(math.floor(mmp*(76-2*math.floor(evo))/100)+1).." MP to use the crystal ball!",7)
crawl.more()
crystal_ball_notified = true
end
else
crystal_ball_notified = false
end
end
end
---------------------------------------------------
function use_ball()
if you.status("vitalised") or crawl.yesno("Really use the crystal ball?",true) then
crawl.process_keys("Vc")
else
crawl.mpr("ok then.",2)
end
end
-------------------------------------------------------------------------------------------------------------
function bad_key()
crawl.mpr("this key doesn't do anything right now!")
crawl.more()
end
-------------------------------------------------------------------------------------------------------------
gourm_reminded=true
function r_chk_gourm_fullness()
if you.gourmand() then
if you.hunger()==6 and not(gourm_reminded) then
crawl.mpr("You are no longer engorged.")
crawl.more()
gourm_reminded=true
elseif you.hunger()==7 and gourm_reminded then
gourm_reminded=false
end
end
end
-------------------------------------------------------------------------------------------------------------
function wiz_spell_costs()
crawl.mpr("spc="..you.skill_cost("spellcasting").." spc*2="..(2*you.skill_cost("spellcasting")).." conj*3="..3*you.skill_cost("conjurations").." air="..you.skill_cost("air magic").." fire="..you.skill_cost("fire magic").." tl="..you.skill_cost("translocations").." hx="..you.skill_cost("hexes"))
--crawl.mpr("spc*4="..(4*you.skill_cost("spellcasting")).." conj*3="..(3*you.skill_cost("conjurations")).." air*3+fire*2="..(3*you.skill_cost("air magic")+2*you.skill_cost("fire magic")).. " 4*spc-tl-hx="..(4*you.skill_cost("spellcasting")-you.skill_cost("translocations")-you.skill_cost("hexes")))
crawl.mpr("spc*4="..(4*you.skill_cost("spellcasting")).." conj*2="..(2*you.skill_cost("conjurations")).." 2*tl="..(2*you.skill_cost("translocations")).." 2*hx="..(2*you.skill_cost("hexes")).." 2(tl+hx)="..(2*you.skill_cost("translocations")+2*you.skill_cost("hexes")))
end
-------------------------------------------------------------------------------------------------------------
--see if you have all spells in sstspls, broken by .31
local sstnum=0
local sstspls = {"Apportation",
"Confusing Touch",
"Magic Dart",
"Foxfire",
"Blink",
"Passwall",
"Slow",
"Swiftness",
"Ozocubu's Armour",
"Mephitic Cloud",
"Gell's Gravitas",
"Cause Fear",
"Leda's Liquefaction",
"Enfeeble",
"Fulminant Prism",
"Iskenderun's Mystic Blast",
"Fireball",
"Iskenderun's Battlesphere",
"Yara's Violent Unravelling",
"Deflect Missiles",
"Dispersal",
"Orb of Destruction",
"Discord",
"Disjunction",
"Fire Storm",
"Polar Vortex",
"Shatter",
"Chain Lightning",
"Lehudib's Crystal Spear",
"Summon Lightning Spire",
"Teleport Other",
"Airstrike",
"Spellforged Servitor",
"Summon Guardian Golem",
"Vile Clutch",
"Death's Door",
"Necromutation",
"Borgnjor's Revivification",
"Iron Shot",
"Ignition",
"Passage of Golubria",
"Summon Butterflies",
"Regeneration",
"Confuse",
"Force Lance",
"Agony",
"Aura of Abjuration",
"Bolt of Cold",
"Bolt of Fire",
"Ring of Flames",
"Glaciate",
"Tornado",
"Controlled Blink",
"Invisibility",
"Darkness",}
local sst_responses={}
function sif_spells_test()
sstnum=1
end
function r_sif_spells_test()
if sstnum>0 then --sstnum==0 means nothing should be done
if sstnum<=table.maxn(sstspls) then
if sstnum>1 then
table.insert(sst_responses,crawl.messages(1))
end
crawl.sendkeys("Ä\6")
crawl.sendkeys(sstspls[sstnum])
crawl.sendkeys("\13a")
sstnum=sstnum+1
else
table.insert(sst_responses,crawl.messages(1))
sstnum=0
local maxn=table.maxn(sstspls)
for i=1,maxn,1 do
if sst_responses[i]:match("Okay, then.")=="Okay, then." and not(spells.memorised(sstspls[i])) then
crawl.mpr(sstspls[i])
else if sst_responses[i]=="Memorise" then
table.remove(sst_responses,i+1)
end
end
end
sst_responses={}
end
end
end
function ans_sif_spells_test() --called in c_answer_prompt()
if sstnum>0 then
table.insert(sst_responses,"Memorise")
crawl.sendkeys("N")
end
end
-------------------------------------------------------------------------------------------------------------
function prompt_orb()
local mo=nil
local orb_near=false
for x=-1,1 do
for y=-1,1 do
mo=monster.get_monster_at(x,y)
if
not(mo==nil) and
(mo:name()=="orb of destruction"
or mo:name()=="battlesphere" and prompt_orb_battlesphere(x,y))
then
orb_near=true
break
end
end
end
if not(orb_near) or crawl.yesno("Really cast Orb of Destruction?",true,"n") then
crawl.sendkeys("YM")
else
crawl.mpr("ok then.",2)
end
end
function prompt_orb_battlesphere(x0,y0)
local mo=nil
local orb_near=false
for x=-1,1 do
for y=-1,1 do
mo=monster.get_monster_at(x0+x,y0+y)
if not(mo==nil) and mo:name()=="orb of destruction" then
orb_near=true
break
end
end
end
return orb_near
end
----------------------------------------------------------------------------------------------------------------
--unused, delete?
local autopickup_gold=true
crawl.setopt("autopickup = $?!+\"/")
--crawl.setopt("autopickup_exceptions += gold piece")
--crawl.setopt("autopickup_exceptions -= 1 then
--crawl.sendkeys("V"..items.index_to_letter(items.equipped_at(0).slot))
--crawl.do_commands({"CMD_EVOKE_WIELDED"})
--crawl.do_commands({"CMD_PRIMARY_ATTACK"})
attack_ignore_inscription()
elseif false then
--elseif items.fired_item() and items.fired_item().is_throwable then
crawl.sendkeys("F\13")
--crawl.do_commands({"CMD_EVOKE_WIELDED"})
--crawl.do_commands({"CMD_PRIMARY_ATTACK"})
else
attack_ignore_inscription()
end
end
end
local attack_ignore_inscription_undo = 0
function attack_ignore_inscription()
local direction = ""
if target_delta_to_cmd(d.x, d.y) then
direction=get_command(target_delta_to_cmd(d.x, d.y))
--echoall(direction)
end
local insc = get_command("CMD_INSCRIBE_ITEM")
local v = get_command("CMD_PRIMARY_ATTACK")
crawl.setopt("message_color ^= mute:inscri")
crawl.setopt('message_color ^= mute:'..util.trim(items.index_to_letter(items.equipped_at(0).slot))..'.-.')
if items.equipped_at(0).inscription:find("!a") then
if items.equipped_at(0).inscription:find("!a!a") then
crawl.sendkeys(insc..items.index_to_letter(items.equipped_at(0).slot).."\8\8\8\8\13"..v..direction..firemaybe)
else
crawl.sendkeys(insc..items.index_to_letter(items.equipped_at(0).slot).."\8\8\13"..v..direction..firemaybe)
end
attack_ignore_inscription_undo = 2
else
crawl.sendkeys(v..direction..firemaybe)
end
--attack_ignore_inscription_undo = 2
attack_ignore_inscription_undo = 3
end
function r_attack_ignore_inscription()
if attack_ignore_inscription_undo==2 then
local insc = get_command("CMD_INSCRIBE_ITEM")
crawl.sendkeys(insc..items.index_to_letter(items.equipped_at(0).slot).."!a\13")
attack_ignore_inscription_undo = 3
elseif attack_ignore_inscription_undo==3 then
attack_ignore_inscription_undo = 0
crawl.setopt("message_color -= mute:inscri")
crawl.setopt('message_color -= mute:'..util.trim(items.index_to_letter(items.equipped_at(0).slot))..'.-.')
end
end
----------------------------------------------------------------------------------------------------------------
local last_thrown_letter --in the next function, is actually next thrown
function throw()
used_spell=false
used_throw=true
--crawl.sendkeys("F")
local last_thrown_exists=false
--echoall(last_thrown_letter)
for k in pairs(items.inventory()) do
if items.inventory()[k].is_throwable then
--echoall(items.index_to_letter(items.inventory()[k].slot))
if items.index_to_letter(items.inventory()[k].slot)==last_thrown_letter then
crawl.mpr("+"..items.index_to_letter(items.inventory()[k].slot).."-"..items.inventory()[k]:name_coloured())
last_thrown_exists=true
else
crawl.mpr("-"..items.index_to_letter(items.inventory()[k].slot).."-"..items.inventory()[k]:name_coloured())
end
end
end
crawl.mpr("throw what?",2)
--local input=crawl.c_input_line()
local input=crawl.getch()
input=utf8char(input)
--if input and #input==1 and ( input:match("%l") or input:match("%u") ) then
if input:match("%l") or input:match("%u") then
last_thrown_letter=input
last_thrown_exists=true
--elseif input==nil or #input>0 or last_thrown_letter==nil then
elseif not(input=="\13") or last_thrown_letter==nil then
crawl.mpr("...",2)
return
end
if last_thrown_exists then
crawl.sendkeys("F"..last_thrown_letter)
else
crawl.mpr("ammunition not found.",2)
end
end
----------------------------------------------------------------------------------------------------------------
--Y.\{216}
local repeat_spellvar = {}
repeat_spellvar.a=false
function repeat_spell()
if used_spell then
crawl.setopt("message_colour -= mute:Casting:")
crawl.setopt("message_colour ^= mute:know that spell")
crawl.setopt("message_colour ^= mute:kay. then")
repeat_spellvar.a=true
--repeat_spellvar.m=crawl.messages(1)
crawl.sendkeys("Y\27")
elseif used_throw then
--crawl.sendkeys("F\13f")
if
last_thrown_letter
and items.inslot(items.letter_to_index(last_thrown_letter))
and items.inslot(items.letter_to_index(last_thrown_letter)).is_throwable
then
crawl.sendkeys("F"..last_thrown_letter.."f")
else
crawl.mpr("ammunition not found.",2)
crawl.more()
end
else
evoke_prompt()
crawl.sendkeys("f")
--crawl.process_keys("f")
end
end
function r_repeat_spell()
if repeat_spellvar.a then
local msg=crawl.messages(1)
--crawl.mpr("f"..msg)
--crawl.mpr("R"..crawl.trim(repeat_spellvar.m))
crawl.setopt("message_colour ^= mute:Casting:")
crawl.setopt("message_colour -= mute:know that spell")
crawl.setopt("message_colour -= mute:kay. then")
if msg:match("Casting:")=="Casting:" then
msg=msg:gsub("Casting: ","")
msg=msg:gsub(" %(.+","")
if spells.dir_or_target(msg) then
--crawl.mpr("f")
--if msg=="Searing Ray" then
--crawl.sendkeys(get_command("CMD_WAIT"))
--else
crawl.sendkeys("Y.!")
--end
else
--if utf8char(crawl.getch())=="d" then
if
msg=="Shatter"
or msg=="Foxfire"
or msg=="Starburst"
or msg=="Lee's Rapid Deconstruction"
--or utf8char(crawl.getch())=="f"
then
crawl.sendkeys("Y\13")
else
crawl.mpr("...",2)
end
end
end
repeat_spellvar.a=false
end
end
----------------------------------------------------------------------------------------------------------------
function ans_attack_noprompt(msg) --TD:generalize and expand
if
msg:match("eally attack near your battlesphere%?")
or msg:match("eally attack near your spellforged servitor%?")
or msg:match("eally attack near your spellforged servitor and battlesphere%?")
or msg:match("eally attack near your battlesphere and spellforged servitor%?")
or msg:match("eally attack your inugami%?")
then
--if not(cmsg_sending) then
--cmsg_sending=true
--crawl.sendkeys("Y")
--cmsg_sending=false
--end
return true
end
end
----------------------------------------------------------------------------------------------------------------
--if c_persist.branches==nil then
--c_persist.branches={}
--c_persist.branches[you.name()]={}
--else
--if c_persist.branches[you.name()]==nil then
--c_persist.branches[you.name()]={}
--end end
--local branches = c_persist.branches[you.name()]
local branches = {}
function r_annotate_branchend()
--except branches with just 2 floors
if
not(branches[you.branch()])
and you.depth()==travel.find_deepest_explored(you.branch())
then
if you.depth()==1 then
branches[you.branch()]=0 --just entered new branch
else
branches[you.branch()]=-1
--this value means, first time visiting the latest branch level since reload
--otherwise, it will be deepest explored depth of the branch before this turn
--or nil, if you haven't reached the latest branch level since reload
--if you reloaded while still on first lvl of branch, it will think you just entered it
--to fix that, you would need to assign branches[x]=deepest for all branches when loading, or use c_persist, or maybe just you.turns_on_level()
--not needed atm
end
end
if branches[you.branch()] and you.depth()>branches[you.branch()] then
--you just went down further than before
if you.depth()>1 and not(branches[you.branch()]==-1) then
--skip depth=1 because you cant calculate the branchend
--dont change annotations if you just reloaded
local branchend=(you.depth()-1)/you.depth_fraction()+1 --nan if you.depth()==1
if (you.depth()>branchend-1.5 and you.depth()!\13")--annotate next level
elseif you.depth()>branchend-0.5 then
crawl.sendkeys("!.\8\8\8\8\8\8\8\8\8\8\13")--delete annotation of this lvl
end
end
branches[you.branch()]=math.max(travel.find_deepest_explored(you.branch()), you.depth())--c_persist.branches[you.name()][you.branch()]=
end
end
----------------------------------------------------------------------------------------------------------------
function krepeat()
--crawl.sendkeys("`") --just repeats the macro instead of the previous action, looping forever
end
----------------------------------------------------------------------------------------------------------------
local safety_on = 0
local safety_time = 0
function r_safety_precaution()
local hp, mhp = you.hp()
if hpsafety_time then
crawl.mpr("calling crawl.delay for 15 seconds.")
if crawl.messages(1):match("crawl.delay") then
crawl.delay(15000)
crawl.mpr("...")
end
safety_time=you.time()
end
else
safety_on=0
end
end
---------------------------------------------------------------------------------------------------------------------------------------------------------
-- ===dump_all1, ...
-- show all global variables
local seen={}
function dump(t,i,dontclear,start,limit)
seen[t]=true
local s={}
local n=0
for k in pairs(t) do
n=n+1 s[n]=k
end
table.sort(s)
for k,v in ipairs(s) do
if ( not(start) or k>=start ) and ( not(limit) or k line wasn't :... bug?
{
local turn_of_last_climb=0
local floor_of_last_climb=-1
function climbprompt(cmd)
if
(you.absdepth()==floor_of_last_climb or floor_of_last_climb==-1 or turn_of_last_climb=({you.hp()})[2]*.5 )
and ( cmd=="<" or rested(0.6) or not(view.feature_at(0,0):match("stairs")) )
or crawl.yesno("really climb?",true)
then
crawl.sendkeys(cmd)
turn_of_last_climb=you.turns()+2 --processed before sendkeys, which takes 2 turns if actually climbing
floor_of_last_climb=you.absdepth()
else
crawl.mpr("ok, then.",2)
turn_of_last_climb=0
end
end
function climbup()
climbprompt("<")
end
function climbdown()
climbprompt(">")
end
}
macros += M < ===climbup
macros += M > ===climbdown
#ß\{223} ^H\{8} ^Ö \{150}\{246} ^J\{10} ^L\{12} ^K\{11} ^Ä \{132}\{228}error ^Ü \{156} ^s 19
macros += M \{19} ===macro_save_now
macros += M S ===macro_save
#macros += M \{11} ===toggle_move_careful_on
macros += M \{11} ===show_enemy_beam_path
#macros += M H ===rest_until
#macros += M \{8} ===rest_until_restore_equip
macros += M \{8} ===toggle_togglable_rest
macros += M H ===rest_until_restore_equip
#macros += M \{246} ===explore_simpler
macros += M \{246} ===explore_chk_and_summon_toggle
#macros += M \{246} ===togglable_explore
#just_explore
macros += M \{10} ===k_rest_for
macros += M \{12} ===remindMe
macros += M \{223} ===wiz_spell_costs
#macros += M ] ===sif_spells_test
macros += M v ===evoke_prompt
macros += M \{248} ===toggle_warn_more_monsters
#^B\{2}
macros += M B ===throw
#macros += M ¹
#^8
macros += M \{-40} ===wait_ring
#^9
macros += M \{-39} ===wait_ring2
#^7
macros += M \{-41} ===wait_weapon
#^8
macros += M 8 ===wait_ring
#^9
macros += M 9 ===wait_ring2
#^7
macros += M 7 ===wait_weapon
#macros += M 9 ===super_rest
#macros += M 8 ===super_rest
#"K:" default,
#"K1:" level-map,
#"K2:" targeting or
#"K3:" confirmation.
#K4: menu as of .31
#ö 246 =x-61-74 => x-61=320
#ä 228 =x-61-92 => x-61=320
#ü x-61-68=252
#Ö 214
#Ä 196
#Ü 220
#W 23
#esc 27
#tab 9
#F8 - F9
macros += K \{-1073741889} =
macros += K \{-1073741890} =
macros += K \{-272} =
macros += K \{-273} =
macros += K - <
macros += K _ >
macros += K4 - <
macros += K4 _ >
#macros += K - -
#macros += K _ _
#bindkey = [-] CMD_GO_UPSTAIRS
#bindkey = [_] CMD_GO_DOWNSTAIRS
#macros += K < -
#macros += K > _
#f11,12
macros += K \{-1073741892} -
macros += K \{-1073741893} _
macros += K \{-275} -
macros += K \{-276} _
#shaltgr-,altgr-
macros += K \{8212} -
macros += K \{8211} _
macros += K1 - <
macros += K1 _ >
#macros += K1 < -
#macros += K1 > _
macros += K1 < <
macros += K1 > >
macros += K1 n ]
macros += K1 y [
macros += K1 q \{23}
#why was this vvv commented out?
macros += K2 f !
#! dont't stop at target, @ stop, both ignore range
macros += K2 t @
#space as esc in targeting
macros += K2 \{32} \{27}
macros += K2 \{228} \{27}
macros += K2 \{246} +
macros += K2 x !\{1000}
#hopefully not actually a key at 1000
macros += M \{1000} ===remindMe
macros += K3 y Y
#doesnt seem to work -.-
macros += M # '
macros += M ' #
macros += M + =s!
#macros += M H 5
#macros += M H ===rest_with_prompt
#enter \{13}
#happens to be ^M as well
macros += M \{13} p
#macros += M p ===rest_with_prompt
macros += M p ===togglable_rest
#ä
#macros += M \{228} N!
macros += K \{228} `
#spell_menu = true
#Disables "you dont know that spell" message, and with it the more prompt I expect
#macros += M z Y*!
macros += M z Y
macros += M a YH
macros += M s YJ
macros += M d YK
macros += M f YL
#macros += M x YX now M
macros += M x ===prompt_orb
macros += M A yh
macros += M S yj
macros += M D yk
macros += M F yl
macros += M X ym
#altgrF
macros += M \{273} F
macros += M E EA
#macros += M y Y*
#macros += M N D
#macros += M y n
macros += M y d\\
#macros += M n Y*
macros += M n y
macros += M N Y*!
macros += M Y D
#macros += M B A
#for nagas?^B\{2}, used to be B
macros += M \{2} ag
#macros += M Y a
#macros += M Y Vc
#place crystal ball at c
#no more ball
#macros += M Y ===use_ball
#macros += M b v
macros += M b a
#Ü
macros += M \{220} =i
#tab
#macros += M \{9} *
#no more hunger
#macros += M D e
#macros += M D n #see spellmacros
macros += M k k!
macros += M * N
#mouse
#ctrl u to altgr u
macros += M \{21} \{8595}
macros += M \{8595} ===rest_for_turn
#ctrl p to altgr p
macros += M \{16} \{254}
macros += M \{254} ===k_rest_for
#fixing mouse clearing more() not
#macros += M \{-9992} ===bad_key
#macros += K \{-9999} ==bad_key
#tab to shift-tab
#macros += M \{9} \{-233}
#macros += M \{-233} \{9}
#macros += M e ===just_explore
#macros += M e ===explore_simpler
macros += M e ===togglable_explore
########left numbers p ü+ ä enter uoÖ 789ß
# 2 1 345
# F 4 3 12 5
# " Z §
#^1 ü
macros += M 1 \{252}
#macros += M \{-15} \{252}
macros += M 2 ===togglable_rest
macros += M " ===rest_until_restore_equip
#local
##^2
macros += M \{-46} ===rest_with_prompt
##^3
#macros += M \{-45} ===toggle_togglable_rest
macros += M \{-45} ===toggle_togglable_explore
##^4
macros += M \{-44} ===toggle_rest_wait_percent
##^5
macros += M \{-43} ===toggle_travel_open_doors
##^6
macros += M \{-42} ===toggle_avoidapproach
#tiles
#^2
macros += M \{-14} ===rest_with_prompt
#^3
#macros += M \{-13} ===toggle_togglable_rest
macros += M \{-13} ===toggle_togglable_explore
#^4
macros += M \{-12} ===toggle_rest_wait_percent
#^5
macros += M \{-11} ===toggle_travel_open_doors
#^6
macros += M \{-10} ===toggle_avoidapproach
#macros += M 3 ===wait_weapon
#macros += M 4 ===wait_ring
#macros += M 5 ===wait_ring2
macros += M 3 ===explore_summon
macros += M 4 tr
macros += M 5 tt
#§ to Ö
macros += M \{167} \{214}
macros += M Z =s
#^Z
macros += M \{26} N
#^v to Ö
macros += M \{22} '
#F1-7
macros += M \{-1073741882} \{8595}
macros += M \{-1073741883} \{15}
macros += M \{-1073741884} ===rest_for_turn
macros += M \{-1073741885} ===k_rest_for
macros += M \{-1073741886} p
macros += M \{-1073741887} \\
macros += M \{-1073741888} \\-
macros += M \{-265} \{8595}
macros += M \{-266} \{15}
macros += M \{-267} ===rest_for_turn
macros += M \{-268} ===k_rest_for
macros += M \{-269} p
macros += M \{-270} \\
macros += M \{-271} \\-
##^o
#macros += M 1 \{15}
##^u 21
#macros += M 2 \{21}
#macros += M " ===switch_autopickup_gold
#macros += M 3 ===toggle_rest_wait_percent
#macros += M § ===toggle_rest_wait_percent
#macros += M 4 ===rest_until_restore_equip
#macros += M 5 ===rest_with_prompt
#12345 F1234 "§%
#æ 230
#bindkey = [æ] CMD_QUAFF
#macros += M 1 \{230}
#macros += M 1 \{-233}
#macros += M x ===rest_until
#` repeat
#bindkey = [q] CMD_PREV_CMD_AGAIN
#recast last used spell
#macros += M z ===repeat_spell
#macros += M x ===repeat_spell
macros += M c ===repeat_spell
#macros += M x ===bad_key
#macros += M q
#ü inventory
#macros += M w \{252}
#exploreenter
#rest
#macros += M r ===rest_with_prompt
#macros += M t ===super_rest
########
#` repeat
#bindkey = [\{9}] CMD_PREV_CMD_AGAIN
##shifttab
#macros += M 1 \{-233}
##ü inventory
#macros += M 2 \{252}
##explore
#macros += M 3 ===just_explore
##rest
#macros += M 4 ===rest_with_prompt
#macros += M 5 ===super_rest
###########
#macros += M \{9} h
#macros += M \{-233} ===rest_for_turn
macros += M \{9} ===togglable_wait
macros += M h ===togglable_wait
macros += M \{-233} ===toggle_togglable_wait
#macros += K1 \{246} v
:if VERSION>.26 then
macros += M \{1114111} ===map_cx_try_other_target
macros += K1 \{246} \{27}\{1114111}
:if dummy_keys_made==0 then dummy_keys_made=1 end
:else
macros += M 1 ===map_cx_try_other_target
macros += K1 \{246} v
:end
:if you.wizard() then
macros += M 1 ===wiz1
:end
#disabling swing-only keys when not overwritten by bindkey
bindkey = [^H] CMD_NO_CMD_DEFAULT
bindkey = [^J] CMD_NO_CMD_DEFAULT
#bindkey = [^K] CMD_NO_CMD_DEFAULT
bindkey = [^L] CMD_NO_CMD_DEFAULT
bindkey = [^Y] CMD_NO_CMD_DEFAULT
bindkey = [^U] CMD_NO_CMD_DEFAULT
#bindkey = [^B] CMD_NO_CMD_DEFAULT
#bindkey = [^N] CMD_NO_CMD_DEFAULT
#not sure if it thinks it's the keycode... --TD
#bindkey = [1] CMD_NO_CMD_DEFAULT
#bindkey = [2] CMD_NO_CMD_DEFAULT
#bindkey = [3] CMD_NO_CMD_DEFAULT
#bindkey = [4] CMD_NO_CMD_DEFAULT
#bindkey = [6] CMD_NO_CMD_DEFAULT
#bindkey = [7] CMD_NO_CMD_DEFAULT
#bindkey = [8] CMD_NO_CMD_DEFAULT
#bindkey = [9] CMD_NO_CMD_DEFAULT
macros += M 6 \{27}
bindkey = [Ø] CMD_TARGET_SELECT_FORCE
bindkey = [ł] CMD_MAP_ANNOTATE_LEVEL
bindkey = [n] CMD_TARGET_CANCEL
#https://github.com/crawl/crawl/blob/master/crawl-ref/source/command-type.h
bindkey = [h] CMD_WAIT
bindkey = [j] CMD_MOVE_LEFT
bindkey = [,] CMD_MOVE_DOWN
bindkey = [i] CMD_MOVE_UP
bindkey = [l] CMD_MOVE_RIGHT
bindkey = [u] CMD_MOVE_UP_LEFT
bindkey = [o] CMD_MOVE_UP_RIGHT
bindkey = [m] CMD_MOVE_DOWN_LEFT
bindkey = [.] CMD_MOVE_DOWN_RIGHT
bindkey = [J] CMD_RUN_LEFT
bindkey = [;] CMD_RUN_DOWN
bindkey = [I] CMD_RUN_UP
bindkey = [L] CMD_RUN_RIGHT
bindkey = [U] CMD_RUN_UP_LEFT
bindkey = [O] CMD_RUN_UP_RIGHT
bindkey = [M] CMD_RUN_DOWN_LEFT
bindkey = [:] CMD_RUN_DOWN_RIGHT
bindkey = [j] CMD_TARGET_LEFT
bindkey = [,] CMD_TARGET_DOWN
bindkey = [i] CMD_TARGET_UP
bindkey = [l] CMD_TARGET_RIGHT
bindkey = [u] CMD_TARGET_UP_LEFT
bindkey = [o] CMD_TARGET_UP_RIGHT
bindkey = [m] CMD_TARGET_DOWN_LEFT
bindkey = [.] CMD_TARGET_DOWN_RIGHT
bindkey = [J] CMD_TARGET_DIR_LEFT
bindkey = [;] CMD_TARGET_DIR_DOWN
bindkey = [I] CMD_TARGET_DIR_UP
bindkey = [L] CMD_TARGET_DIR_RIGHT
bindkey = [U] CMD_TARGET_DIR_UP_LEFT
bindkey = [O] CMD_TARGET_DIR_UP_RIGHT
bindkey = [M] CMD_TARGET_DIR_DOWN_LEFT
bindkey = [:] CMD_TARGET_DIR_DOWN_RIGHT
bindkey = [j] CMD_MAP_MOVE_LEFT
bindkey = [,] CMD_MAP_MOVE_DOWN
bindkey = [i] CMD_MAP_MOVE_UP
bindkey = [l] CMD_MAP_MOVE_RIGHT
bindkey = [u] CMD_MAP_MOVE_UP_LEFT
bindkey = [o] CMD_MAP_MOVE_UP_RIGHT
bindkey = [m] CMD_MAP_MOVE_DOWN_LEFT
bindkey = [.] CMD_MAP_MOVE_DOWN_RIGHT
bindkey = [J] CMD_MAP_JUMP_LEFT
bindkey = [;] CMD_MAP_JUMP_DOWN
bindkey = [I] CMD_MAP_JUMP_UP
bindkey = [L] CMD_MAP_JUMP_RIGHT
bindkey = [U] CMD_MAP_JUMP_UP_LEFT
bindkey = [O] CMD_MAP_JUMP_UP_RIGHT
bindkey = [M] CMD_MAP_JUMP_DOWN_LEFT
bindkey = [:] CMD_MAP_JUMP_DOWN_RIGHT
bindkey = [p] CMD_MAP_ADD_WAYPOINT
bindkey = [a] CMD_MAP_EXPLORE
bindkey = [k] CMD_MAP_FIND_YOU
bindkey = [s] CMD_MAP_FIND_YOU
bindkey = [w] CMD_MAP_GOTO_TARGET
#bindkey = [3] CMD_MAP_GOTO_TARGET
macros += K1 3 w
#macros += K1 w e
bindkey = [e] CMD_MAP_DESCRIBE
bindkey = [r] CMD_MAP_EXCLUDE_AREA
bindkey = [x] CMD_MAP_EXCLUDE_AREA
bindkey = [^X] CMD_MAP_CLEAR_EXCLUDES
bindkey = [X] CMD_MAP_FIND_EXCLUDED
bindkey = [^Z] CMD_MAP_WIZARD_FORGET
bindkey = [q] CMD_MAP_EXIT_MAP
#bindkey = [b] CMD_EXPLORE
#bindkey = [B] CMD_OPEN_DOOR
#bindkey = [h] CMD_DISPLAY_INVENTORY
#bindkey = [h] CMD_MAP_FIND_STASH
#bindkey = [H] CMD_DISPLAY_SPELLS
#bindkey = [y] CMD_DISPLAY_RELIGION
#bindkey = [Y] CMD_MAKE_NOTE
#bindkey = [n] CMD_DISPLAY_SKILLS
#bindkey = [N] CMD_MEMORISE_SPELL
bindkey = [b] CMD_EXPLORE
bindkey = [B] CMD_OPEN_DOOR
bindkey = [ü] CMD_DISPLAY_INVENTORY
bindkey = [ü] CMD_MAP_FIND_STASH
bindkey = [N] CMD_DISPLAY_SPELLS
bindkey = [þ] CMD_DISPLAY_RELIGION
bindkey = [Ö] CMD_REPLAY_MESSAGES
bindkey = [^N] CMD_MAKE_NOTE
bindkey = [p] CMD_DISPLAY_SKILLS
bindkey = [Ä] CMD_MEMORISE_SPELL
bindkey = [^X] CMD_LOOK_AROUND
bindkey = [K] CMD_DISPLAY_MAP
#bindkey = [] CMD_INTERLEVEL_TRAVEL
bindkey = [g] CMD_PICKUP
bindkey = [n] CMD_DROP
#bindkey = [N] CMD_NO_CMD_DEFAULT to spells for makro
bindkey = [z] CMD_NO_CMD_DEFAULT
bindkey = [Z] CMD_NO_CMD_DEFAULT
bindkey = [y] CMD_CAST_SPELL
bindkey = [Y] CMD_FORCE_CAST_SPELL
#altgr u
bindkey = [↓] CMD_RESISTS_SCREEN
bindkey = [k] CMD_FULL_VIEW
bindkey = [^B] CMD_FIRE
#CMD_FIRE_ITEM_NO_QUIVER
bindkey = [k] CMD_TARGET_TOGGLE_BEAM
bindkey = [ł] CMD_LUA_CONSOLE
#only needed in 27+
bindkey = [^E] CMD_TOGGLE_TRAVEL_SPEED
#small_more = true
more := force_more_message
stop := runrest_stop_message
ignore := runrest_ignore_message
stop += prompt:[Rr]eally, danger:., warning:., monster_warning:., mutation:.
#stop ^= sound:.
#done by lua now:
#force_more_message += into view, too close, being watched by
#force_more_message += into view, being watched by
#force_more_message += being watched by
#force_more_message += into view
#force_more_message += out of view
#force_more_message += deactivating autopickup
#force_more_message+=autopickup is now off
#timed portals
#more += timed_portal:^\W*(\b(\w\w\w\w\w\w+|\w\w?\w?\w?|([^H\W]..|H[^u\W].|Hu[^r\W])\w\w)\b\W*)+$, vibrate strangely
more += timed_portal:yellow, vibrate strangely
runrest_stop_message ^= timed_portal:., vibrate strangely
#
more += mutation:.
#force_more_message += increases to level, levels and is now at level
#flash_screen_message += increases to level, levels and is now at level
#done by c_msg now
#force_more_message += finished your manual
#flash_screen_message += finished your manual
# Dangerous weapons, handled by wmm_monsters()
#flash_screen_message += is wielding.*distortion
## dancing weapons require special handling...
#flash_screen_message += there is a.*distortion
#flash_screen_message += of distortion comes into view
#
#flash_screen_message += carrying a wand of
#flash_screen_message += wielding .* of distortion
##force_more_message += (?!.*(Here|Aim):)^.*wielding.*of distortion
#removing default made redundant by move_careful
force_more_message -= Marking area around .* as unsafe
more += [Yy]ou sense a monster nearby
more += magic feels tainted
more += lose access to your magic
more += [Yy]ou miscast
stop ^= [Yy]ou miscast
#more += [Nn]othing appears to happen
#stop ^= [Nn]othing appears to happen
force_more_message += You cannot blink
force_more_message += Your stasis prevents you from teleporting
force_more_message += [Yy]ou can't wield
# Interrupts from gammafunk.rc
more += You don't .* that spell
more += You fail to use your ability
more += You miscast.*(Blink|Borgnjor|Door|Invisibility)
more += You can't (read|drink|do)
more += You cannot .* while unable to breathe
more += You cannot .* in your current state
more += when .*silenced
more += too confused
more += There's something in the way
more += There's nothing to (close|open) nearby
more += not good enough to have a special ability
more += You are too berserk
more += no means to grasp
more += That item cannot be evoked
more += You are held in a net
more += You don't have any such object
more += You can't unwield
more += enough magic points
more += You don't have the energy to cast that spell
more += You are unable to access your magic
#debuffs
#force_more_message += contaminate
force_more_message += You become entangled
more += You are held in a net
more += calcifying dust hits you\W
more += floating eye.s view
more += floating eye seems to glare
more += floating eye gazes
#traps
force_more_message += ou hear a loud .Zot.
force_more_message += Your surroundings
# suddenly seem different.
force_more_message += wrath finds you
more += You are.*confused
# Bad things, gammafunk.rc
more += Your surroundings flicker
more += You cannot teleport right now
more += A sentinel's mark forms upon you
more += (blundered into a|invokes the power of) Zot
more += enter a teleport trap
more += Ouch! That really hurt!
#more += dispelling energy hits you
more += You are blasted by holy energy!
more += You are (blasted|electrocuted)!
#more += You are.*(confused|poisoned)
more += god:(sends|finds|silent|anger)
more += You feel a surge of divine spite
more += disloyal to dabble
more += lose consciousness
more += You are too injured to fight blindly
#more += calcifying dust hits
more += Space warps.*around you
more += Space bends around you
#more += watched by something #done by lua
#more += flickers and vanishes! #l
more += doesn't seem very happy
more += is no longer charmed
# Hell effects
more += hell_effect:
#buffs running out
more += finish channelling
force_more_message += Your divine stamina fades away.
force_more_message += Your ring of flames is guttering out
more += You feel less protected from missiles
#more += dispelling energy hits you
force_more_message += Your magical effects are unravelling
# Expiring effects, gammafunk
#more += You feel yourself slow down #l
more += You are starting to lose your buoyancy
more += Your hearing returns
more += Your transformation is almost over
more += You have a feeling this form
more += You feel yourself come back to life
more += time is quickly running out
more += life is in your own hands
more += You start to feel a little slower
# monster Item Use, magus.rc
more += drinks a potion
more += evokes.*(amulet|ring)
more += reads a scroll
more += zaps a (wand|rod)
force_more_message -= You have reached level
force_more_message += You have reached level 2!
force_more_message += You have reached level 3
force_more_message += You have reached level 4
force_more_message += You have reached level 5
force_more_message += You have reached level 26
# Others, gfunk
#more += You have reached level
more += You rejoin the land of the living
#more += You have finished (your manual|forgetting about)
more += You have finished forgetting about
more += Your scales start
more += You feel monstrous
more += Jiyva alters your body
: if you.god() == "Xom" then
more += god:
: end
#########travel stuff
:if you.god() == "Xom" then
stop += god:
:else
ignore += god:
:end
# Bad things
stop ^= A huge blade swings out and slices into you
stop ^= starving
stop ^= wrath finds you
stop ^= lose consciousness
stop ^= hell_effect:
# Expiring effects
stop ^= You feel yourself slow down
stop ^= You are starting to lose your buoyancy
stop ^= Your hearing returns
stop ^= Your transformation is almost over
stop ^= back to life
stop ^= time is quickly running out
stop ^= life is in your own hands
stop ^= is no longer charmed
ability_slot += Fly|flight:lF
ability_slot += Stop Flying:L
ability_slot += Breathe:t
ability_slot += Invisibility:iv
# Abilities prone to miskeys.
ability_slot += Blink:IB
ability_slot += Berserk:k
ability_slot += Corrupt:C
ability_slot += Enter the Abyss:E
######################################
confirm_action += [Ss]ilence
force_spell_targeter += silence
force_more_message += eally cast .ilence
#force_more_message += magical contamination has completely faded away
#for vampire
runrest_ignore_message ^= very thirsty, almost devoid of blood, You feel devoid of blood, blood rots away, blood rot away
rest_wait_both = true
#runrest_ignore_message ^= HP
#runrest_ignore_message ^= magical contamination|(magic)
#runrest_ignore_message ^= magic(?!al contamination)
#runrest_ignore_message ^= magic
#flash_screen_message += (?!foo)^.*bar
#contam
#runrest_stop_message ^= magical contamination
flash_screen_message += There is something invisible around
message_colour += yellow:There is something invisible around
#done by c_msg
#more += You feel yourself slow down
#flash_screen_message += You feel yourself slow down
message_colour += magenta:You feel yourself slow down
flash_screen_message +=you feeling lethargic
message_colour += magenta:you feeling lethargic
runrest_stop_message ^= gateway leading out appears
runrest_stop_message ^= ound a gateway leading out
runrest_stop_message ^= pressed. stopping travel
message_colour += mute:Cast which spell
message_colour += mute:Press: . . help. Shift.Dir
message_colour += mute:Press: . . help. Dir . move target cursor
message_colour += mute:Casting:
message_colour += mute:Confirm with . or Enter. or press . or . to list all spells
message_colour += mute:Your battlesphere fires
message_colour += mute:fulminant prism comes into view
#^--TD? make safer for future enemies conjuring prisms
message_colour += mute:Press: . . help. Dir . move target
message_colour += mute:^Aiming\:
message_colour += mute:^Reach\:
message_colour += mute:^Shoot\:
message_colour += mute:^Attack\:
message_colour += mute:^Hit\:
message_color += mute:t -\s[A-Z][a-z]+!
message_color += mute:.rders for allies
message_color += mute:r...Retreat.*s...Stop.attacking
message_color += mute:g...Guard the area.*f...Follow.me
message_color += mute:(a|A)nything.else...Cancel
channel.sound = lightgreen
message_colour += lightgreen:You feel a bit more experienced
message_colour += cyan:battlesphere wa, cyan:battlesphere expends
#rest_wait_percent = 98
#set by lua
cloud_status = true
#confirm_action += ^Blink,
#auto_butcher = true
#confirm_butcher = never
#auto_eat_chunks = true
#explore_auto_rest = true
default_manual_training = true
#clear_messages = true
show_more = false
dump_message_count = 100
note_all_skill_levels = true
#online defaults
travel_delay = -1
rest_delay = -1
show_travel_trail = true
#travel_delay = 1
#show_travel_trail = false
runrest_stop_message ^= .omething.?.?.?.?.?.?.?.?.?.?.?.?.?.?.?.? misses you\.
runrest_stop_message ^= .omething enters a
runrest_stop_message ^= .omething sets off the alarm
runrest_stop_message ^= .omething launches a net
runrest_stop_message ^= You feel you are being watched by something
runrest_stop_message ^= .omething ?\w* \w+ your
runrest_stop_message ^= appears from out of your range of vision
runrest_stop_message ^= [Yy]our .+ resists
runrest_stop_message ^= reminder
#runrest_stop_message ^= your.* disappears in a puff of smoke
message_colour ^= cyan:your.* disappears in a puff of smoke
runrest_stop_message ^= battlesphere wavers
sort_menus = true : equipped, basename, identified, slot
####################################################################################################
# Item slots and @ inscriptions
item_slot += potions? of lig:t
item_slot += potions? of cur:C
item_slot += potions? of magic:G
item_slot += potions? of ambros:A
item_slot += potions? of brill:B
item_slot += potions? of cancel:X
item_slot += potions? of hast:Q
item_slot += potions? of heal w:W
item_slot += potions? of invis:V
item_slot += potions? of resis:R
item_slot += scrolls? of blinking:K
item_slot += scrolls? of fear:J
item_slot += scrolls? of fog:O
item_slot += scrolls? of id:y
item_slot += scrolls? of pois:P
item_slot += scrolls? of torm:H
item_slot += scrolls? of magic mapping:M
item_slot += scrolls? of revelation:M
item_slot += scrolls? of sil:I
item_slot += scrolls? of sum:U
item_slot += scrolls? of butter:U
item_slot += scrolls? of tel:N
item_slot += scrolls? of vuln:L
autoinscribe += wand of flame:@v1
autoinscribe += wand of iceb:@v2
autoinscribe += wand of roots:@v2
autoinscribe += wand of acid:@v3
autoinscribe += wand of quicks:@v3
autoinscribe += wand of light:@v3
autoinscribe += wand of mindb:@v4
autoinscribe += wand of disint:@v4
autoinscribe += wand of charm:@v5
autoinscribe += wand of para:@v5
autoinscribe += wand of poly:@v6
autoinscribe += wand of dig:@v7
#upper left: deflstyz
#lower left: abcdefghijklmnopqrsuvwxz
item_slot += scrolls? of amn:-k
#item_slot += scrolls? of enchant arm:
#item_slot += scrolls? of acqu:
#item_slot += scrolls? of brand:
#item_slot += scrolls? of enchant weap:
item_slot += scrolls? of immo:-z
#item_slot += scrolls? of noise:
#item_slot += potions? of degen:
#item_slot += potions? of att:-
item_slot += potions? of flight:-l
item_slot += potions? of enlightenment:-l
#item_slot += potions? of might:-
item_slot += potions? of berserk:-n
item_slot += potions? of mut:-m
#item_slot += potions? of exp:
{
--put all letters used
scrollletters="KJOPHMIUNL"
potionletters="tCGABXQWVR"
wandletters=""
reservedletters="y" --reserved should include y w r and q
freelettersdrop="klmnz" --non-overwriting letters of consumables I'll likely drop later, in order of most likely to keep
--put all unused letters, preferably in alphabetical order
freeletters="cdefghijopsux"
freecapitalletters="DEFST"
freecapitallettersreserved="Y" --should be Y
freelettersamulet="Z"
freelettersreserved="rwq" --reserved should include y w r and q. Used for rings, or wands, which ingame should be used by number.
freelettersweapons="vab"--letters reserved for weapons
noslotletters=freeletters..freelettersdrop:reverse()..freecapitalletters:reverse()..potionletters..scrollletters..wandletters..freelettersweapons..freelettersamulet..freelettersreserved..reservedletters..freecapitallettersreserved
--add all patterns for consumables that didn't get a letter
--keep enchant arm, enchant wep, brand wep in this category, so those are never matched later
noslotstring="scrolls? of enchant arm|scrolls? of acqu|scrolls? of brand|scrolls? of enchant weap|scrolls? of noise|potions? of degen|item_slot += potions? of att|potions? of might|potions? of exp|scrolls? of remove curse"
--add all patterns for consumables that got a weak letter
dropslotitems="scrolls? of amn|scrolls? of immo|potions? of flight|potions? of enlightenment|potions? of berserk|potions? of mut"
noslotitems="(unidentified (scroll|potion)|"..noslotstring..")"
}
#unidentifed and unlisted pots and scrolls:
:crawl.setopt("item_slot += "..noslotitems..":-"..noslotletters)
:crawl.setopt("item_slot += "..dropslotitems..":-"..freelettersdrop)
:--crawl.setopt("item_slot += \\bmisc\\b:"..freecapitalletters)
#DEFST 0 left:89
item_slot += lightning rod:F
item_slot += phial of floods:T
item_slot += phantom mirror:D
#item_slot += piece from Xom.s chessboard:
autoinscribe += piece from Xom.s chessboard:@v0
item_slot += box of beasts:S
item_slot += sack of spiders:S
item_slot += tin of tremorstones:E
item_slot += condenser vane:E
#item_slot += figurine of a ziggurat:
#item_slot += horn of Geryon:
#item_slot += quad damage:
:if you.race()=="Felid" then
:crawl.setopt("item_slot +=\\bwand\\b:-"..freecapitallettersreserved..freelettersreserved..reservedletters.."abv")
:else
item_slot += \b(weapon|staff)\b:bav
:crawl.setopt("item_slot += \\barmour\\b:"..freecapitallettersreserved)
:crawl.setopt("item_slot +=\\bwand\\b:-"..freelettersreserved..reservedletters..freecapitallettersreserved)
:end
:crawl.setopt("item_slot += \\b(amulet|necklace)\\b:"..freelettersamulet)
# qr w
# klmn z
#cdefghijklmnopqrsuwxz
#cdefghij oprsuwxy
item_slot += \bring\b.*(cold|rC\+):cd
item_slot += \bring\b.*(n from fire|rF\+):ef
item_slot += \bring\b.*ice:gh
item_slot += \bring\b.*fire:ij
item_slot += \bring\b.*(positive|rN\+):op
item_slot += \bring\b.*[Cc]orr:w
item_slot += \bring\b.*rElec:q
item_slot += \bring\b.*(willp|Will\+):rs
item_slot += \bring\b.*[Pp]ois:x
item_slot += \bring\b.*(flight|fly):u
item_slot += \b(weapon|staff|ring)\b:spjhfd
:crawl.setopt("item_slot += \\b(weapon|staff|ring)\\b:"..freeletters:reverse()..freelettersdrop)
:crawl.setopt("item_slot += \\bring\\b:"..freelettersreserved..reservedletters)
:crawl.setopt("item_slot +=\\bwand\\b:-"..noslotletters)
{
--enforce item_slot options
--depends: r_td, macro_save (--TD:make that a global table), cmsg_funcs, item_slot options with a structure as above
--sets hook: c_assign_invletter
--inscribe smth with "noslot" to exclude it from enforcement
slots={} --table of item names, returning their last known slot if that slot should be enforced on re-pickup
local noslotregex=crawl.regex("("..noslotitems.."|"..dropslotitems..")")
testslots=nil --debug
function update_slots()
for _,it in pairs(items.inventory()) do
local name=it:name()
local class=it:class()
if
it.fully_identified
and not(name:match("noslot"))
and (
it:subtype():match("ring")
and (
name:match("fire")
or name:match("cold")
or name:match("r%a%+")
or name:match("positive")
or name:match("willp")
or name:match("Will%+")
or name:match("[Pp]ois")
or name:match("rElec")
or name:match("[Cc]orr")
or name:match("ring of flight")
or name:match("fly")
)
or (
class:match("Potions")
or class:match("Scrolls")
)
and not(noslotregex:matches(name))
or class:match("[Ww]eapons")
or class:match("Staves")
or class:match("Miscellaneous")
and(
name:match("lightning rod")
or name:match("phial of floods")
or name:match("phantom mirror")
--or name:match("piece from Xom.s chessboard")
or name:match("box of beasts")
or name:match("sack of spiders")
or name:match("tin of tremorstones")
or name:match("condenser vane")
)
)
then
slots[id(it)]=it.slot
if testslots then echoall("s set",id(it),it.slot) end --debug
end
end
end
function id(it)
--item identifier disregarding quanitity and enchantment level
--TD:disregard player inscriptions?
--TD:don't distinguish unidentified item stacks by whether there are multiple
return
(it.class():match("Potions") or it.class():match("Scrolls")) and it.name("base")..(it.subtype() or it.name():match("[%a%s]*"))
or it.class():match("Miscellaneous") and it.subtype()
or it.artefact and it.name()
or (it.damage or it.ac) and it.name("base")..(it.ego() or "")
or it.name()
end
table.insert(cmsg_funcs,(function(msg,ch)
if msg:match("^<.*>%a %- %a+") then
if not(r_td[update_slots]) then
r_td[update_slots]=1
table.insert(r_td,update_slots)
end
end
end))
function c_assign_invletter(it)
--always give dropped items that qualify for the slots table their old slot back
--unless the slots table also includes the item in that slot
--(instead of taking the second best item_slot option for some reason)
local name=id(it)
if slots[name] then
table.insert(r_td,1,(function()
if
not(items.inslot(slots[name]))
or
id(items.inslot(slots[name]))~=name --something else is where this was last time
and slots[id(items.inslot(slots[name]))]~=slots[name] --slots doesn't give it the same slot
then
local currentslot
for _,it in pairs(items.inventory()) do
if id(it)==name then currentslot=it.slot; break; end
end
items.swap_slots(currentslot,slots[name])
crawl.mpr("Swap: "..items.inslot(slots[name]).name("inv")..(items.inslot(currentslot) and ", "..items.inslot(currentslot).name("inv") or ""))
end
--update_slots()
end))
return slots[name]
--else
--table.insert(r_td,1,update_slots)
end
end
function start_slots()
if c_persist.slots==nil then
c_persist.slots={}
end
if c_persist.slots[you.name()]==nil then
c_persist.slots[you.name()]={}
end
slots=c_persist.slots[you.name()]--
--for name,slot in pairs(slots or {}) do
--echoall("init",name, slot)
--end
update_slots()
end
start_slots()
function save_slots()
c_persist.slots[you.name()]=slots
end
--table.insert(save_funcs,save_slots)
}
####################################################################################################
spell_slot ^= dispersal:q
spell_slot ^= mystic:w
spell_slot ^= disjunction:r
spell_slot ^= armour:e
spell_slot ^= dart:H
spell_slot ^= hail:a
spell_slot ^= prism:J
spell_slot ^= clutch:K
spell_slot ^= fireball:d
spell_slot ^= deconstruct:f
spell_slot ^= searing:Ls
spell_slot ^= stone arrow:Ls
spell_slot ^= iron shot:L
spell_slot ^= crystal spear:L
spell_slot ^= star:H
spell_slot ^= orb:M
spell_slot ^= slow:ASD
spell_slot ^= enfeeble:ASD
spell_slot ^= confusion:ASD
spell_slot ^= tukima:ASD
spell_slot ^= petrif:ASD
spell_slot ^= fear:F
spell_slot ^= violent unrav:g
#spell_slot ^= summon:kjhl
#hjklmHJKLM
spell_slot ^= spire:H
spell_slot ^= mammal:J
spell_slot ^= imp:K
spell_slot ^= canine:L
spell_slot ^= guardian:M
spell_slot ^= cactus:h
spell_slot ^= gateway:j
spell_slot ^= viper:k
spell_slot ^= monstrous:l
spell_slot ^= hydra:m
spell_slot ^= forest:J
spell_slot ^= servitor:k
spell_slot ^= horrible:m
spell_slot ^= haunt:HMa
spell_slot ^= foxfire:h
spell_slot ^= battlesphere:kl
spell_slot ^= discord:c
spell_slot ^= polar vortex:x
spell_slot ^= shatter:h
spell_slot ^= fire storm:H
spell_slot ^= ignition:h
spell_slot ^= form:z
spell_slot ^= irradiate:v
spell_slot ^= blink:b
:if not(you.race()=="Ghoul" or you.race()=="Mummy") then
autopickup_exceptions ^= potions? of might
#autopickup_exceptions ^= >potions? of degeneration
#autopickup_exceptions ^= >useless
ai := autoinscribe
autoinscribe += datura:!f
#autoinscribe += magical power:!R
autoinscribe += MP\+:!R!T!w
autoinscribe += potions? of resis:rElec rC+ rF+ rCorr rPois
#autoinscribe += weapon:!a
#autoinscribe += w - :!w --TD:do with cmsg
ai += potions? of berserk rage:!q
ai += scrolls? of silence:!r
--ai += scrolls? labelled:!r
--ai += scrolls? of:
tile_tooltip_ms = 0
{
add_autopickup_func(function(it, name)
--Pickup aux armour you haven't found yet.
--Also picks up ego/artefact aux armour if you can wear it.
--Doesn't pick up shields or body armour.
--cited from somewhere
if it.is_useless then return false end
local class = it.class(true)
if class == "armour" then
local good_slots = {cloak="Cloak", helmet="Helmet",
gloves="Gloves", boots="Boots"}
st, _ = it.subtype()
if good_slots[st] ~= nil and items.equipped_at(good_slots[st]) == nil then
return true
--elseif st ~= "body" and st ~= "shield" and (it.artefact or it.branded) then return true
end
end
--crawl.mpr(it:class().." "..(it:subtype() or ""))
--crawl.mpr("<"..it:name_coloured())
return nil
end)
}
#tile_full_screen = true
#buggy?
tile_window_width = -90
tile_window_height = -90
tile_full_screen = false
tile_skip_title = true
#msg_min_height = 6
#monster_item_view_coordinates = true --inconsistent with lua coords, Y axis flipped
action_panel_filter -= attraction
explore_greedy_visit = artefacts
#,glowing_items
#explore_greedy_visit = asdf
#explore_greedy_visit -= asdf
#explore_greedy_visit -= glowing_items
explore_greedy_visit -= stacks
explore_stop += greedy_pickup
explore_stop -= greedy_pickup_smart
#explore_greedy=false
#show_more = true
:if tonumber(crawl.version("major"))>.26 then
#default 3
#fail_severity_to_confirm = 3
:crawl.setopt("fail_severity_to_confirm = 4")
:end
tile_viewport_scale = 1.0
#tile_map_scale = 0.5
tile_map_scale = 0.75
tile_level_map_hide_messages = false
tile_level_map_hide_sidebar = false
#explore_wall_bias = -1000
##tile_lava_col = #552211
#tile_lava_col = #440000
##tile_trap_col = #aa6644
#tile_trap_col = #aacc00
##tile_explore_horizon_col = #6b301b
##tile_explore_horizon_col = #6b301b
##feature += explore horizon {,,red,red,red,red,red}
#tile_display_mode=hybrid
#defaults
#tile_player_col = white
#tile_monster_col = #660000
#tile_neutral_col = #660000
#tile_peaceful_col = #664400
#tile_friendly_col = #664400
#tile_plant_col = #446633
#tile_item_col = #005544
#tile_floor_col = #333333
#tile_wall_col = #666666
#tile_door_col = #775544
#tile_explore_horizon_col = #6b301b
#tile_unseen_col = black
#tile_mapped_floor_col = #222266
#tile_mapped_wall_col = #444499
#tile_upstairs_col = cyan
#tile_downstairs_col = #ff00ff
#tile_branchstairs_col = #ff7788
#tile_portal_col = #ffdd00
#tile_transporter_col = #0000ff
#tile_transporter_landing_col = #5200aa
#tile_feature_col = #997700
#tile_trap_col = #aa6644
#tile_water_col = #114455
#tile_deep_water_col = #001122
#tile_lava_col = #552211
#tile_excluded_col = #552266
#tile_excl_centre_col = #552266
#tile_window_col = #558855
#
#0f 1f 3f 7f ff double the last category... delta of 1f*2^n
# 16 2d 5a b4 between those for shift
#r down branch
#m tla excl trap
#my
#ryy lava door mon
# floor wall transp player
# mfl mwl horizon
#gy
#cy sea wat portal
#c friend
#g feat plant up
#no items
#almost invis: feat, tland
tile_player_col = white
tile_monster_col = #ffb400
tile_neutral_col = #ffb400
tile_peaceful_col = #1f3f3f
tile_friendly_col = #1f3f3f
tile_plant_col = #007f00
tile_item_col = #1f1f1f
tile_floor_col = #1f1f1f
tile_wall_col = #3f3f3f
tile_door_col = #7f5a00
tile_explore_horizon_col = #b4b4ff
tile_unseen_col = black
tile_mapped_floor_col = #5a5aff
tile_mapped_wall_col = #7f7fff
tile_upstairs_col = #1fff1f
tile_downstairs_col = #7f0000
tile_branchstairs_col = #7f1f1f
tile_transporter_col = #7f7f7f
tile_transporter_landing_col = #2d002d
tile_portal_col = #7fffff
tile_feature_col = #002d2d
tile_trap_col = #ff00ff
tile_water_col = #3f7fff
tile_deep_water_col = #2d5aff
tile_lava_col = #3f2d00
tile_excluded_col = #3f003f
tile_excl_centre_col = #3f003f
tile_window_col = #558855
#tile_layout_priority = abilities, commands, inventory, memorisation, minimap, monsters, navigation, skills, spells, system commands
tile_layout_priority = monsters, minimap
#https://github.com/crawl/crawl/blob/master/crawl-ref/source/rltiles/dc-mon.txt
#https://github.com/crawl/crawl/blob/master/crawl-ref/source/rltiles/dc-player.txt
#https://github.com/crawl/crawl/blob/master/crawl-ref/source/rltiles/dc-zombie.txt
#tile_player_tile = tile:MONS_SALAMANDER_MYSTIC
#tile_shield_offsets = 0,-8
:if not(you.race()=="Felid") then
#tile_player_tile = playermons
tile_player_tile = tile:MONS_SERVANT_OF_WHISPERS
#tile_player_tile = tile:MONS_WIZARD
#tile_player_tile = tile:MONS_SPRIGGAN_DEFENDER
:else
#tile_player_tile = playermons
:if tonumber(crawl.version("major"))<.31 then
tile_player_tile = tile:FELID_2
:else
:crawl.setopt("tile_player_tile = tile:FELID_SILLY")
:end
:end
explore_item_greed = 3
:--the < symbol sometimes doesn't like it if it's not preceeded by a : line
<
--local old_ready=ready
--function ready()
--if old_ready then old_ready() end
--echoall(1)
--end
>