Forum Discussion
Is there a way to auto run some triggers in a loop until the results are met?
- 3 months ago
JavaScript is more elegant and efficient, but for a few variables, you can do it with a handful of triggers on a layer.
Demo: https://360.articulate.com/review/content/041f67c6-c44a-47e8-a301-632caa78772b/review
This just shows a layer that assigns 4 random numbers to 4 variables. If any are the same, it reruns the the layer until they are all unique. This is very brute-force, but very simple. The triggers are fast enough that even if it takes many attempts, it is still practically instant.
This could be modified with a few more triggers to be more elegant, recalculating each random number only if it matches one of the previous variables, but in the end it is essentially the same thing. Simple gets the job done.
As Nedim mentioned, if you try this with many variables, it could begin to slow down, or require too many triggers. In that case, JavaScript is the way to go.
JavaScript is more elegant and efficient, but for a few variables, you can do it with a handful of triggers on a layer.
Demo: https://360.articulate.com/review/content/041f67c6-c44a-47e8-a301-632caa78772b/review
This just shows a layer that assigns 4 random numbers to 4 variables. If any are the same, it reruns the the layer until they are all unique. This is very brute-force, but very simple. The triggers are fast enough that even if it takes many attempts, it is still practically instant.
This could be modified with a few more triggers to be more elegant, recalculating each random number only if it matches one of the previous variables, but in the end it is essentially the same thing. Simple gets the job done.
As Nedim mentioned, if you try this with many variables, it could begin to slow down, or require too many triggers. In that case, JavaScript is the way to go.
- Nathan_Hilliard3 months agoCommunity Member
As an interesting aside, you can reliably generate about 6 randomized variables this way. Speed, however, doesn't seem to be the problem for additional entries.
It appears that the iterations generally cap somewhere between the mid-200s and mid 300s. There may be some kind event buffer that maxes-out, and any further trigger events generated in this loop-like structure are ignored.
Possibly a useful tidbit for future troubleshooting of complex trigger setups.
Related Content
- 7 months ago
- 4 months ago
- 10 years ago