Go Back   Angband Forums > Angband > Development

Thread Tools Display Modes
Old September 2, 2010, 11:04   #1
NPPAngband Maintainer
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
Quick question about ui-menu.c

I am working on getting the NPP squelch using the latest UI from Angband, and I can't figure something out.

Inside the sval squelch menu, I am trying to make it so the player can navigate by menu selections as well as the arrow keys. The original menu.cmd_keys was this:

const char cmd_keys[] = { ARROW_LEFT, ARROW_RIGHT, '\0' };
menu.cmd_keys = cmd_keys;

The up and down arrows worked to navigate the screen, and left and right toggled the settings.

I am trying to do the same thing, except let the player type a single letter to jump to another setting using the menu.selection option.

So I have this in there (I need to reserve ANSL for the 4 NPP squelch settings, and I wanted them to be able to be toggled by + and - as well as the arrow left and right keys:

menu.cmd_keys = "ANLS+-\x8A\x8B\x8C\x8D\n\r"; /* \x8A-D = ARROW DIRECTION KEYS */
menu.selections = "abcdefghijklmnopqrstuvwxyzBCDEFGHIJKMOPRTUVWXYZ12 3467890";

When I add the menu selections line. I lose the use of the arrow up and down keys to navigate. When I comment it out, I lose the arrow up and down keys for navigation. Arrow left and right don't get any response either way.

My sval action is squelch.c looks like this:

switch (cmd)

case 'S':
k_info[idx].squelch = SQUELCH_ALWAYS;
return (TRUE);
case 'L':
k_info[idx].squelch = NO_SQUELCH_NEVER_PICKUP;
return (TRUE);
case 'A':
k_info[idx].squelch = NO_SQUELCH_ALWAYS_PICKUP;
return (TRUE);
case 'N':
k_info[idx].squelch = SQUELCH_NEVER;
return (TRUE);

case '+':
change_squelch_setting(idx, 1);
return TRUE;
case '-':
change_squelch_setting(idx, -1);
return TRUE;
default: break;

What am I missing to get all the direction keys and the menu.selection option working at the same time? Thanks.
nppangband is offline   Reply With Quote
Old September 2, 2010, 21:57   #2
Join Date: Mar 2008
Posts: 2,712
PowerDiver is on a distinguished road
This is most likely incorrect advice, but I remember the last time I tried something with a constant similar to abcdefghijklmnopqrstuvwxyzBCDEFGHIJKMOPRTUVWXYZ12 3467890 it turned out there were two of them depending upon roguelike keyset, and I wasn't modding the one that matched my key setting.
PowerDiver is offline   Reply With Quote
Old September 5, 2010, 21:46   #3
Pete Mack
Join Date: Apr 2007
Location: Seattle, WA
Posts: 6,589
Donated: $40
Pete Mack is on a distinguished road
Did you get this worked out? Eddie's comment about roguelike keyset is very likely the right one.
Pete Mack is offline   Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick macro question Zikke Vanilla 16 June 23, 2010 17:53
quick question Malak Darkhunter Vanilla 2 February 8, 2010 01:57
Quick Stealth Question Zikke Vanilla 9 November 4, 2009 12:43
quick question re: sauron, ironman, destruction fizzix Vanilla 1 September 22, 2009 16:33
Quick Term_erase question. PaulBlay Development 7 May 28, 2009 15:19

All times are GMT +1. The time now is 10:02.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.