Hi, Sprafa.
I see where you're coming from. You don't close lines in Tagz because there are no lines for the parser. Theoretically you can delete all line breaks from a script and it keeps working. Of course, reading such a thing would be extremely tedious.
The things you really open and close are tag fields, strings and functions. The first two are easy: %field name% and 'some text'. Functions can be more tricky because they may be nested, i.e. a function contains a seconds functions which possibly again contains a third one. However, the logic always stays the same.
All arguments of a function are enclosed in a set of brackets and the arguments separated with commas.
$fnc(arg1,arg2,arg3)
No problem here I suppose. You just open the bracket, list the arguments and then close the bracket. The function always ends with its closing bracket - even when there's no arguments like with tab().
The problem starts when an argument again is a function because the you have two sets of brackets to take care of. Let's extend the example a little:
arg3 = $bar(argA,argB)
$fnc(arg1,arg2,$bar(argA,argB))
Note the two closing brackets at the end. The first one belongs to $bar, the second one to $fnc. And if we substitute again
argB = $bla(argX,argY)
this is the result:
$fnc(arg1,arg2,$bar(argA,$bla(argX,argY)))
You see the logic behind this?
Your script. Its structure should be:
$if(condition,$select(condition,action1,action2))
But you did:
$if(condition,$select(condition,action1))action2
adding the track 2 code outside the whole if-select construction, executing it for every line. That's the same as writing instead of the last example:
Correct: $fnc(arg1,arg2,$bar(argA,$bla(argX,argY)))
Your way: $fnc(arg1,arg2,$bar(argB))$bla(argX,argY)
Your script should be this:
$if($get_global(isAlbum)
,
//ALBUM
$select(%tracknumber%
,
//Track 1
$tab()$if2(%album%,'<no album>')' '['Disc '%disc%]$if2(%album date%,[%date%])$tab()
,
//Track 2
' '$if2(%album artist%,'<no artist>')
' '$upper(%codec%)
' '$upper(%bitrate%) 'KBPS'
))
One tip for writing such constructions. Even for simple ifs I always start like this
$if(
)
and then enter everything in between. Otherwise it's really easy to get lost between all the brackets.
Hm, now, probably it is worth adding some words about nesting to the tutorial. I'll keep that in mind for the next update.
Brother John