increpare / PuzzleScript

Open Source HTML5 Puzzle Game Engine
MIT License
903 stars 159 forks source link

Any tutorial for the usual flow control statements in PuzzleScript #802

Closed ramified closed 2 years ago

ramified commented 2 years ago

Is there any rule for simulating the "if" statements and the "for" statements? For example the rule "[ ... ] -> [ ... ]" can be viewed as a special form of "if" statement, and startloop ... endloop may replace the "for" statements in some special case. But there are still restricted.

For instance, the rules in startloop ... endloop will be applied repeatedly until it no longer applies anywhere, but do we have something to "break the loop -- when some other condition is satisfied"? Also, I would like to do "when there is no crate in the screen, then turn something to the other thing", but the conditions in "WinConditions" can't be directly transformed to rules in "Rules" part.

By the way, in your Documentation you said that each of my rules is applied as often as it can be. But how could I make it happens only once? Do I have to introduce one transparent object for doing so?

As a beginner, I don't know if those programming problems are complicated or not, so maybe I asked some silly questions. I guess there should be some tutorials for these small problems. Thanks in advance for your help!

increpare commented 2 years ago

https://groups.google.com/g/puzzlescript?pli=1

Better to ask this on the mailing list above. More people will be able to help you there rather than waiting on a reply from me (though I too might reply there).

(Quick and not totally helpful answer to your questions: usually, usually, the random keyword, no)

ramified @.***> schrieb am Do. 10. Feb. 2022 um 18:28:

Is there any rule for simulating the "if" statements and the "for" statements? For example the rule "[ ... ] -> [ ... ]" can be viewed as a special form of "if" statement, and startloop ... endloop may replace the "for" statements in some special case. But there are still restricted.

For instance, the rules in startloop ... endloop will be applied repeatedly until it no longer applies anywhere, but do we have something to "break the loop -- when some other condition is satisfied"? Also, I would like to do "when there is no crate in the screen, then turn something to the other thing", but the conditions in "WinConditions" can't be directly transformed to rules in "Rules" part.

By the way, in your Documentation https://www.puzzlescript.net/Documentation/documentation.html you said that each of my rules is applied as often as it can be. But how could I make it happens only once? Do I have to introduce one transparent object for doing so?

As a beginner, I don't know if those programming problems are complicated or not, so maybe I asked some silly questions. I guess there should be some tutorials for these small problems. Thanks in advance for your help!

— Reply to this email directly, view it on GitHub https://github.com/increpare/PuzzleScript/issues/802, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADRVYD3WFL52GCGNARSNUTU2PYU7ANCNFSM5OBOMMZA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

ramified commented 2 years ago

Thanks! Your short answer is already enough good for me.