That's good to hear! Best of luck on the redesigning. Making parsers is a bitch.
And I just finished rewriting most of it. There's only the one thing with output events and its parameters that needs to be adjusted so you may put the parenthesis on a new line, which you cannot do now.
Sure. How about this?
# Makes a brick change colors on a loop when toggled
# Start color changing (start with events enabled)
[x][0]onActivate->Self->playSound("Beep_Checkout.wav")
[x][33]onActivate->Self->fireRelay
# Stop color changing (start with events disabled)
[ ][0]onActivate->Self->playSound("Beep_Denied.wav")
[ ][0]onActivate->Self->cancelEvents
# Alternate between starting and stopping color changing
[x][0]onActivate->Self->toggleEventEnabled("0 1 2 3")
# Change colors
[x][0]onRelay->Self->setColor("0.898039 0.000000 0.000000 1.000000")
[x][500]onRelay->Self->setColor("0.898039 0.898039 0.000000 1.000000")
[x][1000]onRelay->Self->setColor("0.000000 0.498039 0.247059 1.000000")
[x][1500]onRelay->Self->setColor("0.200000 0.000000 0.800000 1.000000")
# Loop color changing
onRelay->Self->fireRelay
# Stop color changing when brick is blown up
onBlownUp->Self->cancelEvents
I ran your script and it parsed perfectly. However, it will display a warning for the colors if they don't exist in the colorset. Also, I noticed that on line 21 it didn't have any delay, which will destroy the whole purpose. I've put 2000 delay on it and will update all my examples to this instead and credit you.
Please note that I couldn't get the latter code to import to a brick. In fact, I tried pasting
[ ][500]onBlownUp->Player->Kill
from your example, and it gave me an error. It tells me I have an invalid amount of parameters.
Is fixed in next version.
Also, copying code from in-game does not seem to work. For instance, when I copy the aforementioned events from a brick, it gives me
-snip code-
which can not be pasted into another brick.
Looks like you are using an Add-On that might modify the default layout so when I read it I get bogus data. If so, please tell me and I'll find a fix around it.
While this would be simpler to parse, it's a bit clunkier, as per the disadvantages you listed. It's probably a bad idea to have labels attached to events. Granted, your label could always be listed like this
# Turn light on
[on1]
[x][0]onActivate->Self->setLight("Player's Light")
[on1]
[x][0]onActivate->Self->setEventEnabled([offStart:], 1)
[on1]
[x][0]onActivate->Self->setEventEnabled([on1, on2, on3], 0)
# Turn light off
[offStart]
[][0]onActivate->Self->setLight("Player's Light")
[][0]onActivate->Self->setEventEnabled([on1, on2, on3], 1)
[][0]onActivate->Self->setEventEnabled([offStart:], 0)
which would solve that problem. However, it doesn't change the weird naming problem. To fix that, you could simply pre-parse the square brackets at the beginning of an event listing, and allow the first to be named anything if 3 sets of square brackets are present instead of 2. It still feels a tad dirty from a coding perspective, though.
I think that labels at all is dirty. It's frowned upon in all languages but where it came from. It is sometimes a necessity, though. In our case, we're not using it like others are using it, so adding labels in such a fashion might confuse people, or make it obvious to them. Keep in mind, that when labeling is used with indexing [from:to], it's not obvious that it's to-1. By having it at the event, it might make it more apparent that we are aiming at the event, instead of the event after it.