Typo - should bedertien wrote:I am trying to get ships that have this AIState to drop their gear, but it also has an influence on the playership, which I would like to avoid.Code: Select all
if(this.ship.AIState = "GO_TO_STATION")
Code: Select all
if(this.ship.AIState == "GO_TO_STATION")
"==" means true if left is equivalent to right, and false otherwise.
"===" means true if left is exactly equal to right, and false otherwise.
In this case the difference between "==" and "===" isn't relevant. For an example of where it matters:
0 == "0"
is true0 === "0"
is falseSome languages and compilers will warn you if you put the "=" form inside an 'if' without also putting a "no, I really meant to do that" marker with it. Javascript doesn't, so you need to be extremely careful with them.
(ship.AIState is read/write, so the test will also be confusing a lot of the NPCs... and telling them to go to the station, which may not even be valid for their AI. With most ships in 1.80 using the new Javascript AIs, it won't be causing detectable problems, but if you'd done this in 1.77 it would have caused a big noticeable mess ... which is usually the way programmers spot they've left an "=" out in these things)
The best way to test in 1.80 if a ship is trying to dock is this:
Code: Select all
if (this.ship.dockingInstructions) {