Difference between revisions of "Talk:NetHack 3.0.0"

From NetHackWiki
Jump to navigation Jump to search
(What I know so far about keys and locks in 3.0.x)
(Shaped keys can't open doors)
Line 12: Line 12:
 
</pre>
 
</pre>
 
::You could use a round key to open a chest with a round keyhole, but it wouldn't fit a square keyhole.  Keys had the appearances noted above in keystr; chests and large boxes had the appearances in lockstr.  I haven't figured out how this works for doors.  It furthermore appears to be quicker to use the "right" key than a skeleton key. --[[User:Ray Chason|Ray Chason]] 16:05, 29 July 2006 (UTC)
 
::You could use a round key to open a chest with a round keyhole, but it wouldn't fit a square keyhole.  Keys had the appearances noted above in keystr; chests and large boxes had the appearances in lockstr.  I haven't figured out how this works for doors.  It furthermore appears to be quicker to use the "right" key than a skeleton key. --[[User:Ray Chason|Ray Chason]] 16:05, 29 July 2006 (UTC)
 +
 +
::OK, I figured out how the shaped keys work with doors:  they don't.  Shaped keys can't open doors at all.  Quoth [[NetHack 3.0.10]] lock.c, lines 293-310:
 +
 +
<pre>
 +
    switch(picktyp) {
 +
case CREDIT_CARD:
 +
    ch = 2*ACURR(A_DEX)+(20*(pl_character[0] == 'R'));
 +
    break;
 +
case LOCK_PICK:
 +
    ch = 3*ACURR(A_DEX)+(30*(pl_character[0] == 'R'));
 +
    break;
 +
case SKELETON_KEY:
 +
    ch = 70 + ACURR(A_DEX);
 +
    break;
 +
case KEY:
 +
    pline("The %s won't fit the door.", xname(pick));
 +
    return(1);
 +
default:    ch = 0;
 +
    }
 +
</pre>
 +
:: One history section coming up. -- [[User:Ray Chason|Ray Chason]] 18:50, 6 August 2006 (UTC)

Revision as of 18:50, 6 August 2006

Y'all have probably noticed that I haven't written up a new version in a while. The easiest thing to do is usually to copy the page for version N and modify it to be correct for version N+1. But 3.0.0 is such a quantum leap over 2.3e that there's a lot of possibility of error, which could then propagate into succeeding writeups and then I have to go back and correct them all. So I want to review this one with a fine-toothed comb and be sure I have it right before I write up 3.0.1.Ray Chason 03:33, 29 July 2006 (UTC)

Keys have shapes that fit specific locks - this is interesting. Could you explain how this worked? Possibly in a History section on Unlocking tools. --Jayt 10:19, 29 July 2006 (UTC)
Diving into the 3.0.0 source, I find this bit of code in src/objnam.c (which no longer exists in 3.4.3):
/*	We want the player to be able to learn what key goes in what lock.  */
const char *keystr[N_LOX] = { "round", "square", "triangular", "oval",
			    "octagonal", "hexagonal", "cylindrical",
			    "irregular", "conical", "wedge-shaped" },
	   *lockstr[N_LOX] = { "round", "square", "triangular", "oval",
			    "octagonal", "hexagonal", "wide",
			    "notched", "large round", "large square" };
You could use a round key to open a chest with a round keyhole, but it wouldn't fit a square keyhole. Keys had the appearances noted above in keystr; chests and large boxes had the appearances in lockstr. I haven't figured out how this works for doors. It furthermore appears to be quicker to use the "right" key than a skeleton key. --Ray Chason 16:05, 29 July 2006 (UTC)
OK, I figured out how the shaped keys work with doors: they don't. Shaped keys can't open doors at all. Quoth NetHack 3.0.10 lock.c, lines 293-310:
		    switch(picktyp) {
			case CREDIT_CARD:
			    ch = 2*ACURR(A_DEX)+(20*(pl_character[0] == 'R'));
			    break;
			case LOCK_PICK:
			    ch = 3*ACURR(A_DEX)+(30*(pl_character[0] == 'R'));
			    break;
			case SKELETON_KEY:
			    ch = 70 + ACURR(A_DEX);
			    break;
			case KEY:
			    pline("The %s won't fit the door.", xname(pick));
			    return(1);
			default:    ch = 0;
		    }
One history section coming up. -- Ray Chason 18:50, 6 August 2006 (UTC)