It looks to me like you're missing a bracket at the end of EVERY event. If your on TEXT event has 2 {'s in it, then it better have 2 }'s in it as well.
If you put your script into mIRC's script editor, switch tabs to something else, then switch back, you'll notice that each on TEXT event does not start at the beginning of the line. This tells you that you're missing a bracket. ALL events should start at the beginning of the line and ALL items inside those events should be spaced at least 2 spaces from the beginning of the line (they shouldn't be at the beginning of the line). When you tab to something else (aliases, for example), then back to your script, it will put the spacing in based on your {}'s. You can then find any errors you have.
After switching tabs like that, if you see something like this (notice the second on TEXT event), you know you're missing a } before that second event.
on *:text:hello:#: {
if (%test == $true) {
do this
}
on *:text:goodbye:#: {
Or, if you see something like this:
on *:text:hello:#: {
if (%test == $true) {
do this }
}
else do this
}
on *:text:goodbye:#: {
Because the else is not spaced in from the edge, you know that you have too many }'s (or not enough {'s ).