Is There a Trigger Limit?

I’ve run into a perplexing problem with a mod I’m working on and I’m wondering if it’s a bug or some sort of triggering limitation. Here’s what I’m trying to do:

Each player clicks an icon at the beginning of the game to initialize their clan. This updates a Global Property called ActivePlayerCount to count the number of active players. Once all players are initialized, a continue button is clicked.

This button grabs the first active clan at random, determines a region to occupy, places armies in that region, updates the number of units for that army, adjusts several global properties, and then repeats the process 3 more times so that the player ends up with a total of 4 controlled regions.

Then the process is supposed to go to the next active clan and repeat. This is where the trouble begins. It goes through the first clan perfectly and the only thing that changes before the next clan is started is a counter is updated and checked against the ActivePlayerCount. Beyond that, there is absolutely no difference in the process.

However, when setting up the second clan, I get an Infinite Loop error. I’ve been trying to resolve this problem for a week. I’ve thoroughly checked the process over and over again for duplicate commands, possible loops, etc. and I know there’s nothing wrong with it …especially considering that it sets up the first clan just fine. I’ve also restructured it to run in several different ways and I get same error.

The error I receive doesn’t help much either as it may reference things that would have nothing to do with the process itself. For example, it will name the layer for a graphic on a game piece which is controlled by a dynamic property and state this is the reason for the loop …which doesn’t make sense.

It appears that there’s a limitation in the number of triggers that can be executed in a routine. Regardless, of how I change the process, it always seems to fail at roughly the same point in the process and the error is detailing the last trigger in couldn’t complete as being responsible for the Infinite Loop.

Is there a limit to the number of triggers that you can execute in a routine?

I’ve learned that it’s not a limit on triggers within a process. But the logic that Vassal is using to determine whether a process is stuck in an Infinite Loop is faulty.

Here’s a sample mod (just change ZIP to VMOD).

If contains 2 buttons. Click the first one and it updates a global counter, reports that counter and sends a trigger to the second one which does exactly the same thing and sends a trigger back to the first one to repeat the process.

If left that way, it’s an obvious Infinite Loop. However, I have a filter on the Trigger Actions to only activate if the global counter is less than 100. In other words, I’ve put a brake on the process. So, theoretically, it should run.

If you run it, though, it displays an infinite loop error immediately before it even gets started. I can see where this would be a problem in some cases …like in the routines I’m trying to run in my current mod.

Thus spake “Dr_Nostromo”:

It’s necessarily the case that our algorithm for detecting infinite
loops is faulty, because it’s impossible to detect, in the general case,
whether programs will halt. (This is called the Halting Problem in
computer science. There’s an article on it in Wikipedia.)

Can you suggest a better way, which will still permit most things that
people want to do? (Or, maybe we could make it a warning, rather than
an error?)


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Yeah, I can do thing differently. I can set up a button to run each routine individually instead of looping them but I was hoping to be able to run an automatic process to completion without having to click buttons several times. But, if that’s the way it is, I can live with it.

An Infinite Loop warning instead of an error would be good. Would it be possible to get the warning only when the mod is being edited so that it doesn’t interfere with normal game play? …or perhaps a setting of some kind that will disable it completely when it first displays and the designer knows it’s not a infinite loop?

I think this may already have been addressed by Brent with the updated trigger in 3.2 that allows you to specify how many times to loop the command/key

From: Joel Uckelman uckelman@nomic.net
To: VASSAL Engine Forums Mailing List messages@forums.vassalengine.org
Sent: Wed, April 21, 2010 8:35:28 AM
Subject: Re: [Technical Support & Bugs]Re: Is There a Trigger Limit?

Thus spake “Dr_Nostromo”:

It’s necessarily the case that our algorithm for detecting infinite
loops is faulty, because it’s impossible to detect, in the general case,
whether programs will halt. (This is called the Halting Problem in
computer science. There’s an article on it in Wikipedia.)

Can you suggest a better way, which will still permit most things that
people want to do? (Or, maybe we could make it a warning, rather than
an error?)


J.


Messages mailing list
Messages@forums.vassalengine.org (Messages@forums.vassalengine.org)
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

After looking at it, the updated TA should handle this, allowing control by either a count or expression match. An infinite loop will be very hard to achieve unless the conditions that are set can never be met

From: Timothy Mccarron timothy.mccarron@sbcglobal.net
To: VASSAL Engine Forums Mailing List messages@forums.vassalengine.org
Sent: Wed, April 21, 2010 10:37:51 AM
Subject: Re: [Technical Support & Bugs]Re: Is There a Trigger Limit?

I think this may already have been addressed by Brent with the updated trigger in 3.2 that allows you to specify how many times to loop the command/key

From: Joel Uckelman uckelman@nomic.net
To: VASSAL Engine Forums Mailing List messages@forums.vassalengine.org
Sent: Wed, April 21, 2010 8:35:28 AM
Subject: Re: [Technical Support & Bugs]Re: Is There a Trigger Limit?

Thus spake “Dr_Nostromo”:

It’s necessarily the case that our algorithm for detecting infinite
loops is faulty, because it’s impossible to detect, in the general case,
whether programs will halt. (This is called the Halting Problem in
computer science. There’s an article on it in Wikipedia.)

Can you suggest a better way, which will still permit most things that
people want to do? (Or, maybe we could make it a warning, rather than
an error?)


J.


Messages mailing list
Messages@forums.vassalengine.org (Messages@forums.vassalengine.org)
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Another nice feature. With that and some of the other features that have been discussed, I’m chomping at the bit to see 3.2 :open_mouth: