Attribute VB_Name = "MonkeyBot"
Option Explicit

'Monkey God Bot

Public Function GetSettingKey(Key As String, Minimum As Integer, Maximum As Integer) As Setting_Key
    GetSettingKey.Changed = 0
    GetSettingKey.Key_Name = Key
    GetSettingKey.Minimum = Minimum
    GetSettingKey.Maximum = Maximum
End Function

Public Sub SetupSettings(BotID As Integer)
Setting(BotID, 1).Catagory_Name = "Bomb": Setting(BotID, 1).TotalKeys = 9
    Setting(BotID, 1).Catagory_Settings(0) = GetSettingKey("BombDamageLevel", 0, 32767)
    Setting(BotID, 1).Catagory_Settings(1) = GetSettingKey("BombAliveTime", 0, 32767)
    Setting(BotID, 1).Catagory_Settings(2) = GetSettingKey("BombExplodeDelay", 0, 32767)
    Setting(BotID, 1).Catagory_Settings(3) = GetSettingKey("BombExplodePixels", 0, 32767)
    Setting(BotID, 1).Catagory_Settings(4) = GetSettingKey("ProximityDistance", 0, 16384)
    Setting(BotID, 1).Catagory_Settings(5) = GetSettingKey("JitterTime", 0, 32767)
    Setting(BotID, 1).Catagory_Settings(6) = GetSettingKey("BombSafety", 0, 32767)
    Setting(BotID, 1).Catagory_Settings(7) = GetSettingKey("EBombShutdownTime", 0, 32767)
    Setting(BotID, 1).Catagory_Settings(8) = GetSettingKey("EBombDamagePercent", 0, 32767)
    Setting(BotID, 1).Catagory_Settings(9) = GetSettingKey("BBombDamagePercent", 0, 32767)
Setting(BotID, 2).Catagory_Name = "Brick": Setting(BotID, 2).TotalKeys = 1
    Setting(BotID, 2).Catagory_Settings(0) = GetSettingKey("BrickTime", 0, 32767)
    Setting(BotID, 2).Catagory_Settings(1) = GetSettingKey("BrickSpan", 0, 16384)
Setting(BotID, 3).Catagory_Name = "Bullet": Setting(BotID, 3).TotalKeys = 2
    Setting(BotID, 3).Catagory_Settings(0) = GetSettingKey("BulletDamageLevel", 0, 32767)
    Setting(BotID, 3).Catagory_Settings(1) = GetSettingKey("BulletDamageUpgrade", 0, 32767)
    Setting(BotID, 3).Catagory_Settings(2) = GetSettingKey("BulletAliveTime", 0, 32767)
Setting(BotID, 4).Catagory_Name = "Burst": Setting(BotID, 4).TotalKeys = 0
    Setting(BotID, 4).Catagory_Settings(0) = GetSettingKey("BurstDamageLevel", 0, 32767)
Setting(BotID, 5).Catagory_Name = "Cost": Setting(BotID, 5).TotalKeys = 24
    Setting(BotID, 5).Catagory_Settings(0) = GetSettingKey("PurchaseAnytime", 0, 1)
    Setting(BotID, 5).Catagory_Settings(1) = GetSettingKey("Recharge", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(2) = GetSettingKey("Energy", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(3) = GetSettingKey("Rotation", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(4) = GetSettingKey("Stealth", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(5) = GetSettingKey("Cloak", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(6) = GetSettingKey("XRadar", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(7) = GetSettingKey("Gun", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(8) = GetSettingKey("Bomb", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(9) = GetSettingKey("Bounce", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(10) = GetSettingKey("Thrust", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(11) = GetSettingKey("Speed", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(12) = GetSettingKey("MultiFire", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(13) = GetSettingKey("Prox", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(14) = GetSettingKey("Super", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(15) = GetSettingKey("Shield", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(16) = GetSettingKey("Shrap", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(17) = GetSettingKey("AntiWarp", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(18) = GetSettingKey("Repel", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(19) = GetSettingKey("Burst", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(20) = GetSettingKey("Decoy", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(21) = GetSettingKey("Thor", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(22) = GetSettingKey("Brick", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(23) = GetSettingKey("Rocket", 0, 32767)
    Setting(BotID, 5).Catagory_Settings(24) = GetSettingKey("Portal", 0, 32767)
Setting(BotID, 6).Catagory_Name = "Door": Setting(BotID, 6).TotalKeys = 1
    Setting(BotID, 6).Catagory_Settings(0) = GetSettingKey("DoorDelay", 0, 32767)
    Setting(BotID, 6).Catagory_Settings(0) = GetSettingKey("DoorMode", -2, 255)
Setting(BotID, 7).Catagory_Name = "Flags": Setting(BotID, 7).TotalKeys = 17
    Setting(BotID, 7).Catagory_Settings(0) = GetSettingKey("FlaggerOnRadar", 0, 1)
    Setting(BotID, 7).Catagory_Settings(1) = GetSettingKey("FlaggerKillMultiplier", 0, 9)
    Setting(BotID, 7).Catagory_Settings(2) = GetSettingKey("FlaggerGunUpgrade", 0, 1)
    Setting(BotID, 7).Catagory_Settings(3) = GetSettingKey("FlaggerBombUpgrade", 0, 1)
    Setting(BotID, 7).Catagory_Settings(4) = GetSettingKey("FlaggerFireCostPercent", 0, 32767)
    Setting(BotID, 7).Catagory_Settings(5) = GetSettingKey("FlaggerDamagePercent", 0, 32767)
    Setting(BotID, 7).Catagory_Settings(6) = GetSettingKey("FlaggerSpeedAdjustment", -32767, 32767)
    Setting(BotID, 7).Catagory_Settings(7) = GetSettingKey("FlaggerThrustAdjustment", -32767, 32767)
    Setting(BotID, 7).Catagory_Settings(8) = GetSettingKey("FlaggerBombFireDelay", 0, 32767)
    Setting(BotID, 7).Catagory_Settings(9) = GetSettingKey("CarryFlags", 0, 32767)
    Setting(BotID, 7).Catagory_Settings(10) = GetSettingKey("FlagDropResetReward", 0, 32767)
    Setting(BotID, 7).Catagory_Settings(11) = GetSettingKey("FlagMode", 0, 2)
    Setting(BotID, 7).Catagory_Settings(12) = GetSettingKey("MaxFlags", 0, 32)
    Setting(BotID, 7).Catagory_Settings(13) = GetSettingKey("RandomFlags", 0, 1)
    Setting(BotID, 7).Catagory_Settings(14) = GetSettingKey("FlagReward", 0, 32767)
    Setting(BotID, 7).Catagory_Settings(15) = GetSettingKey("FlagTerritoryRadius", 0, 16384)
    Setting(BotID, 7).Catagory_Settings(16) = GetSettingKey("FlagTerritoryRadiusCentroid", 0, 1024)
    Setting(BotID, 7).Catagory_Settings(17) = GetSettingKey("FriendlyTransfer", 0, 1)
Setting(BotID, 8).Catagory_Name = "Kill": Setting(BotID, 8).TotalKeys = 11
    Setting(BotID, 8).Catagory_Settings(0) = GetSettingKey("MaxBonus", 0, 32767)
    Setting(BotID, 8).Catagory_Settings(1) = GetSettingKey("MaxPenalty", 0, 32767)
    Setting(BotID, 8).Catagory_Settings(2) = GetSettingKey("RewardBase", 0, 32767)
    Setting(BotID, 8).Catagory_Settings(3) = GetSettingKey("BountyIncreaseForKill", 0, 32767)
    Setting(BotID, 8).Catagory_Settings(4) = GetSettingKey("EnterDelay", 0, 32767)
    Setting(BotID, 8).Catagory_Settings(5) = GetSettingKey("KillPointsPerFlag", 0, 32767)
    Setting(BotID, 8).Catagory_Settings(6) = GetSettingKey("KillPointsMinimumBounty", 0, 32767)
    Setting(BotID, 8).Catagory_Settings(7) = GetSettingKey("DebtKills", 0, 32767)
    Setting(BotID, 8).Catagory_Settings(8) = GetSettingKey("NoRewardKillDelay", 0, 32767)
    Setting(BotID, 8).Catagory_Settings(9) = GetSettingKey("BountyRewardPercent", 0, 32767)
    Setting(BotID, 8).Catagory_Settings(10) = GetSettingKey("FixedKillReward", -1, 32767)
    Setting(BotID, 8).Catagory_Settings(11) = GetSettingKey("JackpotBountyPercent", 0, 32767)
Setting(BotID, 9).Catagory_Name = "Mine": Setting(BotID, 9).TotalKeys = 1
    Setting(BotID, 9).Catagory_Settings(0) = GetSettingKey("MineAliveTime", 0, 32767)
    Setting(BotID, 9).Catagory_Settings(1) = GetSettingKey("TeamMaxMines", 0, 32767)
Setting(BotID, 10).Catagory_Name = "Misc": Setting(BotID, 10).TotalKeys = 12
    Setting(BotID, 10).Catagory_Settings(0) = GetSettingKey("FrequencyShipTypes", 0, 1)
    Setting(BotID, 10).Catagory_Settings(1) = GetSettingKey("WarpPointDelay", 0, 32767)
    Setting(BotID, 10).Catagory_Settings(2) = GetSettingKey("DecoyAliveTime", 0, 32767)
    Setting(BotID, 10).Catagory_Settings(3) = GetSettingKey("BounceFactor", 0, 32)
    Setting(BotID, 10).Catagory_Settings(4) = GetSettingKey("WarpRadiusLimit", 0, 1024)
    Setting(BotID, 10).Catagory_Settings(5) = GetSettingKey("ActivateAppShutdownTime", 0, 32767)
    Setting(BotID, 10).Catagory_Settings(6) = GetSettingKey("NearDeathLevel", 0, 32767)
    Setting(BotID, 10).Catagory_Settings(7) = GetSettingKey("VictoryMusic", 0, 1)
    Setting(BotID, 10).Catagory_Settings(8) = GetSettingKey("BannerPoints", 0, 32767)
    Setting(BotID, 10).Catagory_Settings(9) = GetSettingKey("TimedGame", 0, 32767)
    Setting(BotID, 10).Catagory_Settings(10) = GetSettingKey("ResetScoreOnFrequencyChange", 0, 1)
    Setting(BotID, 10).Catagory_Settings(11) = GetSettingKey("FrequencyShift", 1, 10000)
    Setting(BotID, 10).Catagory_Settings(12) = GetSettingKey("ExtraPositionData", 0, 1)
Setting(BotID, 11).Catagory_Name = "Periodic": Setting(BotID, 11).TotalKeys = 2
    Setting(BotID, 11).Catagory_Settings(0) = GetSettingKey("RewardDelay", 0, 32767)
    Setting(BotID, 11).Catagory_Settings(1) = GetSettingKey("RewardMinimumPlayers", 0, 255)
    Setting(BotID, 11).Catagory_Settings(2) = GetSettingKey("RewardPoints", -500, 1000)
Setting(BotID, 12).Catagory_Name = "Prize": Setting(BotID, 12).TotalKeys = 9
    Setting(BotID, 12).Catagory_Settings(0) = GetSettingKey("MultiPrizeCount", 0, 32767)
    Setting(BotID, 12).Catagory_Settings(1) = GetSettingKey("PrizeFactor", 0, 10000)
    Setting(BotID, 12).Catagory_Settings(2) = GetSettingKey("PrizeDelay", 0, 32767)
    Setting(BotID, 12).Catagory_Settings(3) = GetSettingKey("PrizeHideCount", 0, 32767)
    Setting(BotID, 12).Catagory_Settings(4) = GetSettingKey("MinimumVirtual", 10, 32767)
    Setting(BotID, 12).Catagory_Settings(5) = GetSettingKey("PrizeMaxExist", 0, 32767)
    Setting(BotID, 12).Catagory_Settings(6) = GetSettingKey("PrizeMinExist", 0, 32767)
    Setting(BotID, 12).Catagory_Settings(7) = GetSettingKey("PrizeNegativeFactor", 1, 32767)
    Setting(BotID, 12).Catagory_Settings(8) = GetSettingKey("DeathPrizeTime", 0, 32767)
    Setting(BotID, 12).Catagory_Settings(9) = GetSettingKey("EngineShutdownTime", 0, 32767)
Setting(BotID, 13).Catagory_Name = "PrizeWeight": Setting(BotID, 13).TotalKeys = 27
    Setting(BotID, 13).Catagory_Settings(0) = GetSettingKey("Recharge", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(1) = GetSettingKey("QuickCharge", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(2) = GetSettingKey("Energy", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(3) = GetSettingKey("Rotation", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(4) = GetSettingKey("Stealth", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(5) = GetSettingKey("Cloak", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(6) = GetSettingKey("AntiWarp", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(7) = GetSettingKey("XRadar", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(8) = GetSettingKey("Warp", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(9) = GetSettingKey("Gun", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(10) = GetSettingKey("Bomb", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(11) = GetSettingKey("BouncingBullets", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(12) = GetSettingKey("Thruster", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(13) = GetSettingKey("TopSpeed", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(14) = GetSettingKey("MultiFire", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(15) = GetSettingKey("Proximity", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(16) = GetSettingKey("Glue", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(17) = GetSettingKey("AllWeapons", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(18) = GetSettingKey("Shields", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(19) = GetSettingKey("Shrapnel", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(20) = GetSettingKey("Repel", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(21) = GetSettingKey("Burst", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(22) = GetSettingKey("Decoy", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(23) = GetSettingKey("Thor", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(24) = GetSettingKey("Portal", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(25) = GetSettingKey("Brick", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(26) = GetSettingKey("Rocket", 0, 32767)
    Setting(BotID, 13).Catagory_Settings(27) = GetSettingKey("MultiPrize", 0, 32767)
Setting(BotID, 14).Catagory_Name = "Radar": Setting(BotID, 14).TotalKeys = 1
    Setting(BotID, 14).Catagory_Settings(0) = GetSettingKey("RadarNeutralSize", 0, 1024)
    Setting(BotID, 14).Catagory_Settings(1) = GetSettingKey("MapZoomFactor", 8, 1000)
Setting(BotID, 15).Catagory_Name = "Repel": Setting(BotID, 15).TotalKeys = 2
    Setting(BotID, 15).Catagory_Settings(0) = GetSettingKey("RepelSpeed", -32767, 32767)
    Setting(BotID, 15).Catagory_Settings(1) = GetSettingKey("RepelTime", 0, 32767)
    Setting(BotID, 15).Catagory_Settings(2) = GetSettingKey("RepelDistance", 0, 32767)
Setting(BotID, 16).Catagory_Name = "Rocket": Setting(BotID, 16).TotalKeys = 1
    Setting(BotID, 16).Catagory_Settings(0) = GetSettingKey("RocketThrust", 0, 32767)
    Setting(BotID, 16).Catagory_Settings(1) = GetSettingKey("RocketSpeed", 0, 32767)
Setting(BotID, 17).Catagory_Name = "Shrapnel": Setting(BotID, 17).TotalKeys = 3
    Setting(BotID, 17).Catagory_Settings(0) = GetSettingKey("ShrapnelSpeed", 0, 32767)
    Setting(BotID, 17).Catagory_Settings(1) = GetSettingKey("InactiveShrapDamage", 0, 32767)
    Setting(BotID, 17).Catagory_Settings(2) = GetSettingKey("ShrapnelDamagePercent", 0, 32767)
    Setting(BotID, 17).Catagory_Settings(3) = GetSettingKey("Random", 0, 1)
Setting(BotID, 18).Catagory_Name = "Soccer": Setting(BotID, 18).TotalKeys = 10
    Setting(BotID, 18).Catagory_Settings(0) = GetSettingKey("BallBounce", 0, 1)
    Setting(BotID, 18).Catagory_Settings(1) = GetSettingKey("AllowBombs", 0, 1)
    Setting(BotID, 18).Catagory_Settings(2) = GetSettingKey("AllowGuns", 0, 1)
    Setting(BotID, 18).Catagory_Settings(3) = GetSettingKey("PassDelay", 0, 10000)
    Setting(BotID, 18).Catagory_Settings(4) = GetSettingKey("Mode", 0, 6)
    Setting(BotID, 18).Catagory_Settings(5) = GetSettingKey("BallCount", 0, 4)
    Setting(BotID, 18).Catagory_Settings(6) = GetSettingKey("SendTime", 0, 32767)
    Setting(BotID, 18).Catagory_Settings(7) = GetSettingKey("Reward", -32767, 32767)
    Setting(BotID, 18).Catagory_Settings(8) = GetSettingKey("CapturePoints", 0, 32767)
    Setting(BotID, 18).Catagory_Settings(9) = GetSettingKey("UseFlagger", 0, 1)
    Setting(BotID, 18).Catagory_Settings(10) = GetSettingKey("BallLocation", 0, 1)
Setting(BotID, 19).Catagory_Name = "Team": Setting(BotID, 19).TotalKeys = 5
    Setting(BotID, 19).Catagory_Settings(0) = GetSettingKey("MaxFrequency", 1, 32767)
    Setting(BotID, 19).Catagory_Settings(1) = GetSettingKey("MaxPerTeam", 0, 255)
    Setting(BotID, 19).Catagory_Settings(2) = GetSettingKey("MaxPerPrivateTeam", 0, 255)
    Setting(BotID, 19).Catagory_Settings(3) = GetSettingKey("DesiredTeams", 0, 255)
    Setting(BotID, 19).Catagory_Settings(4) = GetSettingKey("ForceEvenTeams", 0, 10)
    Setting(BotID, 19).Catagory_Settings(5) = GetSettingKey("SpectatorFrequency", 0, 32767)
Setting(BotID, 20).Catagory_Name = "Toggle": Setting(BotID, 20).TotalKeys = 0
    Setting(BotID, 20).Catagory_Settings(0) = GetSettingKey("AntiWarpPixels", 0, 32767)
Setting(BotID, 21).Catagory_Name = "Wormhole": Setting(BotID, 21).TotalKeys = 1
    Setting(BotID, 21).Catagory_Settings(0) = GetSettingKey("GravityBombs", 0, 1)
    Setting(BotID, 21).Catagory_Settings(1) = GetSettingKey("SwitchTime", 0, 32767)
Setting(BotID, 22).Catagory_Name = "Warbird": Setting(BotID, 22).TotalKeys = 80
    Setting(BotID, 22).Catagory_Settings(0) = GetSettingKey("InitialRotation", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(1) = GetSettingKey("InitialThrust", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(2) = GetSettingKey("InitialSpeed", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(3) = GetSettingKey("InitialRecharge", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(4) = GetSettingKey("InitialEnergy", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(5) = GetSettingKey("MaximumRotation", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(6) = GetSettingKey("MaximumThrust", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(7) = GetSettingKey("MaximumSpeed", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(8) = GetSettingKey("MaximumRecharge", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(9) = GetSettingKey("MaximumEnergy", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(10) = GetSettingKey("UpgradeRotation", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(11) = GetSettingKey("UpgradeThrust", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(12) = GetSettingKey("UpgradeSpeed", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(13) = GetSettingKey("UpgradeRecharge", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(14) = GetSettingKey("UpgradeEnergy", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(15) = GetSettingKey("CloakStatus", 0, 2)
    Setting(BotID, 22).Catagory_Settings(16) = GetSettingKey("StealthStatus", 0, 2)
    Setting(BotID, 22).Catagory_Settings(17) = GetSettingKey("XRadarStatus", 0, 2)
    Setting(BotID, 22).Catagory_Settings(18) = GetSettingKey("AntiWarpStatus", 0, 2)
    Setting(BotID, 22).Catagory_Settings(19) = GetSettingKey("CloakEnergy", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(20) = GetSettingKey("StealthEnergy", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(21) = GetSettingKey("XRadarEnergy", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(22) = GetSettingKey("AntiWarpEnergy", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(23) = GetSettingKey("InitialRepel", 0, 255)
    Setting(BotID, 22).Catagory_Settings(24) = GetSettingKey("InitialBurst", 0, 255)
    Setting(BotID, 22).Catagory_Settings(25) = GetSettingKey("InitialBrick", 0, 255)
    Setting(BotID, 22).Catagory_Settings(26) = GetSettingKey("InitialRocket", 0, 255)
    Setting(BotID, 22).Catagory_Settings(27) = GetSettingKey("InitialThor", 0, 255)
    Setting(BotID, 22).Catagory_Settings(28) = GetSettingKey("InitialDecoy", 0, 255)
    Setting(BotID, 22).Catagory_Settings(29) = GetSettingKey("InitialPortal", 0, 255)
    Setting(BotID, 22).Catagory_Settings(30) = GetSettingKey("InitialGuns", 0, 255)
    Setting(BotID, 22).Catagory_Settings(31) = GetSettingKey("InitialBombs", 0, 255)
    Setting(BotID, 22).Catagory_Settings(32) = GetSettingKey("RepelMax", 0, 255)
    Setting(BotID, 22).Catagory_Settings(33) = GetSettingKey("BurstMax", 0, 255)
    Setting(BotID, 22).Catagory_Settings(34) = GetSettingKey("DecoyMax", 0, 255)
    Setting(BotID, 22).Catagory_Settings(35) = GetSettingKey("RocketMax", 0, 255)
    Setting(BotID, 22).Catagory_Settings(36) = GetSettingKey("ThorMax", 0, 255)
    Setting(BotID, 22).Catagory_Settings(37) = GetSettingKey("BrickMax", 0, 255)
    Setting(BotID, 22).Catagory_Settings(38) = GetSettingKey("PortalMax", 0, 255)
    Setting(BotID, 22).Catagory_Settings(39) = GetSettingKey("MaxGuns", 0, 255)
    Setting(BotID, 22).Catagory_Settings(40) = GetSettingKey("MaxBombs", 0, 255)
    Setting(BotID, 22).Catagory_Settings(41) = GetSettingKey("BulletFireEnergy", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(42) = GetSettingKey("BulletSpeed", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(43) = GetSettingKey("BulletFireDelay", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(44) = GetSettingKey("MultiFireEnergy", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(45) = GetSettingKey("MultiFireDelay", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(46) = GetSettingKey("MultiFireAngle", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(47) = GetSettingKey("DoubleBarrel", 0, 1)
    Setting(BotID, 22).Catagory_Settings(48) = GetSettingKey("BombFireEnergy", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(49) = GetSettingKey("BombFireEnergyUpgrade", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(50) = GetSettingKey("BombThrust", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(51) = GetSettingKey("BombBounceCount", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(52) = GetSettingKey("BombSpeed", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(53) = GetSettingKey("BombFireDelay", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(54) = GetSettingKey("EmpBomb", 0, 1)
    Setting(BotID, 22).Catagory_Settings(55) = GetSettingKey("MaxMines", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(56) = GetSettingKey("SeeMines", 0, 1)
    Setting(BotID, 22).Catagory_Settings(57) = GetSettingKey("LandmineFireEnergy", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(58) = GetSettingKey("LandmineFireEnergyUpgrade", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(59) = GetSettingKey("LandmineFireDelay", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(50) = GetSettingKey("ShrapnelMax", 0, 31)
    Setting(BotID, 22).Catagory_Settings(61) = GetSettingKey("ShrapnelRate", 0, 31)
    Setting(BotID, 22).Catagory_Settings(62) = GetSettingKey("BurstSpeed", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(63) = GetSettingKey("BurstShrapnel", 0, 31)
    Setting(BotID, 22).Catagory_Settings(64) = GetSettingKey("TurretThrustPenalty", -32767, 32767)
    Setting(BotID, 22).Catagory_Settings(65) = GetSettingKey("TurretSpeedPenalty", -32767, 32767)
    Setting(BotID, 22).Catagory_Settings(66) = GetSettingKey("TurretLimit", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(67) = GetSettingKey("RocketTime", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(68) = GetSettingKey("InitialBounty", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(69) = GetSettingKey("AttachBounty", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(70) = GetSettingKey("AfterburnerEnergy", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(71) = GetSettingKey("DamageFactor", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(72) = GetSettingKey("PrizeShareLimit", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(73) = GetSettingKey("SuperTime", -999, 32767)
    Setting(BotID, 22).Catagory_Settings(74) = GetSettingKey("ShieldsTime", -999, 32767)
    Setting(BotID, 22).Catagory_Settings(75) = GetSettingKey("Gravity", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(76) = GetSettingKey("GravityTopSpeed", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(77) = GetSettingKey("SoccerBallFriction", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(78) = GetSettingKey("SoccerBallProximity", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(79) = GetSettingKey("SoccerBallSpeed", 0, 32767)
    Setting(BotID, 22).Catagory_Settings(80) = GetSettingKey("SoccerThrowTime", 0, 32767)
Setting(BotID, 23) = Setting(BotID, 22): Setting(BotID, 23).TotalKeys = 80
    Setting(BotID, 23).Catagory_Name = "Javelin"
Setting(BotID, 24) = Setting(BotID, 22): Setting(BotID, 24).TotalKeys = 80
    Setting(BotID, 24).Catagory_Name = "Spider"
Setting(BotID, 25) = Setting(BotID, 22): Setting(BotID, 25).TotalKeys = 80
    Setting(BotID, 25).Catagory_Name = "Leviathan"
Setting(BotID, 26) = Setting(BotID, 22): Setting(BotID, 26).TotalKeys = 80
    Setting(BotID, 26).Catagory_Name = "Weasel"
Setting(BotID, 27) = Setting(BotID, 22): Setting(BotID, 27).TotalKeys = 80
    Setting(BotID, 27).Catagory_Name = "Lancaster"
Setting(BotID, 28) = Setting(BotID, 22): Setting(BotID, 28).TotalKeys = 80
    Setting(BotID, 28).Catagory_Name = "Shark"
Setting(BotID, 29).Catagory_Name = "King": Setting(BotID, 29).TotalKeys = 5
    Setting(BotID, 29).Catagory_Settings(0) = GetSettingKey("DeathCount", 0, 32767)
    Setting(BotID, 29).Catagory_Settings(1) = GetSettingKey("ExpireTime", 0, 32767)
    Setting(BotID, 29).Catagory_Settings(2) = GetSettingKey("RewardFactor", 0, 32767)
    Setting(BotID, 29).Catagory_Settings(3) = GetSettingKey("NonCrownAdjustTime", 0, 32767)
    Setting(BotID, 29).Catagory_Settings(4) = GetSettingKey("NonCrownMinimumBounty", 0, 32767)
    Setting(BotID, 29).Catagory_Settings(5) = GetSettingKey("CrownRecoverKills", 0, 32767)

    TotalSettings(BotID) = 29
End Sub

Public Sub DownloadSettings(BotID As Integer)
    PublicMessage BotID, "*getfile server.cfg", 0
    BotList(BotID).DownloadingSettings = 1
End Sub

Public Sub GotSettings(BotID As Integer, Filename As String)
    Dim X As Integer, Y As Integer, I As Integer

    BotList(BotID).DownloadingSettings = 0

    On Error Resume Next

    For X = 1 To TotalSettings(BotID)
        For Y = 0 To Setting(BotID, X).TotalKeys
            I = Val(GetProfileStringSpecific(Filename, Setting(BotID, X).Catagory_Name, Setting(BotID, X).Catagory_Settings(Y).Key_Name))
            Setting(BotID, X).Catagory_Settings(Y).Current = I
            Setting(BotID, X).Catagory_Settings(Y).Original = I
        Next
    Next
End Sub

Public Function GetProfileStringSpecific(Filename As String, Section As String, Key As String) As String
    Dim S255 As String * 255, L As Long

    L = GetPrivateProfileString(Section, Key, "", ByVal S255, 255, App.Path + "\" + Filename)
    GetProfileStringSpecific = Left(S255, L)
End Function

'Generate a server.set file with minimum disk space by using only changed entries
Public Sub ResetSettings(BotID As Integer)
On Error GoTo FlyPaper

    Dim O As String, X As Integer, Y As Integer

    For X = 1 To TotalSettings(BotID)
        For Y = 0 To Setting(BotID, X).TotalKeys
            With Setting(BotID, X).Catagory_Settings(Y)
                If .Changed = 1 Then
                    O = O + Setting(BotID, X).Catagory_Name + ":" + .Key_Name + ":" + CStr(.Original) + Chr(0)
                End If
            End With
        Next
    Next

    BotList(BotID).Bot_Enabled = 0

    For X = 1 To Len(O) Step 480
        If X >= Len(O) - 480 Then
            If X = 1 Then
                UDPSend CurrentBot, Chr(0) + Chr(9) + Chr(&H1D) + Left(O, 479), True
                X = 0
            Else
                UDPSend CurrentBot, Chr(0) + Chr(9) + Mid(O, X, 480), True
            End If
        Else
            If X = 1 Then
                UDPSend CurrentBot, Chr(0) + Chr(8) + Chr(&H1D) + Left(O, 479), True
                X = 0
            Else
                UDPSend CurrentBot, Chr(0) + Chr(8) + Mid(O, X, 480), True
            End If
        End If
    Next

    PublicMessage BotID, "*shipreset", 0
Exit Sub
FlyPaper:
    AddDebug BotID, "Error detected in ResetSettings(): " + Err.Description, RED
    Resume Next
End Sub

Public Sub FiddleWithSettings(BotID As Integer)
On Error GoTo FlyPaper

    Dim X As Integer, Y As Integer

    X = Int(Rnd * TotalSettings(BotID)) + 1
    Y = Int(Rnd * (Setting(BotID, X).TotalKeys + 1))
    With Setting(BotID, X).Catagory_Settings(Y)
        .Changed = 1
        .Current = .Current + (Int(Rnd * 11) - 5)
        If .Current < .Minimum Then
            .Current = .Minimum
        ElseIf .Current > .Maximum Then
            .Current = .Maximum
        End If
        PublicMessage BotID, "?set " + Setting(BotID, X).Catagory_Name + ":" + .Key_Name + ":" + CStr(.Current), 0
    End With

Exit Sub
FlyPaper:
    AddDebug BotID, "Error detected in FiddleWithSettings(): " + Err.Description, RED
    Resume Next
End Sub
