Implementing a lookup table

I want to add a function in a module that rolls a die and replaces a units trait value with the corresponding value in the lookup table using the die roll. Spreadsheet traits don’t seem to expose their values to expressions so I’m wondering how other modules do this - I’m guessing custom classes? Any examples I can look at to help me along? Thanks! jas…

My first thought is to implement your lookup table as set of global properties, such as:
gp1 = “a”
gp2 = “b”
gp3 = “c”
Etc

If the die result is in a property called “result”, set the trait to {GetProperty(“gp”+result)}

Is that any help?

2 Likes

Yes, I suspect that’s GEFN.

I’d like it if the tables were all in one nicely package place instead of floating around as disconnected properties. A property list for example. But until then, or if there isn’t anyone out there that has implemented this as a custom class solution - I will use your suggesting to “Just Get It Done”. Thanks! jas…

1 Like

I’d like it if the tables were all in one nicely package place instead of floating around as disconnected properties.

Put that set of properties in an appropriately named folder.

2 Likes

I don’t think it can be stated too many times how wonderful folders are at cleaning up and organizing module behaviors.

Galileo: “How do we know there’s a God?”
Grand Inquisitor: “Because VASSAL has folders!”

2 Likes

The GPs folder can accept sub folders and still remain GPs? That would be absolutely grand as I have of beggars ATM and it takes while to scroll down through them.

Yes, Folders are completely invisible in the hierarchy. Any ‘thing’ that can go into a component can also go into a folder in that component to any depth of folders and still be a ‘thing’ belonging to that component.

1 Like

Swear word, cool. I never knew that. Does the developers guide say that somewhere? I know the old 3.1 designers guide pretty well, still sort of going through the new wiki as I need to, and I do not believe that I have read that core information.

It is mentioned in the Reference manual, which we maintain, but the Developer/Designer guide was not written by the Dev team and has not been updated in a long time.

1 Like

Not so fast Brent. The Move Camera Button cannot be placed into a folder of its parent Map.