Here's what I actually wrote for the bot's script (which is converted/compiled/translated to the .txt version). # indicates a comment.
This should hopefully be a lot more readable, and includes some comments. If you have any questions about what anything does, or why it works, feel free to ask.
#Guardian bot by Trafalgar
#The compiled version of this may or may not be somewhat readable.
# These three lines are directives to the compiler/converter. The first one is used, but the second and third are disabled by the extra #. The first one keeps the lines here from being put in comments in the output .txt. The second line would replace the defs with their numbers in the output .txt, which would make it even more unreadable. The third one would remove all endlines, which, as you might imagine, would make it just about impossible to read.
#omit-original-code
##inline-defs
##combine-lines
#Debug stuff. These are disabled if they have a # or #~ before them - I uncomment them and the code that sets them en masse when I need to check what the bot is seeing or doing. There are several blocks of debug variables like this.
#Birth at T tick (recorded in ageComp), where T is the value stored in reproducedLastCycle
#~ def eyeComp at 1000 #1 at T+2
#~ def tieComp at 999 #1 at T+2
#~ def virusComp at 998 #1 at T
#~ def shootComp at 997 #1 at T
#~ def moveComp at 996 #1 at T+2
#~ def aimComp at 995 #1 at T
#~ def inComp at 994 #0
#~ def ageComp at 993
#~ def lastCycle at 992
#~ def friendlyComp at 991 #1 at T
#Child is blind until T+3, when all refs become available.
#At T+2 the parent's eyes see the child. At that time, the only refs which are set are refbody, refnrg, refup, refdx, refeye, reftie, and possibly refdn and refsx.
#At T+3 all the refs on the parent become available as well.
#This may or may not also happen when two bots approach each other?
#~ def refmultiRec at 921
#~ def refshellRec at 922
#~ def refbodyRec at 923 #Readable at T+2
#~ def refxposRec at 924
#~ def refyposRec at 925
#~ def refvelRec at 926
#~ def refvelupRec at 927
#~ def refvelscalarRec at 928
#~ def refvelsxRec at 929
#~ def refveldxRec at 930
#~ def refveldnRec at 931
#~ def refnrgRec at 932 #Readable at T+2
#~ def refageRec at 933
#~ def refpoisonRec at 934
#~ def refvenomRec at 935
#~ def refkillsRec at 936
#~ def reffixedRec at 937
#~ def refupRec at 938 #Readable at T+2
#~ def refsxRec at 939
#~ def refdxRec at 940 #Readable at T+2
#~ def refdnRec at 941
#~ def refaimdxRec at 942
#~ def refaimsxRec at 943
#~ def refshootRec at 945
#~ def refeyeRec at 946 #Readable (2) at T+2
#~ def reftieRec at 947 #26 at T+2 - why?
#~ def eyefRec at 948 #99 at T+2
#Debug (These ones are enabled, and written to, so if you check 987-990 you can see whether the bot thinks what it's seeing or tied to is a friendly, a veggie, or neither.)
def targFriendlyComp at 990
def targVeggieComp at 989
def tieFriendlyComp at 988
def tieVeggieComp at 987
#Normal
def tieNumAfter at 909
#Debug
#~ def teyeComp at 970
#~ def tshootComp at 969
#~ def tmoveComp at 968
#~ def taimComp at 967
#~ def tvirusComp at 966
#~ def tfriendlyComp at 965
#Debug
#~ def tieAfter at 910
#~ def tieLocAfter at 908
#~ def tieValAfter at 907
#~ def tiePresAfter at 906
#~ def delTieAfter at 905
#~ def shootRec at 904
#~ def shootvalRec at 903
#~ def venvalRec at 902
#~ def aimshootRec at 901
#~ def sxRec at 911
#~ def dnRec at 912
#~ def velsxRec at 913
#~ def veldnRec at 914
#Would have to be changed if we have both these and the ref debug vars enabled
#~ def lastMyXPos at 941
#~ def curMyXPos at 942
#~ def lastMyVelDX at 943
#~ def curMyVelDX at 944
#~ def lastMyYPos at 945
#~ def curMyYPos at 946
#~ def lastMyVelDn at 947
#~ def curMyVelDn at 948
#~ def lastRefXPos at 951
#~ def curRefXPos at 952
#~ def lastRefVelDX at 953
#~ def curRefVelDX at 954
#~ def lastRefYPos at 955
#~ def curRefYPos at 956
#~ def lastRefVelDn at 957
#~ def curRefVelDn at 958
#Debug
#~ def tieBefore at 960
#~ def tieNumBefore at 959
#~ def tieLocBefore at 958
#~ def tieValBefore at 957
#~ def tiePresBefore at 956
#~ def delTieBefore at 955
def delgeneDecChecked at 961
def reproducedLastCycle at 962
def reproTimer at 964
def minBody at 920
#Epigenetic 971-990
def reproEnergy at 980
def closingRate at 982
def reproTimerMax at 971
def threatMode at 985
if ():
define targFriendly: (((refeye==myeye) and (refshoot==myshoot) and (reftie==myties) and (refup==myup) and (refdn==mydn) and (refsx==mysx) and (refdx==mydx) and (refaimsx==myaimsx) and (refaimdx==myaimdx) and ((in1==3694) and (in2==7505) and (in3==29703) and (in4==9586) and (in5==31105))) or (abs(reproducedLastCycle-robage)<=2) or (robage<1) or ((body<50) and (targVeggie)))
define tieFriendly: (((trefeye==myeye) and (trefshoot==myshoot) and (trefup==myup) and (trefdn==mydn) and (trefsx==mysx) and (trefdx==mydx) and (trefaimsx==myaimsx) and (trefaimdx==myaimdx)) or (robage<1) or (abs(reproducedLastCycle-robage)<=2))
define targVeggie: ((refeye==0) and (refshoot==0) and (refup==0) and (refdn==0) and (refsx==0) and (refdx==0) and (memval==0) and (abs(reproducedLastCycle-robage)>1) and (refvenom==0) and (refpoison==0) and (refshell==0) and (refkills==0) and (abs(reproducedLastCycle-robage)>2))
define tieVeggie: ((numties>0) and (trefshell==0) and (trefeye==0) and (trefshoot==0) and (trefup==0) and (trefdn==0) and (trefsx==0) and (trefdx==0) and (tmemval==0) and (abs(reproducedLastCycle-robage)>2))
define targVirused: (((in1==8081) or (in2==25755) or (in3==22200) or (in4==25782) or (in5==315)) or (((robage%5)==0) and (memval>0) and (memval<30)))
define nextrefxpos: refxpos+((refveldx*dist(refxpos,refypos))/39)
define nextrefypos: refypos-((refvelup*dist(refxpos,refypos))/39)
define betternextrefxpos: refxpos+((refveldx*dist(nextrefxpos,nextrefypos))/39)
define betternextrefypos: refypos-((refvelup*dist(nextrefxpos,nextrefypos))/39)
define fixedangle: angle(betternextrefxpos, betternextrefypos)
define inrange1: (dist(betternextrefxpos, betternextrefypos)<480)
define inrange2: (dist(betternextrefxpos, betternextrefypos)<650)
define inrange3: (dist(betternextrefxpos, betternextrefypos)<800)
define inrange4: (dist(betternextrefxpos, betternextrefypos)<3200)
define range: (dist(betternextrefxpos, betternextrefypos))
define ifLeft: ((xpos-refxpos)<0)
define ifRight: ((xpos-refxpos)>=0)
define ifAbove: ((ypos-refypos)<0)
define ifBelow: ((ypos-refypos)>=0)
define targX: ((refxpos-500)+(ifAbove*1000))
define targY: ((refypos-500)+(ifRight*1000))
define targRange: (dist(targX,targY))
#Debug
#~ refmultiRec = refmulti
#~ refshellRec = refshell
#~ refbodyRec = refbody
#~ refxposRec = refxpos
#~ refyposRec = refypos
#~ refvelRec = refvel
#~ refvelupRec = refvelup
#~ refvelscalarRec = refvelscalar
#~ refvelsxRec = refvelsx
#~ refveldxRec = refveldx
#~ refveldnRec = refveldn
#~ refnrgRec = refnrg
#~ refageRec = refage
#~ refpoisonRec = refpoison
#~ refvenomRec = refvenom
#~ refkillsRec = refkills
#~ reffixedRec = reffixed
#~ refupRec = refup
#~ refsxRec = refsx
#~ refdxRec = refdx
#~ refdnRec = refdn
#~ refaimdxRec = refaimdx
#~ refaimsxRec = refaimsx
#~ refshootRec = refshoot
#~ refeyeRec = refeye
#~ reftieRec = reftie
#~ eyefRec = eyef
#disable-storecheck
reproEnergy when (reproEnergy==0) = 700
closingRate when (closingRate==0) = rnd(10)
reproTimerMax when ((reproTimerMax>0) and (robage==1)) = floor(reproTimerMax-100,100)
reproTimerMax when (reproTimerMax==0) = 1500
minBody when (minBody==0) = reproTimerMax/10
closingRate when (robage==0) = floor(ceil(closingRate+rnd(2)-1,30),1)
#enable-storecheck
threatMode when (((eyef>0) and (refkills>0) and (not targFriendly)) or ((tiepres==tienum) and (trefkills>0) and (not tieFriendly)) or (shang!=0)) = threatMode or 1
threatMode when ((shflav== -6) and (shang!=0)) = threatMode or 2
threatMode when (((eyef>0) and (targVirused)) or (genes>1)) = threatMode or 4
threatMode when ((memval!=0) and ((robage%5)!=0) and (targFriendly)) = threatMode or memval
#If we spot a virus-infected bot or veggie, or if we ourselves are virused, note virus-environment in the epigenetic memory. This will cause ourselves and all future descendants to produce slime for protection.
memloc when ((genes==1) and ((robage%5)==4) and (nrg>300)) = &vtimer
tmemloc when ((genes==1) and ((robage%5)==4) and (nrg>300)) = &vtimer
memloc when ((genes==1) and ((robage%5)!=4) and (nrg>300)) = &threatMode
tmemloc when ((genes==1) and ((robage%5)!=4) and (nrg>300)) = &threatMode
out1 when (genes==1) = 3694
out2 when (genes==1) = 7505
out3 when (genes==1) = 29703
out4 when (genes==1) = 9586
out5 when (genes==1) = 31105
out1 when ((genes>1) and (thisgene==1)) = 8081
out2 when ((genes>1) and (thisgene==1)) = 25755
out3 when ((genes>1) and (thisgene==1)) = 22200
out4 when ((genes>1) and (thisgene==1)) = 25782
out5 when ((genes>1) and (thisgene==1)) = 315
out1 when ((genes>1) and (thisgene>1) and (out1!=3694) and (out1!=8081)) = 7799
out2 when ((genes>1) and (thisgene>1) and (out2!=7505) and (out2!=25755)) = 901
out3 when ((genes>1) and (thisgene>1) and (out3!=29703) and (out3!=22200)) = 6876
out4 when ((genes>1) and (thisgene>1) and (out4!=9586) and (out4!=25782)) = 16558
out5 when ((genes>1) and (thisgene>1) and (out5!=31105) and (out5!=315)) = 2960
#This does three things:
#1. Sets focus eye to a random eye if it isn't set yet.
#2. If we're virus-infected or in an enemy bot, continually change it randomly.
#3. If the active eye's parameters are wrong (say, it's been blinded by poison or venom), switch to another eye.
focuseye when ((eye1width!=1221) or ((focuseye== -4 and ((eye1width!=1221) or (eye1dir!= -140))) or (focuseye== -3 and ((eye2width!=1221) or (eye2dir!= -105))) or (focuseye== -2 and ((eye3width!=1221) or (eye3dir!= -70))) or (focuseye== -1 and ((eye4width!=1221) or (eye4dir!= -35))) or (focuseye==0 and ((eye5width!=1221) or (eye5dir!=0))) or (focuseye==1 and ((eye6width!=1221) or (eye6dir!=35))) or (focuseye==2 and ((eye7width!=1221) or (eye7dir!=70))) or (focuseye==3 and ((eye8width!=1221) or (eye8dir!=105))) or (focuseye==4 and ((eye9width!=1221) or (eye9dir!=140))))) = (rnd(8)-4)
#Fix eye width and dir if non-infected
eye1width when (genes==1) = 1221
eye2width when (genes==1) = 1221
eye3width when (genes==1) = 1221
eye4width when (genes==1) = 1221
eye5width when (genes==1) = 1221
eye6width when (genes==1) = 1221
eye7width when (genes==1) = 1221
eye8width when (genes==1) = 1221
eye9width when (genes==1) = 1221
eye1dir when (genes==1) = -140
eye2dir when (genes==1) = -105
eye3dir when (genes==1) = -70
eye4dir when (genes==1) = -35
eye5dir when (genes==1) = 0
eye6dir when (genes==1) = 35
eye7dir when (genes==1) = 70
eye8dir when (genes==1) = 105
eye9dir when (genes==1) = 140
#Sarobage eye width and dir if infected
eye1width when (genes>1) = 1222
eye2width when (genes>1) = 1222
eye3width when (genes>1) = 1222
eye4width when (genes>1) = 1222
eye5width when (genes>1) = 1222
eye6width when (genes>1) = 1222
eye7width when (genes>1) = 1222
eye8width when (genes>1) = 1222
eye9width when (genes>1) = 1222
eye1dir when (genes>1) = 630
eye2dir when (genes>1) = 630
eye3dir when (genes>1) = 630
eye4dir when (genes>1) = 630
eye5dir when (genes>1) = 630
eye6dir when (genes>1) = 630
eye7dir when (genes>1) = 630
eye8dir when (genes>1) = 630
eye9dir when (genes>1) = 630
#Debug
#~ eyeComp = (refeye==myeye)
#~ tieComp = (reftie==myties)
#~ virusComp = ((memval==0) or (memval>=30))
#~ shootComp = (refshoot==myshoot)
#~ moveComp = ((refup==myup) and (refdn==mydn) and (refsx==mysx) and (refdx==mydx))
#~ aimComp = ((refaimsx==myaimsx) and (refaimdx==myaimdx))
#~ inComp = ((in1==3694) and (in2==7505) and (in3==29703) and (in4==9586) and (in5==31105))
#~ friendlyComp = targFriendly
#~ lastCycle = (robage)
#~ ageComp = (abs(reproducedLastCycle-robage)<=2) #962 *.robage sub abs 2 sub 1 sub sgn - 0 floor dup 993 sub sgn abs 993 mult store
#reproducedLastCycle = 962, 993 = ageComp
#Debug
#~ teyeComp = (trefeye==myeye)
#~ tshootComp = (trefshoot==myshoot)
#~ tmoveComp = (trefup==myup) and (trefdn==mydn) and (trefsx==mysx) and (trefdx==mydx)
#~ taimComp = (trefaimsx==myaimsx) and (trefaimdx==myaimdx)
#~ tvirusComp = ((tmemval==0) or (tmemval>=30))
#~ tfriendlyComp = tieFriendly
#Debug
#~ targFriendlyComp = (targFriendly)
#~ targVeggieComp = (targVeggie)
#~ tieFriendlyComp = (tieFriendly)
#~ tieVeggieComp = (tieVeggie)
#Fix aim
#disable-storecheck
setaim when (aim!=315) = 315
#enable-storecheck
#Theoretically:
#We are north of the enemy, and moving south at the same speed. refveldn will be 0. veldn will be positive. To escape them, we need it to be negative. (xpos-refxpos would be negative)
#We are north of the enemy, and moving north at the same speed. refveldn will be 0. veldn will be negative. To escape them, we need it to be (more) negative.
#We are south of the enemy, and moving south at the same speed. refveldn will be 0. veldn will be positive. To escape them, we need it to be positive.
#We are south of the enemy, and moving north at the same speed. refveldn will be 0. veldn will be negative. To escape them, we need it to be (more) positive.
#Conclusion: Our vel when fleeing should be determined by our relative position, not our or their velocity.
# Run away! (If the enemy is too close or if that's a friendly
dn when (((eyef >= 50) or (targFriendly)) and (robage>=1) and (nrg>300)) = sgn(ypos-refypos)*100
sx when (((eyef >= 50) or (targFriendly)) and (robage>=1) and (nrg>300)) = sgn(refxpos-xpos)*100
# We're in firing range - match speed
dn when (((numties==0) and (eyef >= 30) and (eyef < 60) and (not targFriendly)) and (robage>=1) and ((threatMode>0) and (not targVeggie)) and ((robage%4)!=0) and (nrg>300)) = (refveldn-veldn) + ((targY-ypos)/10)
sx when (((numties==0) and (eyef >= 30) and (eyef < 60) and (not targFriendly)) and (robage>=1) and ((threatMode>0) and (not targVeggie)) and ((robage%4)!=0) and (nrg>300)) = (-(refveldx-veldx)) + ((xpos-targX)/10)
dn when (((eyef >= 30) and (eyef < 60) and (not targFriendly)) and (robage>=1) and ((threatMode==0) or (targVeggie) or (nrg<=300)) and ((robage%4)!=0) and ((nrg>300) or (targVeggie))) = refveldn
sx when (((eyef >= 30) and (eyef < 60) and (not targFriendly)) and (robage>=1) and ((threatMode==0) or (targVeggie) or (nrg<=300)) and ((robage%4)!=0) and ((nrg>300) or (targVeggie))) = -refveldx
# We're chasing them - get closer
dn when (((numties==0) and (eyef > 0) and (eyef < 30) and (not targFriendly)) and (robage>=1) and ((threatMode>0) and (not targVeggie)) and ((robage%4)!=0) and (nrg>300)) = (refveldn-veldn) + ((targY-ypos)/10)
sx when (((numties==0) and (eyef > 0) and (eyef < 30) and (not targFriendly)) and (robage>=1) and ((threatMode>0) and (not targVeggie)) and ((robage%4)!=0) and (nrg>300)) = (-(refveldx-veldx)) + ((xpos-targX)/10)
dn when (((eyef > 0) and (eyef < 30) and (not targFriendly)) and (robage>=1) and ((threatMode==0) or (targVeggie)) and ((robage%4)!=0) and ((nrg>300) or (targVeggie) or (nrg<=300))) = refveldn + ((refypos-ypos)/closingRate)
sx when (((eyef > 0) and (eyef < 30) and (not targFriendly)) and (robage>=1) and ((threatMode==0) or (targVeggie)) and ((robage%4)!=0) and ((nrg>300) or (targVeggie) or (nrg<=300))) = (-refveldx) + ((xpos-refxpos)/closingRate)
#~ dnRec = dn
#~ sxRec = sx
#~ velsxRec = velsx
#~ veldnRec = veldn
up = 0
dx = 0
(vshoot * (($eyef > 0) and (not $targFriendly) and ($vshoot==0) and ($vtimer==1))) ++
# Consume all resources from veggies, but destroy others as fast as possible
shoot when (((eyef > 0) and ((robage%4)==0) and (inrange3) and (robage>=1) and ((refshell<50) or (not inrange1)) and (not targFriendly) and (waste<=100)) and ((refbody<refnrg) or (targVeggie)) and ((threatMode and 2)==0) and (nrg>300)) = -6
shoot when ((eyef > 0) and ((robage%4)==0) and (inrange3) and (robage>=1) and ((refshell<50) or (not inrange1)) and (not targFriendly) and (waste<=100) and (((refbody>=refnrg) and (not targVeggie))) and ((threatMode and 2)==0) and (nrg>300)) = -1
shootval when ((eyef > 0) and ((robage%4)==0) and (inrange1) and (robage>=1) and ((refshell<50) or (not inrange1)) and (not targFriendly) and (waste<=100) and ((threatMode and 2)==0) and (nrg>300)) = -4
shootval when ((eyef > 0) and ((robage%4)==0) and (inrange2) and (not inrange1) and (robage>=1) and ((refshell<50) or (not inrange1)) and (not targFriendly) and ((threatMode and 2)==0) and (nrg>300)) = -8
shootval when ((eyef > 0) and ((robage%4)==0) and (inrange3) and (not inrange1) and (robage>=1) and ((refshell<50) or (not inrange1)) and (not targFriendly) and ((threatMode and 2)==0) and (nrg>300)) = -10
# High-shell targets:
shoot when ((eyef > 0) and (inrange2) and (robage>=1) and (not targVeggie) and ((refshell>=50) or (refbody>100) or ((threatMode and 2)!=0)) and (not targFriendly) and (waste<=100) and (nrg>300)) = &strvenom
shootval when ((eyef > 0) and (inrange2) and (robage>=1) and (not targVeggie) and ((refshell>=50) or (refbody>100) or ((threatMode and 2)!=0)) and (not targFriendly) and (waste<=100) and (nrg>300)) = 10000
# Adjust body, and reproduce
fdbody when ((body>(minBody*2)) and (nrg<25000) and ((threatMode and 2)==0)) = (body-(minBody*2))*10
fdbody when ((nrg<500)) = floor((body-10)*10, 0)
strbody when ((nrg>25000) or (((threatMode and 2)!=0) and (nrg>1500))) = 100
repro when ((body>minBody) and (nrg>300) and (nrg>reproEnergy) and (pwaste <= 10000) and (robage>=2) and ((reproTimer<=0) or (nrg>25000))) = 30
reproducedLastCycle when (repro>0) = robage
reproTimer when ((reproTimer>0) and (nrg>300)) --
reproTimer when (repro>0) = reproTimerMax
#Make a new tie if we have a valid target, and we were either (a) not tied to something, or (b) tied to a veggie or friendly and this is a hostile
#If the tie is new, use targ functions instead of tie ones for determining actions
#Debug
#~ tieBefore = tie
#~ tieNumBefore = tienum
#~ tieLocBefore = tieloc
#~ tieValBefore = tieval
#~ tiePresBefore = tiepres
#~ delTieBefore = deltie
tie when ((eyef > 27) and (not targFriendly) and ((tiepres==0) or ((tiepres>0) and (tieNumAfter==tiepres) and ((tieVeggie) or (tieFriendly)) and ((not targVeggie) or (tieFriendly)))) and (robage>1)) = rnd(32000)
tienum when (tie!=0) = tie
aimshoot when ((not targFriendly) and ((shoot!=0) or (vshoot!=0)) and (waste<100) and (nrg>300)) = -fixedangle + aim
aimshoot when ((targFriendly) and ((shoot!=0) or (vshoot!=0)) and (nrg>300)) = -fixedangle-aim #Fire away from them
#We can do stuff with the tie if (((tie==tienum) and (tie!=0)) or (tiepres>0))
#We need to use targ functions if (tienum!=tiepres)
#If we aren't going to be setting tieloc, and it isn't already 0, clear it.
tieloc when (((tie==0) and (tieNumAfter==0)) or (robage<=1) or (((tieNumAfter!=tiepres) or (tie!=0) or (tieFriendly)) and ((tie==0) or (numties!=0) or (targFriendly))) or (tieloc==alreadyset)) = 0
#Feed
tieval when (((tie!=0) or (tieNumAfter>0)) and (robage>1) and (((tieNumAfter==tiepres) and (tie==0) and (not tieFriendly) and ((tieVeggie) or (refnrg<250))) or ((tie!=0) and (numties==0) and (not targFriendly) and (((threatMode and 4)==0) or (trefbody>=100)) and (targVeggie)))) = -1000
tieloc when (((tie!=0) or (tieNumAfter>0)) and (robage>1) and (((tieNumAfter==tiepres) and (tie==0) and (not tieFriendly) and ((tieVeggie) or (refnrg<250))) or ((tie!=0) and (numties==0) and (not targFriendly) and (((threatMode and 4)==0) or (trefbody>=100)) and (targVeggie)))) = -1
#Instakill
tieval when (((tie!=0) or (tieNumAfter>0)) and (robage>1) and (((tieNumAfter==tiepres) and (tie==0) and (not tieFriendly) and (((not tieVeggie) or (((threatMode and 4)!=0) and (trefbody<100))) and (refnrg>=250))) or ((tie!=0) and (numties==0) and (not targFriendly) and (not targVeggie))) and (tieval!=alreadyset)) = 10000
tieloc when (((tie!=0) or (tieNumAfter>0)) and (robage>1) and (((tieNumAfter==tiePres) and (tie==0) and (not tieFriendly) and (((not tieVeggie) or (((threatMode and 4)!=0) and (trefbody<100))) and (refnrg>=250))) or ((tie!=0) and (numties==0) and (not targFriendly) and ((not targVeggie) or ((threatMode and 4)!=0)))) and (tieloc!=alreadyset)) = &strvenom
sharenrg when ((tie==0) and (tieNumAfter==tiepres) and (numties==1) and (not tieFriendly)) = 100
tienum when ((tie==0) and (tienum!=alreadyset)) = tiepres #Set tienum to tiepres
tieNumAfter = tienum
#Debug
#~ tieAfter = tie
#~ tieLocAfter = tieloc
#~ tieValAfter = tieval
#~ tiePresAfter = tiepres
#~ delTieAfter = deltie
#Attempt to suicide if permawaste is excessive. I have no idea what "excessive" would be, so I picked 10000 out of nowhere.
repro when (pwaste > 10000) = 99
strbody when (pwaste > 10000) = 100
#Anti-virus stuff
#Did we already try deleting genes + 1 without anything getting deleted? Try deleting genes then.
delgene when ((thisgene==1) and (genes>=2) and (delgeneDecChecked==genes)) = genes
#If we didn't try it already, try deleting genes + 1.
delgene when ((thisgene==1) and (genes>=2) and (delgeneDecChecked!=genes)) = genes + 1
delgeneDecChecked when ((thisgene==1) and (genes>=2) and (delgene==genes)) = 0
delgeneDecChecked when ((thisgene==1) and (genes>=2) and (delgene==(genes+1))) = genes
delgeneDecChecked when ((genes==1)) = 0
#For the moment, we don't try deleting viruses at gene 1, as it is too dangerous.
#If we wound up with two copies of our own gene, then the one at gene 1 will delete the one at gene 2 after a couple cycles.
#Since our genome is ridiculously long, theoretically this may keep any virus that infects us from spreading itself. If, however, it turns out to be possible for one mkvirus command to override another, then after they override ours, we will override theirs right back.
#Note that this will only be executed when mkvirus doesn't already equal thisgene.
mkvirus = thisgene
#Create slime if we are in a virused environment.
mkslime when ((genes==1) and (((threatMode and 4)!=0)) and (slime<500) and (nrg>=1000)) = (500-slime)
mkslime when ((genes==1) and (((threatMode and 4)!=0)) and (slime<250) and (nrg>=700) and (nrg<1000)) = (250-slime)
mkslime when ((genes==1) and (((threatMode and 4)!=0)) and (slime<100) and (nrg>=400) and (nrg<700)) = (100-slime)
strpoison when ((genes==1) and (poison<500) and ((nrg*2)>(500-poison)) and (nrg>1500)) = (500-poison)
strpoison when ((genes==1) and (poison<500) and ((nrg*2)<=(500-poison)) and (nrg>1500)) = nrg/2
mkshell when ((genes==1) and (shell<100) and ((nrg*2)>(100-shell)) and (nrg>1500)) = (100-shell)
mkshell when ((genes==1) and (shell<100) and ((nrg*2)<=(100-shell)) and (nrg>1500)) = nrg/2
#ploc when ((genes==1) and ((robage%2)==0)) = &deltie
#ploc when ((genes==1) and ((robage%2)==1)) = &eye5
ploc when ((genes==1) and (nrg>300)) = &eye5
#venval when (((robage%2)==0) and (eyef > 20) and (robage>=1) and (refshell>=50) and (venom>0) and (not targFriendly) and (venval!=alreadyset) and (waste<=100)) = -10000
#venval when (((robage%2)==1) and (eyef > 20) and (robage>=1) and (refshell>=50) and (venom>0) and (not targFriendly) and (venval!=alreadyset) and (waste<=100)) = 0
#venval when ((eyef > 20) and (robage>=1) and (refshell>=50) and (venom>0) and (not targFriendly) and (waste<=100)) = -10000
#Dispose of waste
shoot when ((waste>100) and (genes==1) and (nrg>300)) = -4
shootval when ((waste>100) and (genes==1) and (nrg>300)) = waste
#Set maximum values
#Doesn't stop Etch's instakill shots :(
mkslime when ((mkslime>500) or (mkslime>(500-slime)) or (mkslime<0)) = 0
mkshell when ((mkshell>100) or (mkshell>(100-shell)) or (mkshell<0)) = 0
strvenom when ((strvenom>500) or (strvenom>(500-venom)) or (strvenom<0)) = 0
strpoison when ((strpoison>500) or (strpoison>(500-poison) or (strpoison<0))) = 0
fixpos = 0
repro when (genes>1) = 0
#~ shootRec = shoot
#~ shootvalRec = shootval
#~ venvalRec = venval
#~ aimshootRec = aimshoot
shang when (nrg>300) = 0