Conditional / Early Exit operator
12foo opened this issue ยท 2 comments
Hi, it's me again with stuff that improves trinkets or metacasting! While stopping or modifying a manual spell is easy (just stop drawing or draw something else), it's not so easy for a packaged spell on a trinket. And maybe probably you've already thought about this, but is there going to be a way of conditionally executing patterns? I can think of two operators:
- Conditional Abort: if the top of the stack is 0 or NULL, terminate the entire spell immediately without mishaps or repercussions. Otherwise, execute next pattern.
- Full-Blown If: Takes 2
SpellDatum
s and a value. If value is anything but 0 or NULL, output first spell datum. If it is 0 or NULL, output the second. If the player uses lists of patterns as datums and combines with Hermes, this translates to a full if statement, and since Hermes has a built-in cost, it's not terribly OP either. Additionally, if the top of the stack is NULL, Hermes could also terminate the spell entirely.
Again, happy to put in the work for my own suggestions, so please let me know if you'd like a PR for any of those (or anything else that seems useful).
Ooh, the second point is a good idea. I should add that for 0.6.0 (which will release, eventually, I promise); it would match with the other logical operators I added.
I'm going to close this to merge into #78, which I think is more elegant