In attempting to produce a module for a tabletop game I am developing, I need to provide the module player with certain visual cues that replace things which are obvious in the physical version of the game.
In the game each side begins with several pieces in play, including 17 Warriors, 4 of which are removed as part of the set up process. Each side is limited to 13 Warriors brought into play by the normal build process.
Warriors are built atop Temples, a separate defined piece with a Marker canBuild = true, and a special layer “Build” which is to be activated whenever wCount < wLimit.
wCount can sometimes EXCEED wLimit and therefore deadCount will not increase unless triggered by a an action which specifically checks for wCount < wLimit.
The way I see it logically, the order of events should be:
- A Warrior is destroyed, if this takes wCount below wLimit, this should increase deadCount AND trigger the layer change for Temple (via a global command key property in the Warrior definition which tests for canBuild = true and sends the appropriate keystrokes to pieces with that marker).
The problem is not that I can’t get that to work, but that I can’t get to work with the correct timing. In order to test my logic, I set the wCount and wLimit globals to just 1, which should mean I need only delete 1 Warrior in order to trigger the chain of events described above. However, it takes 2.
I suspect that what is happening is the check of variables is happening simultaneous to the adjusting of those same variables, so on pass 1 no change is detected (it is TAKING place), on pass 2 the change of variables has TAKEN place.
I cannot verify that theory, however, since I have not figured out an easy way of inserting debug dialogues into the module in order to report the state of any given variable at any particular moment in the logic sequence.
This is really annoying me because I think I have a pretty good grasp now on how global and dynamic variables interact, and how to send commands between various elements of the game. Just the timing is not working as I expected.