Can you nest global property names?

I hope I explain what I’m trying to do here.

I have some characters that each have a variable number of starting inventory items that need to be processed (pulled from an inventory supply) at the start of a game.

Each character that can be played (not each player side) has its own map window that has a picture of the character and a space for its inventory.

The best way I can think of to define starting inventory is as a series of Global Properties. For example,
Inventory Item 1 = Rope
Inventory Item 2 = Gun

What I’m trying to do is create a loop that grabs each item from the inventory supply in turn. I can make it work if I feed it each GP name in turn, such as “Go get Inventory Item 1, go get Inventory Item 2…” What I’m wondering is, can I somehow create one loop that says “Go get Inventory Item X” where X is a separate Global Property that gets incremented from 1 to a number defined as that character’s maximum number of inventory items (since it’s variable between characters)?

Trying to do this, I can set up a GP called Item Number Being Processed. However, trying to tell the loop to process $Inventory Item $Item Number Being Processed$$ has the predictable effect of resolving the first two $ symbols that are encountered (as far as I can tell). So instead of resolving $Item Number Being Processed$ as 1 and then resolving $Inventory Item 1$, it tries to resolve “$Inventory Item $” (the first two $ encountered), which, of course, is not a variable name, and so I end up with Inventory Item Item Number Being Processed as the resolution. Like I said, that makes sense, since the $ doesn’t have an “open” or “close” version like parentheses or brackets.

However, trying $Inventory Item ($Item Number Being Processed$)$ and $Inventory Item [$Item Number Being Processed$]$ doesn’t work, as it seems the brackets and parentheses are ignored as far as I can tell. It’s not that I expected it to work, but I figured I would try it before posting here.

I can put “Inventory Item $Item Number Being Processed$” into another Global Property (so that that Global Property now holds the name of the GP I want to work on), but, again, I don’t have a way to get Vassal to treat that GP name as a GP itself, so this doesn’t really help me.

In short, what I’m asking is if there a way of processing a GP where part of the GP name has another GP value nested in the name? Like I said, I can make a Trigger Action that says “Process Item 1” and underneath that, “Process Item 2” all the way to “Process Item 10.” In this case, if certain Items are defined as “empty” or “none” then they won’t be processed, since there’s no matching inventory item called “empty” in the inventory supply. It’s not elegant, but I’m pretty sure it will work. Just wondering if there’s a more efficient way to do this as a loop rather than a series like this.

Let me amend this–it’s not that parentheses and brackets are ignored. It’s that they’re treated as regular characters rather than metacharacters, so they don’t modify the order of resolution of the GP value in any way.

No, At this point there is no really efficient or elegant way to do this sort of processing. This will change with the introduction of full scripring (3.3, might sneak into 3.2).

In the meantime, you need to to do the processing in two stages. Set one GP (Say INDEX) to Inventory Item 1, Inventory Item 2 in turn, then use $INDEX$ to reference the final value.


Messages mailing list …

Post generated using Mail2Forum (