throw object at object?
jmnevil54
03 Jun 2020, 20:05Hi. I was wondering, how do you do a command where you throw an object at another object? Is it something like...
throw indirect object at direct object
...?
mrangel
03 Jun 2020, 22:12You'd make the pattern something like throw #object1# at #object2#
. And the scope would probably be object1=inventory|object2=room
.
Then you have 2 variables in the command script, object1
and object2
, that you can examine to make sure they're suitable.

Doctor Agon
03 Jun 2020, 22:24Something like that.
The command pattern would be;
throw #object1# at #object2#
or if you know the object that has to be thrown;
throw spear at #object#
then, forgive the pseudo code here, you'd want to check for objects, so in the first case:
if object1 = spear and object2 = bear
then...
else...
You might even want to put in a command throw #object#
, and for a message to print saying something like
You need to specify an object to throw at...
, or similar.
jmnevil54
04 Jun 2020, 00:37Thank you!
Edit: Okay, now I have a pattern of throw #object1# at #object2#. The command is named throw 2.
This is the code.
msg ("You threw the blank at the blank!")
MoveObject (object1, object2)
Edit 2: Nevermind, I got it!
mrangel
04 Jun 2020, 07:39Your command probably needs to check that the objects are available. With the script you posted, you could use it to pick up immovable objects ("throw door at me"), or to put objects in something that isn't a container ("throw dave at computer").
Always remember to check the validity of objects when creating commands :)