Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old May 19, 2008, 00:03   #1
shevek
Rookie
 
Join Date: May 2008
Posts: 16
shevek is on a distinguished road
Macro problem

So I'm playing a ranger, and I'm trying to get archery macro'd. I use the roguelike key set, so I inscribed my arrows with:

@t5

And then I macro'd

t5*t

And when I call the macro it returns "take off which item?" as if I had macro'd T.

Any thoughts? What am I doing wrong?
shevek is offline   Reply With Quote
Old May 19, 2008, 00:26   #2
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 927
Donated: $10
will_asher is on a distinguished road
Inscriptions do not change with the roguelike keyset, so you still have to inscribe your arrows with @f1 (or @f5). I think this is a bug that you still have to inscribe commands for the keypad keyset even when you're using the roguelike keyset.
It strange to use the "t" command to fire an arrow inscribed with "@f1".
__________________
Will_Asher

Play DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home
will_asher is offline   Reply With Quote
Old May 19, 2008, 10:31   #3
Elsairon
Adept
 
Join Date: Apr 2007
Posts: 117
Elsairon is on a distinguished road
Note: Added to Angband Trac, Ticket 606.

http://angband.rogueforge.net/trac/ticket/606
Elsairon is offline   Reply With Quote
Old May 19, 2008, 14:16   #4
roustk
Adept
 
Join Date: Dec 2007
Posts: 167
roustk is on a distinguished road
Quote:
Originally Posted by Elsairon View Post
Note: Added to Angband Trac, Ticket 606.

http://angband.rogueforge.net/trac/ticket/606
And you are fundamentally wrong.

*Inscriptions* always assume the standard keyset.
Macros use the selected keyset (roguelike or standard).

The original poster's problem is that his 't5*t' macro is not finding his '@t5' arrows. That macro is processed as follows:
* 't' is sent to keypress processor, which translates 't' to 'f'ire passing it through the roguelike keymap. 'f'ire then wants to know what ammo.
* '5' in response to 'f' means "find the item with '@5' or '@f5'". Nothing is found with those inscriptions, so the game reports "Illegal object choice (tag)!".
* 'f'ire then asks again "Fire which item?" and stops processing the macro (due to error).

The inscription problem was reported long ago, and is surprisingly hard to fix in a robust manner. See ticket 437.

Kevin
roustk is offline   Reply With Quote
Old May 19, 2008, 17:45   #5
Slick
Scout
 
Join Date: Oct 2007
Posts: 48
Slick is on a distinguished road
I also use the roguelike keyset. [been playing since "Rogue"; no kidding.]

I inscribe ammo with: {@1=g

and I map F1 with: t1*t


and everything works fine. Obviously you can use another number and also obviously, with this bug, you should not try to be fancy; use a number for ammo/firing which is not used with any other commands. That way you need not include the command "t" on the ammo inscription.

Side note, when playing rangers, I also inscribe "good" ammo with @2=g and map F2 with t2*t. With this setup, I can shoot normal ammo at weak/avg monsters with F1 and I can shoot good ammo at tough monsters with F2.

The "=g" just ensures that I'll auto-pickup the ammo if/when I shoot my last one.
Slick is offline   Reply With Quote
Old May 19, 2008, 17:46   #6
shevek
Rookie
 
Join Date: May 2008
Posts: 16
shevek is on a distinguished road
Quote:
Originally Posted by roustk View Post
And you are fundamentally wrong.

*Inscriptions* always assume the standard keyset.
Macros use the selected keyset (roguelike or standard).

The original poster's problem is that his 't5*t' macro is not finding his '@t5' arrows. That macro is processed as follows:
* 't' is sent to keypress processor, which translates 't' to 'f'ire passing it through the roguelike keymap. 'f'ire then wants to know what ammo.
* '5' in response to 'f' means "find the item with '@5' or '@f5'". Nothing is found with those inscriptions, so the game reports "Illegal object choice (tag)!".
* 'f'ire then asks again "Fire which item?" and stops processing the macro (due to error).

The inscription problem was reported long ago, and is surprisingly hard to fix in a robust manner. See ticket 437.

Kevin
Actually it looks to me like macros only call the standard keyset (hence the weird return reported in my original post). My macro was only fixed when I switched both t5 to f5 and the macro to "f5*t".
shevek is offline   Reply With Quote
Old May 19, 2008, 17:56   #7
roustk
Adept
 
Join Date: Dec 2007
Posts: 167
roustk is on a distinguished road
Quote:
Originally Posted by shevek View Post
Actually it looks to me like macros only use standard keyset (hence the weird return reported in my original post). My macro was only fixed when I switched both t5 to f5 and the macro to "f5*t".
Which version are you playing? I don't see this behavior in 3.0.9, 3.0.9b, or a recent nightly 3.1.0 (from about May 10). I can create a macro (=m4 <F1> t5*t <enter> for 3.0.9) and it works perfectly fine.
roustk is offline   Reply With Quote
Old May 19, 2008, 18:26   #8
shevek
Rookie
 
Join Date: May 2008
Posts: 16
shevek is on a distinguished road
Quote:
Originally Posted by roustk View Post
Which version are you playing? I don't see this behavior in 3.0.9, 3.0.9b, or a recent nightly 3.1.0 (from about May 10). I can create a macro (=m4 <F1> t5*t <enter> for 3.0.9) and it works perfectly fine.
Very odd. I'm playing the MacOS build of 3.0.9b. I've double checked and t5*t definitely returns "Take off which item?"
shevek is offline   Reply With Quote
Old May 19, 2008, 20:25   #9
roustk
Adept
 
Join Date: Dec 2007
Posts: 167
roustk is on a distinguished road
Quote:
Originally Posted by shevek View Post
Actually it looks to me like macros only call the standard keyset (hence the weird return reported in my original post). My macro was only fixed when I switched both t5 to f5 and the macro to "f5*t".
I may have found it. Is it possible that you created a keymap, not a macro?

* Macros are fed through the keymap parser (e.g., request_command() in util.c), so 't5*t' fires '@f5' ammo in roguelike mode (and takes off @t5 equipmet in standard).
* Keymaps are fed directly to the main switch in process_command() in cmd0.c, so 't5*t' takes off '@t5' equipment in roguelike or standard mode.
* Inscriptions are interpreted using only the internal (standard) commands.


When you press a key, inkey_aux() checks whether it is a macro trigger. If so, it sends the macro string to inkey_ex() one character at a time. Otherwise, it sends the keypress to inkey_ex().

inkey_ex() and inkey() strip bad characters from their input and translate backquote as escape before sending it to request_command().

request_command() checks whether its input has a keymap. If so, it sends the keymap string to process_command() one character at a time. Otherwise, it sends its input to process_command(). Note that roguelike is a big keymap.

process_command() looks up its input in the big table of functions (in cmd_* structures in cmd0.c) and calls the appropriate command. For example:
Code:
/* Magic use */
static command_type cmd_magic[] =
{
        { "Gain new spells or prayers", 'G', do_cmd_study },
        { "Browse a book",              'b', do_cmd_browse },
        { "Cast a spell",               'm', do_cmd_cast_or_pray },
        { "Pray a prayer",              'p', do_cmd_cast_or_pray }
};

So, if you create a macro that connects <F1> to 't5*t' and then press <F1> in roguelike mode, the following occurs:
1) inkey_aux() translates <F1> into 't5*t'. It sends 't' to request_command() and leaves '5*t' in the queue.
2) request_command() looks up 't' in the roguelike side of the keymap table and finds an 'f'.
3) process_command() looks up 'f' and finds do_cmd_fire() in cmd_item_use[].
4) do_cmd_fire() uses get_item() to find your ammo. It gets one character from the queue ('5'), recognizes it as a number, and tries to find an inscription to match. First, it checks for something inscribed '@5'. Failing that, it looks for '@f5' (since 'f' was sent to process_command()).
5) Then do_cmd_fire() uses get_aim_dir() to find your target. It gets one character from the queue ('*'), recognizes it as a request for targeting mode, and calls target_set_interactive(). That makes a list of targets, asks about the first one, gets one character from the queue ('t'), recognizes it as a acceptance (like 5, 0, and .), and returns the target to do_cmd_fire().

On the other hand, if you create a keymap that connects control-Z with 't5*t' in roguelike mode, the following occurs.
1) inkey_aux() does nothing to control-Z.
2) request_command() looks up control-Z in the roguelike side of the keymap table and finds 't5*t'. It sends the 't' to process_command() and leaves '5*t' in the queue.
3) process_command() looks up 't' and finds do_cmd_takeoff().
4) do_cmd_takeoff() uses get_item() to find your item to take off. It gets one character from the queue ('5'), recognizes it as a number, and tries to find an inscription to match. First, it checks for something inscribed '@5' in your equipment. Failing that, it looks for '@t5' (since 't' was sent to process_command()).
5) Failing to find anything appropriately inscribed, it clears the queue and asks again "Take off what item?".

Kevin
roustk is offline   Reply With Quote
Old May 19, 2008, 20:43   #10
shevek
Rookie
 
Join Date: May 2008
Posts: 16
shevek is on a distinguished road
Aha. Yes. It would appear that it is indeed a keymap.
shevek is offline   Reply With Quote
Reply


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
Tunneling macro help... Skitzman69 Vanilla 3 April 30, 2012 05:39
shooting macro Andiiboi Vanilla 14 March 28, 2008 12:56
New, mysterious problem gglibertine Vanilla 3 March 18, 2008 06:46
Macro question g. rodrigues Vanilla 1 March 5, 2008 11:23
problem with graphics mjtokarski Vanilla 11 July 8, 2007 00:40


All times are GMT +1. The time now is 16:37.


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