<---------------------------------------------------------------------------------------------- local move_careful = false local reset_more_message_options = false local autopickup_is_on = true function r_meta_move_careful() --the only function actually called in ready(), to see the order here r_tell_time() r_autopickup_is_on() r_chk_vis_invis() r_move_careful() end function toggle_move_careful() --better name would be toggle_move_carful_on() move_careful = true crawl.setopt("force_more_message -= into view") crawl.setopt("force_more_message += You are feeling hungry") 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") crawl.mpr("No danger in sight...") end function toggle_move_careful_off() crawl.flush_input() crawl.more() toggle_move_careful_off_noprompt() crawl.mpr("!") end function toggle_move_careful_off_noprompt() move_careful = false reset_more_message_options = true 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") 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 reset_more_message_options then --reset to default: Here used when there is danger reset_more_message_options = false crawl.setopt("force_more_message += into view") crawl.setopt("force_more_message -= You are feeling hungry") end --local detected=false if move_careful then if (not(you.feel_safe()) or you.silenced()) then toggle_move_careful_off() --this also sends a --more-- else -- for x = -7,7 do -- for y = -7,7 do -- if view.invisible_monster(x,y) then -- toggle_move_careful_off() -- detected=true -- break -- end -- end -- if detected then detected=false break end --end if not(autopickup_is_on) then toggle_move_careful_off() end end else if (you.feel_safe() and not(you.silenced())) then if autopickup_is_on then toggle_move_careful() else crawl.mpr("AP is off.",4) end end end end function r_chk_vis_invis() --react to "indirectly" visible invisible monster --r_autopickup_is_on() should run before this in ready() local detected=false if autopickup_is_on then for x = -7,7 do for y = -7,7 do if view.invisible_monster(x,y) then --this code is the reaction crawl.mpr("There is something invisible around!") if autopickup_is_on then crawl.mpr("lua detected that AP should be OFF:") crawl.do_commands({"CMD_TOGGLE_AUTOPICKUP"}) if crawl.messages(1):find(".utopickup is now on") then crawl.mpr("lua corrects itself:") crawl.do_commands({"CMD_TOGGLE_AUTOPICKUP"}) end autopickup_is_on=false if not(move_careful) then crawl.mpr("There is something invisible around!!!") crawl.more() end end detected=true break end end if detected then break end end end end local last_time_told=1000*math.floor(you.time()/1000) function r_tell_time() if (you.time()>last_time_told+1000) then last_time_told=1000*math.floor(you.time()/1000) crawl.mpr(tostring(last_time_told/10).." turns") end end local msgs="" local just_toggled_ap=false function r_autopickup_is_on() local a=0 local b=0 local c=0 local d=0 local e=0 local f=0 local g=0 local h=0 for n = 1,4 do if n==4 and not(just_toggled_ap) then --crawl.do_commands({"CMD_TOGGLE_AUTOPICKUP","CMD_TOGGLE_AUTOPICKUP"}) crawl.mpr("Autopickup is now on?") just_toggled_ap=true msgs=crawl.messages(20) else if n==4 then msgs=crawl.messages(1200) else msgs=crawl.messages(n*300) msgs=msgs:match(tostring(last_time_told/10-100).." turns.+") if not(msgs==nil) then break end end end end msgs=msgs:reverse() a,b=(msgs):find( ("]Dd[eactivating autopickup. reactivate with Ctrl.A"):reverse() ) --pattern syntax has to be reversed! a,c=(msgs):find( (".utopickup is now off"):reverse() ) a,d=(msgs):find( (".utopickup is now on"):reverse() ) a,e=(msgs):find( ("Reactivating autopickup"):reverse() ) a,f=(msgs):find( (".omething?.?.?.?.?.?.?.?.?.?.?.?.?.?.?.?. misses youp%"):reverse() ) a,h=(msgs):find( ("You feel you are being watched by somethingp%"):reverse() ) a,g=(msgs):find( (".elcome back-.ress . for a list of commands and other information"):reverse() ) a=math.min(nil_is_7000(b),nil_is_7000(c),nil_is_7000(d),nil_is_7000(e)) if b==a or c==a then if autopickup_is_on then autopickup_is_on = false crawl.mpr("lua detected that AP is OFF") end else if d==a or e==a then autopickup_is_on = true end end f=math.min(nil_is_7000(f),nil_is_7000(h)) if (fremind_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() end end 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 resting...") end function r_rest_for() local hp, mhp = you.hp() local mp, mmp = you.mp() if restingf then local resting_useless=( (hp==mhp or you.status("non-regenerating")) and mp==mmp and you.contaminated()==0 and you.swift()==0 and not(you.slowed() or you.confused() or you.breath_timeout() or you.petrifying() or you.teleporting()) ) if not(move_careful) or (not(restingf_till_reminding) and you.time()+10>restingf_end) --or resting_useless or you.hunger()<1 or (restingf_till_reminding and not(reminding)) then --HUNGER or (resting_useless and not(restingf_useless_anyway)) or (restingf_till_reminding and not(reminding)) then --or resting_useless then restingf = false restingf_till_reminding=false restingf_useless_anyway=false --crawl.mpr("You stop resting.") if you.time()==restingf_start then if crawl.yesno("Really wait?",true,"N") then restingf_useless_anyway=true restingf = true rest_for_turn() else --crawl.mpr("Actually, you don't start resting.") crawl.mpr("You don't start resting.") end else --wait_x_last="" --toggle for reset end else rest_for_turn() end end end 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 function k_rest_for() rest_for(230) end ------------------------------------------------------------------------------------------------------------- function you_wait() crawl.mpr("You wait.") crawl.do_commands({"CMD_WAIT"}) wait_x_last="" end ------------------------------------------------------------------------------------------------------------- function rest_with_prompt() local hp, mhp = you.hp() local mp, mmp = you.mp() if (hp==mhp or you.status("non-regenerating")) and mp==mmp and you.contaminated()==0 and you.swift()==0 and not(you.slowed() or you.confused() or you.breath_timeout() or you.petrifying() or you.teleporting()) then if crawl.yesno("Really wait for up to 100 aut?",true,"N") then crawl.do_commands({"CMD_REST"}) else crawl.mpr("You don't start waiting.") end else crawl.do_commands({"CMD_REST"}) 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() end function r_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") super_resting = false end end ------------------------------------------------------------------------------------------------------------- local rest_wait_percent = 98 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 ------------------------------------------------------------------------------------------------------------- local travel_open_doors = "avoid" crawl.setopt("travel_open_doors = avoid") function toggle_travel_open_doors() if travel_open_doors == "avoid" then travel_open_doors = "open" crawl.setopt("travel_open_doors = open") crawl.mpr("travel_open_doors = open") else travel_open_doors = "avoid" crawl.setopt("travel_open_doors = avoid") crawl.mpr("travel_open_doors = avoid") 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 just_exploring = false 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() toggle_move_careful_off_noprompt() crawl.do_commands({"CMD_EXPLORE"}) 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() -- td replace :name()=="staff of power" with .inscription:match("mpp")=="mpp" --"Y")):name()=="ring of magical power" --.inscription:match("mpZ")=="mpZ" --items.inslot(items.letter_to_index("Y")).inscription:match("mpY")=="mpY" ----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 CMD_REST ofc 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()=="staff of power" or items.inslot(items.letter_to_index("p")).inscription:match("mpp")=="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()=="ring of magical power" or items.inslot(items.letter_to_index("Y")).inscription:match("mpY")=="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")=="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()=="ring of magical power" or items.inslot(items.letter_to_index("Z")).inscription:match("mpZ")=="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() --CMD_REST in ready() needs to be accepted by pressing the wait-button --crawl.mpr("test") 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 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 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 evoke_prompt() local v = crawl.get_command("CMD_PRIMARY_ATTACK") if (items.equipped_at(0):name()=="+9 staff of Wucad Mu {channel}") then if you.status("vitalised") or crawl.yesno("Really use the Staff of Wucad Mu?",true) then crawl.do_commands({"CMD_EVOKE_WIELDED"}) else crawl.mpr("ok then.",2) end else if items.equipped_at(0).is_ranged then --crawl.do_commands({"CMD_FIRE"}) --crawl.do_commands({"CMD_PRIMARY_ATTACK"}) crawl.sendkeys(v) else if items.equipped_at(0).reach_range>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"})cccccc attack_ignore_inscribtion() else if 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_inscribtion() end end end end end local attack_ignore_inscribtion_undo = 0 function attack_ignore_inscribtion() local insc = crawl.get_command("CMD_INSCRIBE_ITEM") local v = crawl.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))..'.-.') crawl.sendkeys(insc..items.index_to_letter(items.equipped_at(0).slot).."\8\8\13"..v) attack_ignore_inscribtion_undo = 1 end function r_attack_ignore_inscribtion() if attack_ignore_inscribtion_undo==1 then local insc = crawl.get_command("CMD_INSCRIBE_ITEM") crawl.sendkeys(insc..items.index_to_letter(items.equipped_at(0).slot).."!a\13") attack_ignore_inscribtion_undo = 2 else if attack_ignore_inscribtion_undo==2 then attack_ignore_inscribtion_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 end ------------------------------------------------------------------------------------------------------------- wait_x_last=""--just for info, used in rest_for wait_weapon_equip="" function wait_weapon() wait_x_last="wait_weapon" r_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-") else crawl.sendkeys("w*"..wait_weapon_equip) end end wait_ring_equip="" function wait_ring() wait_x_last="wait_ring" r_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) then crawl.sendkeys("R") else crawl.sendkeys("R"..wait_ring_equip) end else crawl.sendkeys("P"..wait_ring_equip) end end wait_ring_equip2="" function wait_ring2() wait_x_last="wait_ring2" r_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) then crawl.sendkeys("R") else crawl.sendkeys("R"..wait_ring_equip2) end else crawl.sendkeys("P"..wait_ring_equip2) 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 else if you.hunger()==7 and gourm_reminded then gourm_reminded=false end end end end ------------------------------------------------------------------------------------------------------------- function wiz_spell_costs() crawl.mpr("spc="..you.skill_cost("spellcasting").." spc*2="..(2*you.skill_cost("spellcasting")).." conj="..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 ------------------------------------------------------------------------------------------------------------- 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" 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 ---------------------------------------------------------------------------------------------------------------- local last_spell_key="f" function Yh() last_spell_key="h" crawl.process_keys("Yh") end function Yj() last_spell_key="j" crawl.process_keys("Yj") end function Yk() last_spell_key="k" --crawl.process_keys("Yk") prompt_orb() end function Yl() last_spell_key="l" crawl.process_keys("Yl") end function Yn() last_spell_key="n" crawl.process_keys("Yn") end function Ym() last_spell_key="m" crawl.process_keys("Ym") end --td ---------------------------------------------------------------------------------------------------------------- local autopickup_gold=true crawl.setopt("autopickup = $?!+\"/") --crawl.setopt("autopickup_exceptions += gold piece") --crawl.setopt("autopickup_exceptions -= ################################################################################################################ ############# END OF LUA #to do list: #auto-eat #repeating into-view messages... not possible by vanilla crawl options #message every turn to tell both the script and the player that a turn has indeed passed, even when you get the exact same other messages as last turn #repeat-last-spell-button, distinct from repeat-last-action #change b #add old reminder #ghost moth flashes #ß\{223} ^H\{8} ^Ö \{150}\{246} ^J\{10} ^L\{12} ^K\{11} ^Ä \{132}\{228}error ^Ü \{156} macros += M \{11} ===toggle_move_careful #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 #just_explore macros += M \{10} ===k_rest_for #macros += M q ===debuggg macros += M \{12} ===remindMe macros += M \{223} ===wiz_spell_costs macros += M ] ===sif_spells_test macros += M v ===evoke_prompt #^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. #ö 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 - < macros += K _ > #macros += K < - #macros += K > _ #f11,12 macros += K \{-1073741892} - macros += K \{-1073741893} _ macros += K1 - < macros += K1 _ > macros += K1 < - macros += K1 > _ macros += K1 n ] macros += K1 y [ macros += K1 \{246} v 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} ` macros += M N D macros += M a Yh macros += M s Yj #macros += M x Ym macros += M x ===prompt_orb macros += M f Yl #macros += M x Ym macros += M z Y*! macros += M d Yk macros += M y Y* #macros += M B A #for nagas? macros += M B 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 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 #tab to shift-tab macros += M \{9} \{-233} macros += M \{-233} \{9} macros += M e ===just_explore #macros += M e ===explore_simpler ########left numbers p ü+ ä enter uoÖ 789ß # 2 1 345 # F 4 3 12 5 # " Z § #ü macros += M 1 \{252} macros += M 2 ===togglable_rest macros += M " ===rest_until_restore_equip #^2 macros += M \{-46} ===rest_with_prompt #^3 macros += M \{-45} ===toggle_togglable_rest #^4 macros += M \{-44} ===toggle_rest_wait_percent #^5 macros += M \{-43} ===toggle_travel_open_doors #^6 macros += M \{-42} ===switch_autopickup_gold macros += M 3 ===wait_weapon macros += M 4 ===wait_ring macros += M 5 ===wait_ring2 #§ 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} p macros += M \{-1073741885} \{196} macros += M \{-1073741886} ===wiz_spell_costs macros += M \{-1073741887} \\ macros += M \{-1073741888} \\- ##^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 ########### 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 = [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 = [ö] 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 bindkey = [k] CMD_TARGET_TOGGLE_BEAM bindkey = [ł] CMD_LUA_CONSOLE #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 #small_more = true more := force_more_message #disables lvl up messages and ??? #force_more_message = force_more_message += lose your buoyancy, life at own hands, running out #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, out of view force_more_message += a sentinel.s mark forms upon you #force_more_message += deactivating autopickup #force_more_message+=autopickup is now off force_more_message += Your divine stamina fades away. #force_more_message += magical contamination has completely faded away force_more_message += contaminate force_more_message += wrath finds you force_more_message += Your ring of flames is guttering out force_more_message += You cannot blink force_more_message += Your stasis prevents you from teleporting more += You feel yourself slow down force_more_message += You become entangled more += You are held in a net force_more_message += Your surroundings suddenly seem different. #more += dispelling energy hits you more += Your transformation is almost over. more += You feel yourself coming back to life more += You feel less protected from missiles force_more_message += Your magical effects are unravelling more += interdimensional caravan more += distant snort more += roar of battle more += wave of frost more += hiss of flowing sand more += sound of rushing water more += oppressive heat about you more += crackle of arcane power more += You feel a terrible weight on your shoulders more += .* resides here force_more_message += increases to level, levels and is now at level flash_screen_message += increases to level, levels and is now at level force_more_message += finished your manual flash_screen_message += finished your manual flash_screen_message += carrying a wand of flash_screen_message += wielding .* of distortion #force_more_message += (?!.*(Here|Aim):)^.*wielding.*of distortion more += don.t have enough magic #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) #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 message_colour += mute:Cast which spell, mute:Aiming: 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:prism comes into view channel.sound = white message_colour += white:You feel a bit more experienced message_colour += cyan:battlesphere wa, cyan:battlesphere expends #tile_lava_col = #552211 tile_lava_col = #440000 #tile_trap_col = #aa6644 tile_trap_col = #aacc00 rest_wait_percent = 98 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 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 tile_viewport_scale = 1.0 tile_map_scale = 0.5 #tile_layout_priority = abilities, commands, inventory, memorisation, minimap, monsters, navigation, skills, spells, system commands tile_layout_priority = monsters, minimap item_slot = *:ABCDEFGHIJKLMNOPQRSTUVWXYZ item_slot ^= (weapon|staff|ring):abcdefghijklmnopqrstuvwxyz #item_slot += (weapon|staff|ring):abcdefghijklmnopqrstuvwxyz spell_slot ^= dispersal:q spell_slot ^= missle:h spell_slot ^= searing:l spell_slot ^= prism:j spell_slot ^= mystic:w spell_slot ^= discord:x spell_slot ^= battlesphere:r spell_slot ^= slow:s spell_slot ^= enfeeble:a spell_slot ^= confusion:a spell_slot ^= fireball:k spell_slot ^= blink:b spell_slot ^= orb:m autopickup_exceptions ^= potion of might #autopickup_exceptions ^= >potion of degeneration #autopickup_exceptions ^= >useless autoinscribe += weapon:!a tile_tooltip_ms = 0 #show_more = true message_color += mute:t...Shout 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 force_more_message -= You have reached level #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 #https://github.com/crawl/crawl/blob/master/crawl-ref/source/rltiles/dc-mon.txt #tile_player_tile = tile:MONS_SALAMANDER_MYSTIC #tile_shield_offsets = 0,-8 #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 #=(10*(20-V14)*(V12-0.99)/8-10)/V13 #=ROUNDUP(V16,1)