Problems with varibles

I'm trying to make a game with guns and I'm having trouble with the message the gun prints when you shoot it. Heres what happens:

Command pattern:
shoot #object_gun# at #object_1#
What's supposed to happen:
You shoot the pistol at the dummy
What happens:
You fire the Object: Pistol and it hits the Object: Dummy
Here's the code I'm using:

    <unresolved>You can't shoot.</unresolved>
      switch (object_gun) {
        case (Pistol) {
          switch (object_1) {
            case (Dummy) {
              msg ("You fire the " +object_gun+ " and it hits the " +object_1)
              set (Pistol, "Ammo",  - 1)

Please help fix this. Thanks in advance.

The variables object_gun and object_1 are objects. An object is a complex bundle of data with many values.
When you try to use it as a line of text, the line it gives you is the object's name with "Object: " in front.

In this case, you probably want:

msg ("You fire the " +GetDisplayAlias(object_gun)+ " and it hits the " +GetDisplayAlias(object_1))

I think you might also have a problem with the line: set (Pistol, "Ammo", - 1), which sets the Pistol's Ammo attribute to -1. I suspect that what you want here is set (Pistol, "Ammo", GetInt (Pistol, "Ammo") - 1) or the somewhat less verbose Pistol.Ammo = Pistol.Ammo - 1.

This topic is now closed. Topics are closed after 60 days of inactivity.