#!/bin/sh
# weflnwef \
exec wish "$0" "$@"

wm title . "GearKrieg Calculator"
wm resizable . 0 0


# tkGK.tcl
set version 1.11-20030918
set os tkGKDamage.tcl
#set os tkGKDamage

##################################################################################################
# Just a little test for Tcl/Tk programming, nothing more. Trying to get the way with frame
# placing. If this is useful for someone, just use it and report success! Maybe you have some
# suggestions, so I can please you with some more features.
# Cheers, Udo Sabath <udo@sabath.de>
##################################################################################################

##################################################################################################
#The Menu
frame .mbar -relief groove -bd 1
menubutton .mbar.prog -text "Program" -menu .mbar.prog.menue
menubutton .mbar.obj -text "Module" -menu .mbar.obj.menue
menubutton .mbar.help -text "Help" -menu .mbar.help.menue
menu .mbar.prog.menue
.mbar.prog.menue add command -label "Preferences" -command { preferences }
.mbar.prog.menue add command -label "Quit" -command { exit }
menu .mbar.obj.menue
.mbar.obj.menue add command -label "start new GK-Damage" -command { exec $os & }
.mbar.obj.menue add command -label "show Movement Table" -command { movementtable }
.mbar.obj.menue add command -label "show use of Command Points" -command { commandpoints }
.mbar.obj.menue add command -label "show Combat Summary Table" -command { combatsummtable }
.mbar.obj.menue add command -label "show Special Rules" -command { specrules }
.mbar.obj.menue add command -label "show Damage Charts" -command { damagechart }
menu .mbar.help.menue
.mbar.help.menue add command -label "Credits" -command {credits}
.mbar.help.menue add command -label "About" -command {about}

##################################################################################################
# defining all the frames we need. They are not in appering order!
# the first top frame
frame .quality
# inside we define the left and right frame to place items properly
frame .quality.left -relief groove -bd 1
frame .quality.right -relief groove -bd 1
frame .quality.left.sepv2 -width 2 -height 100 -borderwidth 1 -relief sunken
# some seperators to make a clear visual display of the program
#frame .sep -width 100 -height 2 -borderwidth 1 -relief sunken
#frame .sep2 -width 100 -height 3 -borderwidth 1 -relief sunken
#frame .sep1 -width 100 -height 2 -borderwidth 1 -relief sunken
# the main battle frame
frame .combat
frame .combat.left -relief groove -bd 1
frame .combat.right -relief groove -bd 1
#frame .combat.left.sepv1 -width 2 -height 100 -borderwidth 1 -relief sunken
# the lower actionitems. Here we can click and display the combat factors used in the game for
# dice rolling
frame .buttons
frame .buttons.left -relief groove -bd 1
frame .buttons.right -relief groove -bd 1

##################################################################################################
# all for .left troop quality frame
# We are setting the -width to 30 on all top rows to get an equal appearal of the frames
label .quality.left.aquality -text "Attacker Troop Quality" -width 30
radiobutton .quality.left.aqual1 -text "Rookie" -variable aqual -value 1
radiobutton .quality.left.aqual2 -text "Qualified" -variable aqual -value 2
radiobutton .quality.left.aqual3 -text "Veteran" -variable aqual -value 3
radiobutton .quality.left.aqual4 -text "Elite" -variable aqual -value 4
radiobutton .quality.left.aqual5 -text "Legendary" -variable aqual -value 5
# setting the default value
set aqual 2

# all for .right troop quality frame
# We are setting the -width to 30 on all top rows to get an equal appearal of the frames
label .quality.right.dquality -text "Defender Troop Quality" -width 30
radiobutton .quality.right.dqual1 -text "Rookie" -variable dqual -value 1
radiobutton .quality.right.dqual2 -text "Qualified" -variable dqual -value 2
radiobutton .quality.right.dqual3 -text "Veteran" -variable dqual -value 3
radiobutton .quality.right.dqual4 -text "Elite" -variable dqual -value 4
radiobutton .quality.right.dqual5 -text "Legendary" -variable dqual -value 5
# setting the default value
set dqual 2

##################################################################################################
# all attackers modifiers that appear in the game core-rules for dice-rolling
# We are setting the -width to 30 on all top rows to get an equal appearal of the frames
label .combat.left.attack -text "Attack Modificators" -height 1 -width 30
scale .combat.left.wood -from 0 -to 4 -label "Wood/Swamp Unit" -orient horizontal
scale .combat.left.jungle -from 0 -to 4 -label "Jungle/Water* Unit" -orient horizontal
scale .combat.left.firec -from -5 -to 5 -label "Firecontrol" -orient horizontal
# setting the default slider-value
.combat.left.firec set -1
scale .combat.left.accur -from -5 -to 5 -label "Weapon Accuracy" -orient horizontal
checkbutton .combat.left.ai -text "Non-(AI) Weapon\nVs Infantry" -onvalue -2 -variable ai
# just adding a spacer-row to clear vision
label .combat.left.stretchm -height 1
label .combat.left.movement -text "Attackers Movement"
radiobutton .combat.left.movestatic -text "Stationary" -variable movement -value 2
radiobutton .combat.left.movehalf -text "half Combat" -variable movement -value 1
radiobutton .combat.left.movecombat -text "Combat" -variable movement -value 0
radiobutton .combat.left.movefull -text "full Movement" -variable movement -value -3
# just adding a spacer-row to clear vision
label .combat.left.stretchm1 -height 1
label .combat.left.range -text "Range Modifications"
radiobutton .combat.left.rangepoint -text "Point Blank" -variable range -value 1
radiobutton .combat.left.rangeshort -state normal -text "Short" -variable range -value 0
radiobutton .combat.left.rangemedium -text "Medium" -variable range -value -1
radiobutton .combat.left.rangelong -text "Long" -variable range -value -2
radiobutton .combat.left.rangeext -text "Extreme" -variable range -value -3
# setting the default radiobutton-values
set movement 0
set range -1

##################################################################################################
# all for the defenders modifiers that appear in the game core-rules for dice-rolling
# We are setting the -width to 30 on all top rows to get an equal appearal of the frames
label .combat.right.defend -text "Defense Modificators" -width 20 -width 30
scale .combat.right.maneuver -from -5 -to 5 -label "Maneuver Rating" -orient horizontal
# setting the default slider-value
.combat.right.maneuver set -2
# just adding a spacer-row to clear vision
label .combat.right.stretchr -height 1
label .combat.right.defmove -text "Defensive Movement"
radiobutton .combat.right.dmove0 -text "0" -variable dmove -value -3
radiobutton .combat.right.dmove1 -text "1-2" -variable dmove -value -2
radiobutton .combat.right.dmove3 -text "3-4" -variable dmove -value -1
radiobutton .combat.right.dmove5 -text "5-6 or moving Infantry" -variable dmove -value 0
radiobutton .combat.right.dmove7 -text "7-9" -variable dmove -value 1
radiobutton .combat.right.dmove10 -text "10-19" -variable dmove -value 2
radiobutton .combat.right.dmove20 -text "20-99" -variable dmove -value 3
# just adding a spacer-row to clear vision
label .combat.right.stretchr1 -height 1
label .combat.right.arc -text "Defense Arc"
radiobutton .combat.right.arcf -text "Front or Infantry" -variable arc -value 0
radiobutton .combat.right.arcfl -text "Flank" -variable arc -value -1
radiobutton .combat.right.arcr -text "Rear" -variable arc -value -2
label .combat.right.stretchr2 -height 1
checkbutton .combat.right.cp -text "Defensive maneuver (CP)" -onvalue 2 -variable cp
checkbutton .combat.right.dm -text "Defensive maneuvering" -onvalue 3 -variable dm
# setting the default radiobutton-values
set arc 0
set dmove -2

##################################################################################################
# Skill display. These boxes will later display the troop-skill set earlier
# To get a cool frame around the values we use the -relief groove function
listbox .buttons.left.skilla -width 6 -height 1 -relief groove
listbox .buttons.right.skilld -width 6 -height 1 -relief groove

##################################################################################################
# Buttons and klicks ...
# Just the two buttons to calculate the modifier-values set earlier
# With the -command {} you call the proc's
button .buttons.left.berechnena -height 1 -text "Attack Mods" -command {attack}
button .buttons.right.berechnend -height 1 -text "Defend Mods" -command {defend}
# To get a cool frame around the values we use the -relief groove function
listbox .buttons.left.amodifiers -width 3 -height 1 -relief groove
listbox .buttons.right.dmodifiers -width 3 -height 1 -relief groove

##################################################################################################
# do something! Here we do the real calculating job and fill the listboxes
# We need to call some variables global, cause within the function we'll calculate with them
proc attack {} {global movement range ai aqual
    # Now we get the values out of all this sliders, checkboxes and radiobuttons
    set wood [.combat.left.wood get]
    set jungle [.combat.left.jungle get]
    set firec [.combat.left.firec get]
    set accur [.combat.left.accur get]
    # Yeah! Here we go! Who dares, wins!
    set attackval	[expr -($wood*1)-($jungle*2)+$firec+$accur+$movement+\
            $range+$ai	]
    # don't know if we calculated something earlier, so I'll clean the listboxes
    .buttons.left.amodifiers delete 0 3
    .buttons.left.skilla delete 0 6
    # putting life to the listboxes
    .buttons.left.amodifiers insert end $attackval
    .buttons.left.skilla insert end $aqual'Dice'
}

# We need to call some variables global, cause within the function we'll calculate with them
proc defend {} {global dmove arc dqual cp dm
    # Now we get the values out of all this sliders, checkboxes and radiobuttons
    set defend [.combat.right.maneuver get]
    # Hope, the force is with me (and my Gear will survive ....)
    set defval [expr $defend+$dmove+$arc+$cp+$dm]
    # don't know if we calculated something earlier, so I'll clean the listboxes
    .buttons.right.skilld delete 0 6
    .buttons.right.dmodifiers delete 0 3
    # putting life to the listboxes
    .buttons.right.dmodifiers insert end $defval
    .buttons.right.skilld insert end $dqual'Dice'
}

################################################################################
#The preferences

proc preferences {} {global os
    toplevel .pref
    wm title .pref "GK Preferences"
    radiobutton .pref.windows -text "Windows" -variable os -value tkGKDamage
    radiobutton .pref.linux -text "Linux" -variable os -value tkGKDamage.tcl
    button .pref.cl -text "done" -command {destroy .pref}
    pack .pref.windows .pref.linux -anchor w
    pack .pref.cl
}

################################################################################
#The movement table

proc movementtable {} {global os
    toplevel .move
    wm title .move "GK Movement Table"
    if {$os == "tkGKDamage"} {
        text .move.table -height 22 -width 100 -relief groove
        .move.table tag configure normal -font {"courier new" 10} -wrap none
        .move.table tag configure bold -font {"courier new" 12 bold} -wrap none
    } else  {
        text .move.table -height 14 -width 57 -relief groove
        .move.table tag configure normal -font {lucidatypewriter 9} -wrap none
        .move.table tag configure bold -font {lucidatypewriter 12 bold} -wrap none
    }
    .move.table insert end "TERRAIN TABLE with HULL DOWN COSTS and VALUES\n\n" bold
    .move.table insert end "Terrain Type Infantry Walker Ground Obscurement Hull-Down Covers Protection\n" normal
    .move.table insert end "                                                 MP Cost\n" normal
    .move.table insert end "Clear           1       1      1        0          +3*      n/a   10*\n" normal
    .move.table insert end "Rough, Rubble   1       1      2        0          +2     2 to 4  15\n" normal
    .move.table insert end "Sand/Dust       2       2/D    2/D      0          +3     3 to 4  10\n" normal
    .move.table insert end "Woods           1       1/D    2/D      1          +2     2 to 4  15\n" normal
    .move.table insert end "Jungle          2       2/D    3/D      2          +1     2 to 6  20\n" normal
    .move.table insert end "Swamp           1D      3/D    4/D      1          +1     2 to 6  10\n" normal
    .move.table insert end "Water (Shallow) 2       2**    3**      0          --       --    --\n" normal
    .move.table insert end "30 degree Slope add4    add2   add2     -          +1     2 to 6  15\n" normal
    .move.table insert end "Urban           1       1      1        2          +2     2 to 6  15\n\n" normal
    .move.table insert end "*Only Infantry can go hull-down in clear terrain\n" normal
    .move.table insert end "**Only amphibious vehicles and walkers can enter water\n" normal
    .move.table insert end "D: Terrain marked \"D\" requires a Dangerous Terrain Test\n" normal
    .move.table configure -state disabled
    button .move.dismiss -text "dismiss" -command {destroy .move}
    pack .move.table .move.dismiss -fill x
}

################################################################################
#The Combat Summary Table
proc combatsummtable {} {global os
    toplevel .combatsumm
    wm title .combatsumm "GK Combat Summary"
    if {$os == "tkGKDamage"} {
        text .combatsumm.table -height 10 -width 80 -relief groove
        .combatsumm.table tag configure normal -font {"courier new" 10} -wrap none
        .combatsumm.table tag configure bold -font {"courier new" 12 bold} -wrap none
    } else  {
        text .combatsumm.table -height 6 -width 46 -relief groove
        .combatsumm.table tag configure normal -font {lucidatypewriter 9} -wrap none
        .combatsumm.table tag configure bold -font {lucidatypewriter 12 bold} -wrap none
    }
    #text .combatsumm.table -width 60 -height 8 -relief groove
    .combatsumm.table insert end "COMBAT SUMMARY TABLE\n\n" bold
    .combatsumm.table insert end "Phase             Description\n" normal
    .combatsumm.table insert end "1. Declaration    Declare extra actions/evasive actions\n" normal
    .combatsumm.table insert end "2. Initiative     Action test w/ Tactics Skill of Commanders\n" normal
    .combatsumm.table insert end "3. Activation     Move combat groups, alternating players\n" normal
    .combatsumm.table insert end "4. Miscellaneous  Any action not spent is lost\n" normal
    .combatsumm.table configure -state disabled
    button .combatsumm.dismiss -text "dismiss" -command {destroy .combatsumm}
    pack .combatsumm.table .combatsumm.dismiss -fill x
}

################################################################################
#The use of Command Points

proc commandpoints {} {global os
    toplevel .compoints
    wm title .compoints "GK Commandpoints"
    if {$os == "tkGKDamage"} {
        text .compoints.table -width 62 -height 10 -relief groove
        .compoints.table tag configure normal -font {"courier new" 10} -wrap none
        .compoints.table tag configure bold -font {"courier new" 12 bold} -wrap none
    } else  {
        text .compoints.table -width 35 -height 6 -relief groove
        .compoints.table tag configure normal -font {lucidatypewriter 9} -wrap none
        .compoints.table tag configure bold -font {lucidatypewriter 12 bold} -wrap none
    }
    .compoints.table insert end "USING COMMAND POINTS\n\n" bold
    .compoints.table insert end "- Extra action (with no dice penalty)\n" normal
    .compoints.table insert end "- Activate an unactivated unit out of sequence\n" normal
    .compoints.table insert end "- Cancel a Command Point spent by opponent\n" normal
    .compoints.table insert end "- Defensive Maneuver (+2 to one defense roll)\n" normal
    .compoints.table insert end "- About Face (Change facing up to 180 degrees)\n" normal
    .compoints.table configure -state disabled
    button .compoints.dismiss -text "dismiss" -command {destroy .compoints}
    pack .compoints.table .compoints.dismiss -fill x
}

################################################################################
#Special Rules

proc specrules {} {global os
    toplevel .specrule
    wm title .specrule "GK Special Rules"
    if {$os == "tkGKDamage"} {
        text .specrule.text -width 89 -height 27 -relief groove
        .specrule.text tag configure normal -font {"courier new" 10} -wrap none
        .specrule.text tag configure bold -font {"courier new" 12 bold} -wrap none
    } else  {
        text .specrule.text -width 50 -height 17 -relief groove
        .specrule.text tag configure normal -font {lucidatypewriter 9} -wrap none
        .specrule.text tag configure bold -font {lucidatypewriter 12 bold} -wrap none
    }
    .specrule.text insert end "*Burst Fire\n" bold
    .specrule.text insert end "    Against armored targets, add a weapon's ROF to its Damage\n" normal
    .specrule.text insert end "    Multiplier.Against unarmored targets, add the ROF to its\n" normal
    .specrule.text insert end "    Margin of Success. Burst fire costs 10 rounds per point of ROF\n" normal
    .specrule.text insert end "    used, and pins infantry whether or not any damage is caused\n" normal
    .specrule.text insert end "    by the attack.\n\n" normal
    .specrule.text insert end "*Walking Fire\n" bold
    .specrule.text insert end "    Weapons capable of burst fire may attack multiple targets no\n" normal
    .specrule.text insert end "    more than 1 MU apart from one another.Anumber of targets\n" normal
    .specrule.text insert end "    equal to the weapon's ROF +1 may be attacked. Decrease the\n" normal
    .specrule.text insert end "    ROF for figuring damage by 1 for every target attacked, but\n" normal
    .specrule.text insert end "    do not decrease ammunition spent.\n\n" normal
    .specrule.text insert end "*Saturation Fire\n" bold
    .specrule.text insert end "    Choose a saturation point and roll a normal attack. Add half\n" normal
    .specrule.text insert end "    of the ROF (rounded down) to the roll. Any unit within (ROF\n" normal
    .specrule.text insert end "    x MU) of the saturation point must beat this number\n" normal
    .specrule.text insert end "    defensively or suffer an attack, taking damage equal to their\n" normal
    .specrule.text insert end "    Margin of Failure x the Damage Multiplier of the weapon.\n" normal
    .specrule.text insert end "    Saturation costs 30 rounds of ammo per ROF point used." normal
    .specrule.text configure -state disabled
    button .specrule.dismiss -text "dismiss" -command {destroy .specrule}
    pack .specrule.text .specrule.dismiss -fill x
}
################################################################################
#Damage Charts

proc damagechart {} {global os
    toplevel .damchar
    wm title .damchar "GK Damage Charts"
    if {$os == "tkGKDamage"} {
        text .damchar.tex -height 54 -width 66 -relief groove
        .damchar.tex tag configure normal -font {"courier new" 10}
        .damchar.tex tag configure bold -font {"courier new" 12 bold}
    } else  {
        text .damchar.tex -height 34 -width 37 -relief groove
        .damchar.tex tag configure normal -font {lucidatypewriter 9}
        .damchar.tex tag configure bold -font {lucidatypewriter 12 bold}
    }
    .damchar.tex insert end "SYSTEMS DAMAGE TABLE: LIGHT DAMAGE\n" bold
    .damchar.tex insert end "Roll  Damaged System  Result\n" normal
    .damchar.tex insert end "1     Fire Control    Roll on SubtableA\n" normal
    .damchar.tex insert end "2     Structure       Roll on Subtable B\n" normal
    .damchar.tex insert end "3     Crew            Crew Stunned\n" normal
    .damchar.tex insert end "4     Movement        -1 MP\n" normal
    .damchar.tex insert end "5     Aux Systems     -1 to 1d6 Aux Systems\n" normal
    .damchar.tex insert end "6     Roll Twice on this table\n\n" normal
    .damchar.tex insert end "SYSTEMS DAMAGE TABLE: HEAVY DAMAGE\n" bold
    .damchar.tex insert end "Roll  Damaged System  Result\n" normal
    .damchar.tex insert end "1     Fire Control    Roll on SubtableA, +1\n" normal
    .damchar.tex insert end "2     Structure       Roll on Subtable B, +1\n" normal
    .damchar.tex insert end "3     Crew            10% Casualties, Min. 1\n" normal
    .damchar.tex insert end "4     Movement        1/2 MP, -2 Maneuver\n" normal
    .damchar.tex insert end "5     Aux Systems     1d6 Aux Sustems lost\n" normal
    .damchar.tex insert end "6     Roll Twice on this table\n\n" normal
    .damchar.tex insert end "SUBTABLE A: FIRE CONTROL DAMAGE\n" bold
    .damchar.tex insert end "Roll  Effect\n" normal
    .damchar.tex insert end "1     -1 Accuracy to a single weapon\n" normal
    .damchar.tex insert end "2     -2 Accuracy to a single weapon\n" normal
    .damchar.tex insert end "3     -1 Accuracy to all weapons\n" normal
    .damchar.tex insert end "4     Single Weapon Destroyed\n" normal
    .damchar.tex insert end "5     Fire Control Destroyed (-5 to all attacks)\n" normal
    .damchar.tex insert end "6     Roll Twice on this table\n" normal
    .damchar.tex insert end "7     Ammunition/Fuel Hit (Roll 1d6)\n" normal
    .damchar.tex insert end "      1-3   Ammo Storage and Fuel Tank Ruptured\n" normal
    .damchar.tex insert end "      (Vehicle Cannot Move or fire weapons)\n" normal
    .damchar.tex insert end "      4-6  Chain Reaction! Ammo and fuel explode!\n" normal
    .damchar.tex insert end "      (Vehicle destroyed, all crew killed)\n\n" normal
    .damchar.tex insert end "SUBTABLE B: STRUCTURAL DAMAGE\n" bold
    .damchar.tex insert end "Roll  Effect\n" normal
    .damchar.tex insert end "1     -1 MP\n" normal
    .damchar.tex insert end "2     1/2 Remaining MPs (Round Down)\n" normal
    .damchar.tex insert end "3     -1 to Maneuver\n" normal
    .damchar.tex insert end "4     -2 to Maneuver\n" normal
    .damchar.tex insert end "5     Power transfer Failure; No movement\n" normal
    .damchar.tex insert end "6     Catastrophic Crew Compartment Failure\n" normal
    .damchar.tex insert end "      (75% Casualties, Minimum 1)\n" normal
    .damchar.tex insert end "7     Complete Structural Failure\n" normal
    .damchar.tex insert end "      (Vehicle Destroyed, Crew Escapes)" normal
    button .damchar.dismiss -text "dismis" -command {destroy .damchar}
    .damchar.tex configure -state disable
    pack .damchar.tex .damchar.dismiss -fill x
}

################################################################################
#The guys of this prog

proc credits {} {global os
    toplevel .credit
    wm title .credit "tkGK Credits"
    if {$os == "tkGKDamage"} {
        text .credit.tex -height 14 -width 66 -relief groove
        .credit.tex tag configure normal -font {"courier new" 10}
        .credit.tex tag configure bold -font {"courier new" 12 bold}
        .credit.tex tag configure center -justify center
    } else  {
        text .credit.tex -height 10 -width 39 -relief groove
        .credit.tex tag configure normal -font {lucidatypewriter 9}
        .credit.tex tag configure bold -font {lucidatypewriter 12 bold}
        .credit.tex tag configure center -justify center
    }
    .credit.tex insert end "\nReference Sheets\n" {normal center}
    .credit.tex insert end "prepared by\n\n" {normal center}
    .credit.tex insert end "Scott Lynch\n" {bold center}
    .credit.tex insert end "http://www.geocities.com/thesnarkhunt\n\n" {bold center}
    .credit.tex insert end "GearKrieg is (c) by DreamPod 9\n" {normal center}
    .credit.tex insert end "http://www.dp9.com\n" {normal center}
    .credit.tex configure -state disable
    button .credit.dismiss -text "thank's!" -command {destroy .credit}
    pack .credit.tex .credit.dismiss
}

proc about {} {global os version
    toplevel .about
    wm title .about "tkGK About"
    wm resizable . 0 0
    if {$os == "tkGKDamage"} {
        text .about.tex -height 16 -width 66 -relief groove
        .about.tex tag configure normal -font {"courier new" 10}
        .about.tex tag configure bold -font {"courier new" 12 bold}
        .about.tex tag configure center -justify center
    } else  {
        text .about.tex -height 11 -width 39 -relief groove
        .about.tex tag configure normal -font {lucidatypewriter 9}
        .about.tex tag configure bold -font {lucidatypewriter 12 bold}
        .about.tex tag configure center -justify center
    }
    .about.tex insert end "\ntkGearKrieg coded by\n\n" {normal center}
    .about.tex insert end "Udo Sabath\n\n" {bold center}
    .about.tex insert end "Distribute freely, but\n" {normal center}
    .about.tex insert end "announce the sources!\n\n" {normal center}
    .about.tex insert end "http://sourceforge.net/projects/tkgk\n\n" {bold center}
    .about.tex insert end "Copyright is LGPL\n" {normal center}
    .about.tex insert end "Thanks for trying $version out!" {normal center}
    .about.tex configure -state disable
    button .about.dismiss -text "cool" -command {destroy .about}
    pack .about.tex .about.dismiss
}


################################################################################
# just some packages ...
# A prober order is the key!
pack .mbar -fill x
pack .mbar.prog .mbar.obj -side left
pack .mbar.help -side right
# A new frame is born under the last
pack .quality
# Frame in frame technology ... and never use "-in"! That's a horror!
# We -anchor the beasts North, so they will all start at the top of the frame
pack .quality.left -side left -anchor n
#pack .quality.left.sepv2 -side right -fill y -padx 4
pack .quality.right -side right -anchor n
pack .quality.left.aquality -side top
# The \ adds the following line to the line before (undoes the CR). Just like "shell"!
# -anchor w is used to get the radiobuttons start from the left side
pack .quality.left.aqual1 .quality.left.aqual2 .quality.left.aqual3 .quality.left.aqual4 \
        .quality.left.aqual5 -side top -anchor w
pack .quality.right.dquality -side top
pack .quality.right.dqual1 .quality.right.dqual2 .quality.right.dqual3 .quality.right.dqual4 \
        .quality.right.dqual5 -side top -anchor w
# Here the seperator fills all the window from left to right. Thank's -fill x!
#pack .sep -fill x -pady 4
pack .combat
pack .combat.left -side left -anchor n
#pack .combat.left.sepv1 -side right -fill y -padx 4
pack .combat.right -side right -anchor n -fill y
pack .combat.left.attack
# We do a -fill x for the scales to get the -labels show it's content.
pack .combat.left.wood .combat.left.jungle .combat.left.firec .combat.left.accur -fill x
pack .combat.left.ai .combat.left.stretchm .combat.left.movement \
        .combat.left.movestatic .combat.left.movehalf .combat.left.movecombat .combat.left.movefull \
        .combat.left.stretchm1 .combat.left.range .combat.left.rangepoint .combat.left.rangeshort \
        .combat.left.rangemedium .combat.left.rangelong .combat.left.rangeext -anchor w

pack .combat.right.defend
pack .combat.right.maneuver -fill x
pack .combat.right.stretchr .combat.right.defmove \
        .combat.right.dmove0 .combat.right.dmove1 .combat.right.dmove3 .combat.right.dmove5 \
        .combat.right.dmove7 .combat.right.dmove10 .combat.right.dmove20 .combat.right.stretchr1 \
        .combat.right.arc .combat.right.arcf .combat.right.arcfl .combat.right.arcr .combat.right.stretchr2 \
        .combat.right.cp .combat.right.dm -anchor w
#pack .sep1 -fill x -pady 4
pack .buttons -fill x
pack .buttons.left -side left
pack .buttons.right -side right
pack .buttons.left.berechnena .buttons.left.skilla .buttons.left.amodifiers -side left
pack .buttons.right.dmodifiers .buttons.right.skilld .buttons.right.berechnend -side right
# That's all, isn't it! Not always easy to place the frames, but it works!