@var delim, nomits
@var comma
@var displayOnControl, display, totalItemsDisplayed
#
@sub dispListDmg(listName)
@foreach(%listName%)
@if !@sublist and !@`Omit on Control Sheet`
@if optPresent('Damage') and !inCategory('Ranged Weapon')
%@name% %optValue('Damage')%; \
@endif
@endif
@endfor
@endsub
#
@sub reaction(listName)
@foreach(%listName%)
@options()
@if @optname = "Reaction"
%delim%%@name%: %@optvalue%\
@delim="; "
@endif
@endoptions
@endforeach
@endsub
#
@sub SetDisplayVars(listName)
@nomits=0
@displayOnControl=0
@foreach(%listName%)
	@if @`Display on Control Sheet`
		@displayOnControl=1
	@elseif @`Omit on Control Sheet`
		@nomits=nomits+1
	@endif
@endfor
@endsub
#
@sub SetDisplay()
	@display=0
	@if displayOnControl
		@if @`Display on Control Sheet`
			@display=1
		@endif
	@else
		@display=!@`Omit on Control Sheet`
	@endif
@endsub
#
@sub ListItems(listName)
@var cost, level, name
@SetDisplayVars(listName)
@delim=""
@if countItems(listName, 0, 0, 0) > nomits
%listName%: \
@foreach(%listName%)
@if !@sublist
@SetDisplay()
@if display
@totalItemsDisplayed=totalItemsDisplayed+1
%delim%\
@delim="; "
$$extract(name, level, cost)
@if level and level != " "
%name% %level%\
@else
%name%\
@endif
@endif
@endif
@endforeach
. \
@endif
@endsub
#
Points: %total%. \
@delim=""
Reaction: \
@reaction('Advantages')
@reaction('Disadvantages')
@reaction('Powers')
@if delim
.\
@endif

@listItems('Advantages')
@listItems('Powers')
@listItems('Disadvantages')
@SetDisplayVars("Quirks")
@if @Quirks > nomits
@delim=""
Quirks: \
@foreach(Quirks)
	@SetDisplay()
	@if !@sublist and display
		@output %delim%%@name%\
		@delim="; "
		@totalItemsDisplayed=totalItemsDisplayed+1
	@endif
@endforeach
.\
@endif
@if totalItemsDisplayed > 0

@endif
#
@SetDisplayVars("Skills")
@if @Skills > nomits
Skills: \
@foreach(Skills)
@if !@sublist
@SetDisplay()
@if display
?comma?, ??\
@comma=1
@if inCategory('Note')
%replaceString(replaceString(@name,'/[\n\r]+/',' '), '/ +$/','')%\
@else
%@name%-%@level%\
@endif
@endif
@endif
@endforeach
.
@endif
#
@delim=""
Damage: \
@dispListDmg('Skills')
@dispListDmg('Advantages')
@dispListDmg('Powers')
@dispListDmg('Equipment')
Punch: %punch%; \
Kick: %kick%.\
@if @Equipment > 0
@delim=""
 Equipment: \
@foreach(Equipment)
@if !@sublist and !optPresent('Damage')
%delim%\
@delim="; "
%@name%?optPresent('Quantity')? (×%@Quantity%)??\
@endif
@endforeach
.
@else

@endif
@if countItems("Equipment:Ranged Weapon", 0, 0, 0) > 0
@delim=""
Weapon Ranges: \
@foreach(Equipment)
@if inCategory('Ranged Weapon')
%delim%\
%@name%: %@Damage%, SS: %@SS%, Acc: %@Acc%, ½: %@Half%, Max: %@Max%\
@delim="; "
@endif
@endforeach
.
@endif
#
@if @Spells and ConfigParam("PrintSpellsWithSkills")
@SetDisplayVars("Spells")
@delim=""
@if @Spells > nomits
Spells: \
@foreach(Spells)
	@if !@sublist
		@SetDisplay()
		@if display
			@if inCategory('Note')
				@output %delim%%@name%\
			@elseif incategory('College Skill')
				@output %delim%%@name%-%optValue('Level')%\
			@else
				@output %delim%%@name%-%@level%\
			@endif
			@delim=", "
		@endif
	@endif
@endforeach
?delim<>""?.??
@endif
@endif