Page 1 of 1

Add confirmation for waiting 100 turns

PostPosted: Wednesday, 29th August 2018, 06:58
by VeryAngryFelid
It is common to press 5 after a fight to restore HP/MP. Often it requires more than 100 turns to restore them or your rest is interrupted by some event (form ends, you are poisoned etc.) so players have to press 5 again. Sometimes it results in pressing 5 accidentally so you waste 100 turns of food/piety.
I suggest to add a confirmation "Are you sure you want to rest while having max HP/MP? (y/N)" since it is rare that player actually wants to do it (just waiting for monsters to wonder away from door/stairs, I think).

Re: Add confirmation for waiting 100 turns

PostPosted: Wednesday, 29th August 2018, 07:42
by duvessa
Pressing 5 with full HP/MP should wait for 1 turn but retain the current interruption behaviour. So if you want to wait until a monster comes around a corner or whatever, you can mash 5 or hold down 5, and it'll stop once the monster shows up. Then accidentally pressing it at full HP/MP will throw away just 1 turn of piety instead of 100, which is no worse than accidentally pressing a movement key.

There are many situations where you do want to wait for a super long time, usually involving stairs or characters without piety decay, so perhaps another key should be dedicated to that (yeah, you can make a macro for 01005 but most players don't know how to do that). But the rest key shouldn't punish you so hard for accidentally pressing it when you don't need to rest.

Re: Add confirmation for waiting 100 turns

PostPosted: Thursday, 30th August 2018, 11:41
by stickyfingers
100 turns is "hard punishment"? What?

Re: Add confirmation for waiting 100 turns

PostPosted: Thursday, 30th August 2018, 17:21
by ebering
You can achieve this with clua and your RC file like so:

  Code:
macros += M 5 ===smartfive

<
  function smartfive()
    hp, mhp = you.hp()
    mp, mmp = you.mp()

    if hp ~= mhp or mp ~= mmp or crawl.yesno("Really rest when healed?",
true, "N") then
      crawl.do_commands({"CMD_REST"})
    end
  end
>


Using the
  Code:
you.status()
function (documentation at http://lua.dcss.xyz) you can add exceptions to skip the prompt if you're under certain status effects in addition to checking for full hp.

Re: Add confirmation for waiting 100 turns

PostPosted: Thursday, 30th August 2018, 17:29
by Bleyddyn
ebering wrote:You can achieve this with clua and your RC file like so:



Thanks for the link to the lua documentation! Do you know of a tutorial on how to get started with lua in DCSS? Even looking at your simple example I'm not sure where to put the code and/or macro entry.

Re: Add confirmation for waiting 100 turns

PostPosted: Thursday, 30th August 2018, 17:38
by ebering
You put the Lua in your init.txt/.crawlrc file, which is where crawl reads it from. Beyond the API documentation I don't know of any other good documents. You can look around on tavern, and read elliptic's qw bot (written entirely in crawl Lua).

In preparing an answer for this thread I've noticed that the documented behavior isn't 100% correct for ch_start_running and ch_stop_running (or perhaps their implementation is currently broken, hard to say). There are probably other inaccuracies or vagaries in the documentation. If you spot some let me know.

Re: Add confirmation for waiting 100 turns

PostPosted: Thursday, 30th August 2018, 19:05
by Bleyddyn
ebering wrote:You put the Lua in your init.txt/.crawlrc file, which is where crawl reads it from. Beyond the API documentation I don't know of any other good documents. You can look around on tavern, and read elliptic's qw bot (written entirely in crawl Lua).

In preparing an answer for this thread I've noticed that the documented behavior isn't 100% correct for ch_start_running and ch_stop_running (or perhaps their implementation is currently broken, hard to say). There are probably other inaccuracies or vagaries in the documentation. If you spot some let me know.



Thanks! That worked. Not quite what I want for my transmuters, but a good place for me to start.