Kit_Sune's Cardgame

Kit_sune
23 Oct 2012, 21:26
Here's an idea. Instead of bogging the forum with topic after topic of my questions, I'll just create this one topic, and all my questions will go in here because they'll be related to the test game I'm making.

Okay. So here's the basic concept.
You control up to two "Main Characters", and have a deck of cards for each. You get to pick and choose which cards go in the deck before the face-off starts.
I've figured the easiest way to do this would be to create objects for all the cards, with attributes for each of the cards to tell you about them, and simply move them around from a "deck" object, to a "hand" object, and later put in/on a "battlefield" object. Any cards that you own that are not in either of these are simply possessed, and are being carried in your inventory.

However, I'm having trouble modifying the "Inventory" command in the core file. I'm not modifying the actual file, I'm just trying to make a command similar to it that does the same thing.

Core Inventory code
<command name="inventory" pattern="[inventory]">
list = FormatObjectList(Template("CarryingListHeader"), player, Template("And"), ".", true)
if (list = "") {
msg (Template("NotCarryingAnything"))
}
else {
msg (list)
}
</command>

Hand Command
<command name="Hand">
<pattern>hand</pattern>
list = FormatObjectList("You are holding ", player, "and ", ".", true)
if (list = "") {
msg ("Your hand is empty.")
}
else {
msg (list)
}
</command>


But I keep getting:
Error running script: Object reference not set to an instance of an object.

Am I supposed to somehow tell it that "player" is an object?

jaynabonne
23 Oct 2012, 21:32
Try following the same format as the Inventory command:

  <command name="Hand" pattern="hand">
list = FormatObjectList("You are holding ", player, "and ", ".", true)
if (list = "") {
msg ("Your hand is empty.")
}
else {
msg (list)
}
</command>


Note where "pattern" goes, as an attribute, not as a nested element.

Kit_sune
23 Oct 2012, 21:47
Ugh, why would it have to be that?! I originally had it that way and I couldn't get it to work, so I created a command in Quest and pasted the scripting into it.

I must have had some error somewhere I couldn't see.

Well that did it! Thanks again ^^