Decompiled botc source
#!botc 1.0.0
#include "botc_defs.bts"
var int $global0;
var int $globalArray1[];
event "Intermission" {
if (!IsSpectating()) {
changestate(14);
}
}
event "Spectating" {
changestate(15);
}
event "DuelStartingCountdown" {
if (!IsSpectating()) {
changestate(0);
}
}
event "DuelFight" {
if (!IsSpectating()) {
if ((LookForWeapons(0, true) != -1)) {
changestate(2);
} else {
changestate(1);
}
}
}
event "DuelWinSequence" {
if (!IsSpectating()) {
changestate(16);
}
}
event "LMSStartingCountdown" {
if (!IsSpectating()) {
changestate(0);
}
}
event "LMSFight" {
if (!IsSpectating()) {
if ((LookForWeapons(0, true) != -1)) {
changestate(2);
} else {
changestate(1);
}
}
}
event "LMSWinSequence" {
if (!IsSpectating()) {
if (!IsDead()) {
if (ChatSectionExistsInChatLump("WinStrings")) {
BeginChatting();
delay(Random(15, 45));
SayFromChatLump("WinStrings");
}
} else {
if (ChatSectionExistsInChatLump("LoseStrings")) {
BeginChatting();
delay(Random(15, 45));
SayFromChatLump("LoseStrings");
}
}
}
}
state "stateSpawn": // 0
event "KilledByEnemy" {
changestate(11);
}
event "KilledByPlayer" {
changestate(11);
}
event "KilledBySelf" {
changestate(11);
}
event "KilledByEnvironment" {
changestate(11);
}
onenter {
delay(Random(0, 17));
if (ChatSectionExistsInChatLump("IntroStrings")) {
BeginChatting();
delay(Random(15, 35));
SayFromChatLump("IntroStrings");
}
$global0 = (35 * 5);
if ((LookForWeapons(0, true) != -1)) {
changestate(2);
} else {
changestate(1);
}
}
mainloop {
}
onexit {
StopChatting();
}
state "stateStandardRoam": // 1
var int $local1;
var int $local2;
var int $local3;
var int $local4;
var int $local5;
var int $local6;
var int $local7;
var int $local8;
var int $local9;
var int $local10;
event "KilledByEnemy" {
changestate(11);
}
event "KilledByPlayer" {
changestate(11);
}
event "KilledBySelf" {
changestate(11);
}
event "KilledByEnvironment" {
changestate(11);
}
event "DamagedByPlayer" {
if (!StringsAreEqual(GetCurrentWeapon(), "Pistol")) {
SetEnemy(GetPlayerDamagedBy());
changestate(9);
}
}
onenter {
$local1 = 0;
$local2 = 0;
$local3 = 0;
$local4 = 0;
$local5 = 0;
$local6 = 0;
$local8 = 0;
memset(1, 1, 32768);
$local7 = (2 * 35);
}
mainloop {
switch ($local8) {
case 6:
$local8 = 0;
break;
case 5:
if ((LookForSuperArmor($local6, true) != -1)) {
if ($globalArray1[$local6] != 0) {
$local6 = LookForSuperArmor($local6, true);
if ((GetPathingCostToItem($local6) >= 0)) {
changestate(7);
} else {
$globalArray1[$local6] = 0;
}
}
$local6++;
} else {
$local6 = 0;
$local8++;
}
break;
case 4:
if ((LookForSuperHealth($local5, true) != -1)) {
if ($globalArray1[$local5] != 0) {
$local5 = LookForSuperHealth($local5, true);
if ((GetPathingCostToItem($local5) >= 0)) {
changestate(6);
} else {
$globalArray1[$local5] = 0;
}
}
$local5++;
} else {
$local5 = 0;
$local8++;
}
break;
case 3:
if ((GetArmor() < GetBaseArmor())) {
if ((LookForBaseArmor($local4, true) != -1)) {
if ($globalArray1[$local4] != 0) {
$local4 = LookForBaseArmor($local4, true);
if ((GetPathingCostToItem($local4) >= 0)) {
changestate(5);
} else {
$globalArray1[$local4] = 0;
}
}
$local4++;
} else {
$local4 = 0;
$local8++;
}
} else {
$local8++;
}
break;
case 2:
if ((GetHealth() < GetBaseHealth())) {
if ((LookForBaseHealth($local3, true) != -1)) {
if ($globalArray1[$local3] != 0) {
$local3 = LookForBaseHealth($local3, true);
if ((GetPathingCostToItem($local3) >= 0)) {
changestate(4);
} else {
$globalArray1[$local3] = 0;
}
}
$local3++;
} else {
$local3 = 0;
$local8++;
}
} else {
$local8++;
}
break;
case 1:
if ((LookForPowerups($local2, true) != -1)) {
if ($globalArray1[$local2] != 0) {
$local2 = LookForPowerups($local2, true);
if ((GetPathingCostToItem($local2) >= 0)) {
changestate(3);
} else {
$globalArray1[$local2] = 0;
}
}
$local2++;
} else {
$local2 = 0;
$local8++;
}
break;
case 0:
if ((LookForWeapons($local1, true) != -1)) {
if ($globalArray1[$local1] != 0) {
$local1 = LookForWeapons($local1, true);
if (((IsWeaponOwned($local1) == 0) && (GetPathingCostToItem($local1) >= 0))) {
changestate(2);
} else {
$globalArray1[$local1] = 0;
}
}
$local1++;
} else {
$local1 = 0;
$local8++;
}
break;
}
if (!StringsAreEqual(GetCurrentWeapon(), "Pistol")) {
$local9 = GetClosestPlayerEnemy();
if (($local9 != -1)) {
SetEnemy($local9);
changestate(9);
}
}
// dropped 'Roam(100)';
if (($local7 > 0)) {
$local7--;
} else {
memset(1, 1, 32768);
$local7 = (2 * 35);
}
if (($global0 > 0)) {
$global0--;
} else {
$local10 = GetChatFrequency();
if (($local10 > 0)) {
$local10 = ((100 - $local10) * 7);
if (($local10 < 35)) {
$local10 = 35;
}
if ((Random(0, $local10) == 0)) {
if (ChatSectionExistsInChatLump("RoamingStrings")) {
BeginChatting();
delay(Random(15, 45));
if ((Random(0, 100) == 0)) {
if (ChatSectionExistsInChatLump("RareRoamingStrings")) {
SayFromChatLump("RareRoamingStrings");
} else {
SayFromChatLump("RoamingStrings");
}
} else {
if ((GetSpread() < 0)) {
if ((Random(0, 3) == 0)) {
if (ChatSectionExistsInChatLump("LosingRoamingStrings")) {
SayFromChatLump("LosingRoamingStrings");
} else {
SayFromChatLump("RoamingStrings");
}
} else {
SayFromChatLump("RoamingStrings");
}
} else {
SayFromChatLump("RoamingStrings");
}
}
}
$global0 = (35 * 5);
}
}
}
}
onexit {
StopChatting();
}
state "stateSortThroughWeapons": // 2
var int $local0;
var int $local1;
var int $local2;
var int $local3;
var bool $local4;
var int $local5;
event "KilledByEnemy" {
changestate(11);
}
event "KilledByPlayer" {
changestate(11);
}
event "KilledBySelf" {
changestate(11);
}
event "KilledByEnvironment" {
changestate(11);
}
onenter {
$local0 = 0;
$local1 = -1;
if (!StringsAreEqual(GetCurrentWeapon(), "Pistol")) {
$local4 = true;
} else {
$local4 = true;
}
}
mainloop {
$local0 = LookForWeapons($local0, $local4);
if (($local0 == -1)) {
if (($local1 != -1)) {
SetGoal($local1);
changestate(8);
} else {
changestate(1);
}
}
if (IsWeaponOwned($local0)) {
$local0++;
} else {
$local2 = GetPathingCostToItem($local0);
if (($local2 < 0)) {
$local0++;
} else {
if (($local1 == -1)) {
$local1 = $local0;
$local3 = $local2;
$local0++;
} else {
$local5 = 0;
if (($local2 < $local3)) {
$local5++;
} else {
$local5--;
}
if (($local5 > 0)) {
$local1 = $local0;
$local3 = $local2;
}
$local0++;
}
}
}
}
state "stateSortThroughPowerups": // 3
var int $local0;
var int $local1;
var int $local2;
var int $local3;
var int $local4;
event "KilledByEnemy" {
changestate(11);
}
event "KilledByPlayer" {
changestate(11);
}
event "KilledBySelf" {
changestate(11);
}
event "KilledByEnvironment" {
changestate(11);
}
onenter {
$local0 = 0;
$local1 = -1;
}
mainloop {
$local0 = LookForPowerups($local0, true);
if (($local0 == -1)) {
if (($local1 != -1)) {
SetGoal($local1);
changestate(8);
} else {
changestate(1);
}
}
$local2 = GetPathingCostToItem($local0);
if (($local2 < 0)) {
$local0++;
} else {
if (($local1 == -1)) {
$local1 = $local0;
$local3 = $local2;
$local0++;
} else {
$local4 = 0;
if (($local2 < $local3)) {
$local4++;
} else {
$local4--;
}
if (($local4 > 0)) {
$local1 = $local0;
$local3 = $local2;
}
$local0++;
}
}
}
state "stateSortThroughBaseHealth": // 4
var int $local0;
var int $local1;
var int $local2;
var int $local3;
var int $local4;
event "KilledByEnemy" {
changestate(11);
}
event "KilledByPlayer" {
changestate(11);
}
event "KilledBySelf" {
changestate(11);
}
event "KilledByEnvironment" {
changestate(11);
}
onenter {
$local0 = 0;
$local1 = -1;
}
mainloop {
$local0 = LookForBaseHealth($local0, true);
if (($local0 == -1)) {
if (($local1 != -1)) {
SetGoal($local1);
changestate(8);
} else {
changestate(1);
}
}
$local2 = GetPathingCostToItem($local0);
if (($local2 < 0)) {
$local0++;
} else {
if (($local1 == -1)) {
$local1 = $local0;
$local3 = $local2;
$local0++;
} else {
$local4 = 0;
if (($local2 < $local3)) {
$local4++;
} else {
$local4--;
}
if (($local4 > 0)) {
$local1 = $local0;
$local3 = $local2;
}
$local0++;
}
}
}
state "stateSortThroughBaseArmor": // 5
var int $local0;
var int $local1;
var int $local2;
var int $local3;
var int $local4;
event "KilledByEnemy" {
changestate(11);
}
event "KilledByPlayer" {
changestate(11);
}
event "KilledBySelf" {
changestate(11);
}
event "KilledByEnvironment" {
changestate(11);
}
onenter {
$local0 = 0;
$local1 = -1;
}
mainloop {
$local0 = LookForBaseArmor($local0, true);
if (($local0 == -1)) {
if (($local1 != -1)) {
SetGoal($local1);
changestate(8);
} else {
changestate(1);
}
}
$local2 = GetPathingCostToItem($local0);
if (($local2 < 0)) {
$local0++;
} else {
if (($local1 == -1)) {
$local1 = $local0;
$local3 = $local2;
$local0++;
} else {
$local4 = 0;
if (($local2 < $local3)) {
$local4++;
} else {
$local4--;
}
if (($local4 > 0)) {
$local1 = $local0;
$local3 = $local2;
}
$local0++;
}
}
}
state "stateSortThroughSuperHealth": // 6
var int $local0;
var int $local1;
var int $local2;
var int $local3;
var int $local4;
event "KilledByEnemy" {
changestate(11);
}
event "KilledByPlayer" {
changestate(11);
}
event "KilledBySelf" {
changestate(11);
}
event "KilledByEnvironment" {
changestate(11);
}
onenter {
$local0 = 0;
$local1 = -1;
}
mainloop {
$local0 = LookForSuperHealth($local0, true);
if (($local0 == -1)) {
if (($local1 != -1)) {
SetGoal($local1);
changestate(8);
} else {
changestate(1);
}
}
$local2 = GetPathingCostToItem($local0);
if (($local2 < 0)) {
$local0++;
} else {
if (($local1 == -1)) {
$local1 = $local0;
$local3 = $local2;
$local0++;
} else {
$local4 = 0;
if (($local2 < $local3)) {
$local4++;
} else {
$local4--;
}
if (($local4 > 0)) {
$local1 = $local0;
$local3 = $local2;
}
$local0++;
}
}
}
state "stateSortThroughSuperArmor": // 7
var int $local0;
var int $local1;
var int $local2;
var int $local3;
var int $local4;
event "KilledByEnemy" {
changestate(11);
}
event "KilledByPlayer" {
changestate(11);
}
event "KilledBySelf" {
changestate(11);
}
event "KilledByEnvironment" {
changestate(11);
}
onenter {
$local0 = 0;
$local1 = -1;
}
mainloop {
$local0 = LookForSuperArmor($local0, true);
if (($local0 == -1)) {
if (($local1 != -1)) {
SetGoal($local1);
changestate(8);
} else {
changestate(1);
}
}
$local2 = GetPathingCostToItem($local0);
if (($local2 < 0)) {
$local0++;
} else {
if (($local1 == -1)) {
$local1 = $local0;
$local3 = $local2;
$local0++;
} else {
$local4 = 0;
if (($local2 < $local3)) {
$local4++;
} else {
$local4--;
}
if (($local4 > 0)) {
$local1 = $local0;
$local3 = $local2;
}
$local0++;
}
}
}
state "statePathToGoal": // 8
var int $local0;
var int $local1;
var int $local2;
event "ReachedGoal" {
changestate(1);
}
event "GoalRemoved" {
changestate(1);
}
event "KilledByEnemy" {
changestate(11);
}
event "KilledByPlayer" {
changestate(11);
}
event "KilledBySelf" {
changestate(11);
}
event "KilledByEnvironment" {
changestate(11);
}
event "DamagedByPlayer" {
if (!StringsAreEqual(GetCurrentWeapon(), "Pistol")) {
SetEnemy(GetPlayerDamagedBy());
changestate(9);
}
}
mainloop {
$local2 = PathToGoal(100);
switch ($local2) {
case -1:
changestate(1);
break;
}
if (!StringsAreEqual(GetCurrentWeapon(), "Pistol")) {
$local0 = LookForPlayerEnemies(0);
if (($local0 != -1)) {
SetEnemy($local0);
changestate(9);
}
}
if (($global0 > 0)) {
$global0--;
} else {
$local1 = GetChatFrequency();
if (($local1 > 0)) {
$local1 = ((100 - $local1) * 7);
if (($local1 < 35)) {
$local1 = 35;
}
if ((Random(0, $local1) == 0)) {
if (ChatSectionExistsInChatLump("RoamingStrings")) {
BeginChatting();
delay(Random(15, 45));
if ((Random(0, 100) == 0)) {
if (ChatSectionExistsInChatLump("RareRoamingStrings")) {
SayFromChatLump("RareRoamingStrings");
} else {
SayFromChatLump("RoamingStrings");
}
} else {
if ((GetSpread() < 0)) {
if ((Random(0, 3) == 0)) {
if (ChatSectionExistsInChatLump("LosingRoamingStrings")) {
SayFromChatLump("LosingRoamingStrings");
} else {
SayFromChatLump("RoamingStrings");
}
} else {
SayFromChatLump("RoamingStrings");
}
} else {
SayFromChatLump("RoamingStrings");
}
}
}
$global0 = (35 * 5);
}
}
}
}
onexit {
StopChatting();
}
state "stateEngageEnemy": // 9
var int $local0;
var bool $local1;
var int $local2;
var int $local3;
var int $local4;
var int $local5;
var int $local6;
var int $local7;
var int $local8;
event "EnemyKilled" {
changestate(13);
}
event "EnemyFiredShotgun" {
$local4 = (37 - 17);
}
event "EnemyFiredSSG" {
$local4 = (57 - 17);
}
event "KilledByEnemy" {
changestate(11);
}
event "KilledByPlayer" {
changestate(11);
}
event "KilledBySelf" {
changestate(11);
}
event "KilledByEnvironment" {
changestate(11);
}
onenter {
BeginFiringWeapon();
BeginAimingAtEnemy();
$local3 = 0;
$local1 = Random(0, 1) != 0;
$local2 = Random(1, 62);
if ($local1) {
MoveLeft(100);
} else {
MoveRight(100);
}
$local4 = 0;
$local5 = 0;
}
mainloop {
if (!IsEnemyVisible()) {
$local8 = GetClosestPlayerEnemy();
if (($local8 == -1)) {
changestate(10);
} else {
SetEnemy($local8);
changestate(9);
}
}
if (!IsEnemyAlive()) {
ClearEnemy();
changestate(1);
}
if ($local4 != 0) {
$local4--;
if (($local4 == 0)) {
$local5 = Random(12, 35);
$local6 = Random(0, 8);
StopMovement();
switch ($local6) {
case 7:
MoveForward(100);
MoveLeft(100);
break;
case 6:
MoveLeft(100);
break;
case 5:
MoveBackwards(100);
MoveLeft(100);
break;
case 4:
MoveBackwards(100);
break;
case 3:
MoveBackwards(100);
MoveRight(100);
break;
case 2:
MoveRight(100);
break;
case 1:
MoveForward(100);
MoveRight(100);
break;
case 0:
MoveForward(100);
break;
}
}
}
if (($local5 == 0)) {
$local0 = GetDistanceToEnemy();
if (StringsAreEqual(GetCurrentWeapon(), "Chaingun")) {
if (($local0 < 256)) {
MoveBackwards(100);
} else {
StopForwardMovement();
}
} else {
if (($local0 > 384)) {
MoveForward(100);
} else {
if (($local0 < 128)) {
MoveBackwards(100);
} else {
$local7 = Random(0, 1);
if (($local7 == 0)) {
MoveForward(100);
} else {
MoveBackwards(100);
}
}
}
}
$local2--;
if (($local2 == 0)) {
$local1 = (!$local1);
if ($local1) {
MoveLeft(100);
} else {
MoveRight(100);
}
$local2 = Random(1, 62);
}
} else {
$local5--;
}
if (StringsAreEqual(GetCurrentWeapon(), "Chaingun")) {
StopFiringWeapon();
if ($local3 != 0) {
$local3--;
}
if (($local3 == 0)) {
FireWeapon();
$local3 = 9;
}
} else {
BeginFiringWeapon();
}
}
onexit {
StopMovement();
StopFiringWeapon();
StopAimingAtEnemy();
}
state "stateChaseEnemy": // 10
var int $local0;
var int $local1;
event "KilledByEnemy" {
changestate(11);
}
event "KilledByPlayer" {
changestate(11);
}
event "KilledBySelf" {
changestate(11);
}
event "KilledByEnvironment" {
changestate(11);
}
event "DamagedByPlayer" {
if (!StringsAreEqual(GetCurrentWeapon(), "Pistol")) {
SetEnemy(GetPlayerDamagedBy());
changestate(9);
}
}
mainloop {
$local0 = GetClosestPlayerEnemy();
if (($local0 != -1)) {
SetEnemy($local0);
changestate(9);
}
$local1 = PathToLastKnownEnemyPosition(100);
switch ($local1) {
case 2:
ClearEnemy();
changestate(1);
break;
case -1:
ClearEnemy();
changestate(1);
break;
}
}
state "stateKilled": // 11
var int $local0;
event "Respawned" {
changestate(12);
}
onenter {
delay(Random(5, 15));
$local0 = GetChatFrequency();
if ((($local0 > 0) && ($global0 == 0))) {
$local0 = ((100 - $local0) / 5);
if (($local0 < 2)) {
$local0 = 2;
}
if ((Random(0, $local0) == 0)) {
if (ChatSectionExistsInChatLump("KilledStrings")) {
BeginChatting();
delay(Random(15, 45));
SayFromChatLump("KilledStrings");
}
$global0 = (35 * 5);
}
}
}
mainloop {
Respawn();
}
onexit {
StopChatting();
}
state "stateRespawn": // 12
event "KilledByEnemy" {
changestate(11);
}
event "KilledByPlayer" {
changestate(11);
}
event "KilledBySelf" {
changestate(11);
}
event "KilledByEnvironment" {
changestate(11);
}
onenter {
if ((LookForWeapons(0, false) != -1)) {
changestate(2);
} else {
changestate(1);
}
}
mainloop {
}
state "stateKilledEnemy": // 13
var int $local0;
var int $local1;
event "KilledByEnemy" {
changestate(11);
}
event "KilledByPlayer" {
changestate(11);
}
event "KilledBySelf" {
changestate(11);
}
event "KilledByEnvironment" {
changestate(11);
}
onenter {
$local0 = GetClosestPlayerEnemy();
if (($local0 != -1)) {
SetEnemy($local0);
changestate(9);
}
$local1 = GetChatFrequency();
if ((($local1 > 0) && ($global0 == 0))) {
$local1 = ((100 - $local1) / 6);
if (($local1 < 2)) {
$local1 = 2;
}
if ((Random(0, $local1) == 0)) {
if (ChatSectionExistsInChatLump("FragStrings")) {
BeginChatting();
delay(Random(15, 45));
SayFromChatLump("FragStrings");
}
$global0 = (35 * 5);
}
}
ClearEnemy();
changestate(1);
}
mainloop {
}
onexit {
StopChatting();
}
state "stateIntermission": // 14
event "NewMap" {
changestate(1);
}
event "KilledByEnemy" {
changestate(11);
}
event "KilledByPlayer" {
changestate(11);
}
event "KilledBySelf" {
changestate(11);
}
event "KilledByEnvironment" {
changestate(11);
}
onenter {
delay(Random(35, 70));
if ((GetSpread() >= 0)) {
if (ChatSectionExistsInChatLump("WinStrings")) {
SayFromChatLump("WinStrings");
}
} else {
if (ChatSectionExistsInChatLump("LoseStrings")) {
SayFromChatLump("LoseStrings");
}
}
}
mainloop {
}
state "stateSpectating": // 15
event "JoinedGame" {
changestate(0);
}
onenter {
TryToJoinGame();
}
mainloop {
}
state "stateDuelWinSequence": // 16
onenter {
if ((GetSpread() > 0)) {
if (ChatSectionExistsInChatLump("WinStrings")) {
BeginChatting();
delay(Random(15, 45));
SayFromChatLump("WinStrings");
}
} else {
if (ChatSectionExistsInChatLump("LoseStrings")) {
BeginChatting();
delay(Random(15, 45));
SayFromChatLump("LoseStrings");
}
}
}
mainloop {
}