Because I didn't read the JS documentation properly


Moderators: winston, another_commander
Words cannot express how much I hate the syntax of JS. I might have mentioned it previously.Capt. Murphy wrote:Because I didn't read the JS documentation properly![]()
I missed out some brackets on my Timer start/stop functions in the last release. Fortunately this didn't break functionality at all and in the context of this script wouldn't cause a problem. Strangely this error doesn't produce a JS syntax error in the log, and I only realised my error whilst writing the Broken HUD/Scanner OXP script.
Feel free to use the following if you want to do this. Should work from a world-script. Could be built in to your renaming ships OXP. Explicitly excludes Thargoids from having to have a transponder.Wildeblood wrote:if this.ship.legalStatus some syntax fugitive then this.ship.displayName some syntax "No transponder"
Code: Select all
this.shipTargetAcquired = function(target)
{
if (target.isPirate && target.bounty > 50)
{
target.displayName = "No Transponder!";
}
}
Brilliant idea!So here's the idea: you target a ship and instead of the ident computer displaying e.g. "Cobra 3 (clean)", "Cobra 3 (offender)" or "Cobra 3 (fugitive)" it displays "Cobra 3 (clean)", "Cobra 3 (offender)" or "No transponder (fugitive)". This way, you'd know a ship was a fugitive (i.e. pirate), but not what model of ship it was. No standing off at the edge of scanner range pinging pirates with the ident computer when they're only two or three pixels on screen and cherry-picking the easy targets, you'd have to move close enough to see them if you wanted to know what they were.
if this.ship.legalStatus some syntax fugitive then this.ship.displayName some syntax "No transponder"
That's why I was thinking of a script that changed it (the displayName) when it (the ship) was first first created. Leaving it until the the player actually targets the ship is too late.Thargoid wrote:The only problem I see with this approach is that it may tangle up things like the bounty scanner (and other ones which play with display name).
It will need careful compatability testing I think.
this.shipLaunchedFromStation = this.shipExitedWitchspace = function()
handler. displayName == name
Code: Select all
this.shipLaunchedFromStation = this.shipExitedWitchspace = function()
{
function findfugitives(entity)
{
return (entity.displayName == entity.name && entity.bounty > 50);
}
var targets = system.filteredEntities(this, findfugitives);
if (targets.length > 0)
{
let counter = 0;
for (counter = 0; counter < targets.length;counter++)
{
targets[counter].displayName = "No Transponder";
}
}
}
Well then, changing "Vortex - Keeper of Darkness: Bounty: 75cr" to "No transponder" is surely an improvement?Thargoid wrote:I was thinking more that we could end up with less displayName, and more displayEssay.
When those names get too long, they don't look very good.
Then anyone who has bounty scanner installed will never see any effect from your OXP.Capt. Murphy wrote:Maybe only include entities whosedisplayName == name
Are you trying to annoy me, or just succeeding?Wildeblood wrote:Well then, changing "Vortex - Keeper of Darkness: Bounty: 75cr" to "No transponder" is surely an improvement?
Wouldn't Bounty Scanner just append the Bounty to the "No Transponder" name? Looking quickly at the code it appears to grab displayName, temporarily change it whilst targeted to displayName + the bounty and then changes it back to the originial displayName?Thargoid wrote:Then anyone who has bounty scanner installed will never see any effect from your OXP.Capt. Murphy wrote:Maybe only include entities whosedisplayName == name
Well that's the point, isn't it: it's an idea. Someone has an idea, they say "Here's an idea, what do you think?" Grown-ups can discuss ideas, decide whether they're good ideas, whether they're worth following up or not. It seems to me that around the "Friendliest board this side of Riedquat" only certain people are allowed to have ideas.Commander McLane wrote:I have an in-Ooniverse question about this idea: Why would a fugitive lose its transponder in the first place? And how would he automagically regain it when becoming offender again? I don't see this happening, so the idea makes only a limited amount of sense to me.
Just my 0.2 cr.