Remap ThrowAction to PutAction

Hello TADSies !

I wonder how I would remap “throw x into y” to “put x on y” for example. In my case, I would like to be able to “throw something into the fire”. However, when I try to remap the action, and “throw something into the fire”, a null pointer exception is thrown instead (pun not intended).

The reason seems to be that the ThrowAtAction is meant to be used when throwing something at a distant location / object. In this case, the fire is at the same room as the something. Would I simply require some kind of DistanceConnector to allow “throw” (or “throw at”)? What would that look like?

I hope this makes sense and that this general explanation suffices to be clear and precise. Otherwise, I am happy to share code (however, it uses a german language library and thus may be rather confusing instead of helpful).

Have a great week and thanks to all contributors in advance.

1 Like

I suspect something untoward has snuck into your code, because this should be painlessly accomplished. Perhaps you could post code?
Are you using the remapTo macro?

Yeah. Maybe the syntax of the remapTo is borked?

Here’s a trivial example including a pebble and a shelf, where >THROW PEBBLE AT SHELF is treated as >PUT PEBBLE ON SHELF:

#charset "us-ascii"
#include <adv3.h>
#include <en_us.h>

startRoom: Room 'Void' "This is a featureless void with a shelf. ";
+Fixture, Surface '(wooden) shelf' 'shelf'
        "It's a wooden shelf. "
        iobjFor(ThrowAt) remapTo(PutOn, DirectObject, self)
;
+pebble: Thing 'small round pebble' 'pebble' "A small, round pebble. ";
+me: Person;


versionInfo: GameID;
gameMain: GameMainDef initialPlayerChar = me;

Transcript:

Void
This is a featureless void with a shelf.

You see a pebble here.

>throw pebble at shelf
(first taking the pebble)
Done.

>l
Void
This is a featureless void with a shelf.

On the shelf is a pebble.

>
2 Likes