PDA

View Full Version : Feature suggestion 'l'ook for inventory/equipment


PaulBlay
February 20, 2009, 12:03
At present you can only 'l'ook at items in shops / your home. I suggest that when the inventory or equipment list is showing (e.g. 'i' or 'e' has been pressed) that 'l'ook could work like it does at home.

[EDIT]Never mind. I suppose 'I' is the equivalent for that.

===============================================

The following is (I think) "Everything that can be done with an item in your equipment or inventory". I would suggest that it (or something like it)
could be made the context sensitive help for when your inventory or
equipment is showing (e.g. pressed 'i' or 'e').

=== Inventory/Equipment help ===
i Show inventory list q Quaff a potion from inventory/ground
e Show equipment list r Read a scroll from inventory/ground
d Drop an item from inv/equip { Inscribe object (inv/equip/ground)
k Destroy item from inv/equip/ground } Uninscribe object (inv/equip/ground)
w Wear/wield item from inv/ground A Activate an artifcat (inv/equip/gr)
t Take off an item from equipment a Aim a wand from inventory/ground
b Browse a book from inventory u Use a staff from inventory/ground
G Gain new spells/prayers from a book z Zap a rod from inventory/ground
m Cast a spell from a book (inv) f Fire an item from inventory/ground
p Pray a prayer from a book (inv) v Throw an item from inventory/ground
E Eat some food from inventory/ground I Observe an item (inv/equip/ground)
F Fuel your lantern from inv/ground
The following example (for 'k' - destroy item) shows some common features.
(Inven: a-c, / for Equip, - for floor, ! for squelched, ESC) Destroy which item?
a) 3 Rations of food
b) a Grey Potion of Slime Mold Juice
c) 3 Wooden Torches (5000 turns)
'a-c' is the range of inventory items, '/' switches to the equipment list,
- shows items on the floor, ! shows squelched items, ESC to cancel.

PaulBlay
February 20, 2009, 16:48
Whoo! I implemented this, compiled it and it actually worked! :D

Files altered:

.\lib\help\help.hlp (Link to new help file)
.\lib\help\invent.txt (New help file)
.\src\cmd3.c (Add local help handling)

Pete Mack
February 20, 2009, 21:58
Did you use the menus from cmd0.c? If not, you are probably duplicating functionality. (The point isn't that duplication is bad necessarily, but that if you ever want to add an inventory command, you will need to modify cmd3.c as well as cmd0.c. That is how "code [gets] all spread to hell and gone."

PaulBlay
February 20, 2009, 22:19
Did you use the menus from cmd0.c? If not, you are probably duplicating functionality. (The point isn't that duplication is bad necessarily, but that if you ever want to add an inventory command, you will need to modify cmd3.c as well as cmd0.c. That is how "code [gets] all spread to hell and gone."

Hey, I said 'heck'. :D

It's handled within the display inventory / display equipment functions. It's probably a bit of a hack but you can see for yourself.

/* PTB */
/* Process '?' */
if (p_ptr->command_new == '?')
{
p_ptr->command_new = 0;

/* Show help screen */
/* Save screen */
screen_save();

/* Peruse the invent/equip help file */
(void)show_file("invent.txt", NULL, 0, 0);

/* Load screen */
screen_load();
}
/* Hack -- Process "Escape" */
else if (p_ptr->command_new == ESCAPE) /* PTB END */

The local store help is handled entirely within store.c so I don't see it's much different to that.

Pete Mack
February 20, 2009, 22:28
Got it. I hadn't quite understood what you were doing. What you've got looks good, just put a comment in cmd0.c that invent.txt needs to be kept in sync.

PaulBlay
March 1, 2009, 09:03
Could a moderator move this to the Development forum?