Hey guys, having a few more minor issues with my drone project.
In my efforts to optimize my code, I have found that putting running things when the chip is duped or on first() completely breaks the whole thing.
For instance, this code works perfectly, printing the message whenever I spawn or update the code.
e2 Code:
##### INITIAL #####
if (first() | duped()) {
print("(+++) 39BOT SYSTEMS ACTIVATED")
print("(+++) DESIGNED AND PROGRAMMED BY SIR. 39")
print("(+++) PLEASE ENJOY YOUR EXPERIENCE")
}
runOnTick(1)
E = entity():isWeldedTo()
Owner = E:owner()
E:setMass(5)
However, this code will still print the message, but will NOT set runOnTick, E, Owner or perform setMass.
e2 Code:
##### INITIAL #####
if (first() | duped()) {
print("(+++) 39BOT SYSTEMS ACTIVATED")
print("(+++) DESIGNED AND PROGRAMMED BY SIR. 39")
print("(+++) PLEASE ENJOY YOUR EXPERIENCE")
runOnTick(1)
E = entity():isWeldedTo()
Owner = E:owner()
E:setMass(5)
}
Can only certain functions be performed in first() or duped()?
It seems to me quite inefficient to continually set runOnTick and define the other entities, and I would like to only do it once, when the chip is spawned or refreshed. However, some error here is making that impossible.
Bookmarks