Page 2 of 9

Re: WIP - ToughGuys 2

Posted: Thu Jan 20, 2011 3:04 pm
by another_commander
Smivs wrote:
another_commander wrote:
Smivs wrote:
Any thoughts on my witchpoint pirates, anyone?
What exactly do you do with the script posted earlier? How exactly do you apply it in the game?
It's in a folder called 'Scripts' in the .oxp folder.
Do you have a world-script in Config making a reference to this script? If not, then that is the reason you cannot see anything happening.

Re: WIP - ToughGuys 2

Posted: Thu Jan 20, 2011 3:25 pm
by Smivs
another_commander wrote:
Do you have a world-script in Config making a reference to this script? If not, then that is the reason you cannot see anything happening.
Ah :idea: Thanks, I think I know how to do that...I'll have a go.

Edit:-
Who-hooo, all the pirates I could ever want. (I must be MAD!)

Image

Very many thanks :D

Re: WIP - ToughGuys 2

Posted: Fri Jan 21, 2011 10:08 am
by Smivs
Next problem....my team of crack test pilots like the pirate blockade, but don't think it should be every single planet, and I agree with this.
I would only like the blockade at Industrial worlds (economy >4), and stable governments (say govt type <3).
Also I currently have 2 scripts, one for pirates and one for police. I want them to appear together (police attempting to break the blockade). How do I merge these into one script, with the govt/economy conditions?

This is what I've got so far:-

Code: Select all

// Configuration -- customize here 
this.role = "pirate"; 
this.count = 5; 

// Standard attributes 
this.name           = "Spawn-" + this.role; 
this.author         = "Jens Ayton"; 
this.copyright      = "This script is hereby placed in the public domain."; 
this.version        = "1.0.1"; 
this.description    = "Script to make several ships of a given role appear at the witchpoint after every jump." 


this.shipWillExitWitchspace = function() 
{    
    system.addShips(this.role, this.count, player.ship.position, 10000);
}
and

Code: Select all

// Configuration -- customize here 
this.role = "police"; 
this.count = 3; 

// Standard attributes 
this.name           = "Spawn-" + this.role; 
this.author         = "Jens Ayton"; 
this.copyright      = "This script is hereby placed in the public domain."; 
this.version        = "1.0.1"; 
this.description    = "Script to make several ships of a given role appear at the witchpoint after every jump." 


this.shipWillExitWitchspace = function() 
{    
    system.addShips(this.role, this.count, player.ship.position, 20000);
}
I can't see that this should be hard to do, but I'm lost with JS as you know. Thanks for any help. :D

Re: WIP - ToughGuys 2

Posted: Fri Jan 21, 2011 10:47 am
by curtsibling
TG2 looks like fun! I'm glad I bought a caddy - I think the damage control node might be needed!

:D

Re: WIP - ToughGuys 2

Posted: Fri Jan 21, 2011 10:52 am
by Cody
curtsibling wrote:
TG2 looks like fun!
Yeah, fun is one word for it... on a test cruise last night, 13 kills cost me over 30k in repair bills, when I finally limped into the station.

Re: WIP - ToughGuys 2

Posted: Fri Jan 21, 2011 11:08 am
by another_commander
Smivs: Try with this (note: not tested):

Code: Select all

// Configuration -- customize here 
this.role1 = "pirate"; 
this.count1 = 5;
this.role2 = "police";
this.count2 = 3;

// Standard attributes 
this.name           = "Spawn-" + this.role; 
this.author         = "Jens Ayton"; 
this.copyright      = "This script is hereby placed in the public domain."; 
this.version        = "1.0.1"; 
this.description    = "Script to make several ships of a given role appear at the witchpoint after every jump." 


this.shipWillExitWitchspace = function() 
{
    if (system.economy > 4 && system.government < 3)
    {  
        system.addShips(this.role1, this.count1, player.ship.position, 10000);
        system.addShips(this.role2, this.count2, player.ship.position, 10000);
    }
}

Re: WIP - ToughGuys 2

Posted: Fri Jan 21, 2011 12:06 pm
by JensAyton
BTW, if you’re using that script for something other than testing a custom ship role, you should change “this.name” to something unique.

Re: WIP - ToughGuys 2

Posted: Fri Jan 21, 2011 12:12 pm
by Smivs
Thanks AC, but it's not working. I'm getting this log error
[loading.complete]: ========== Loading complete. ==========
[script.javaScript.warning.undefinedProp]: ----- JavaScript warning (blockade_script.js.anon-script): reference to undefined property this.role
[script.javaScript.warning.undefinedProp]: /home/smivses/.Oolite/AddOns/ToughGuys Armageddon.oxp/Scripts/blockade_script.js, line 8.
:?:

Edit:- It's OK, I think I've fixed it. There was a missing semi-colon after

Code: Select all

 if (system.economy > 4 && system.government < 3)
I'll give it a good test later, but early indicators are it's working well. Thanks again.

@ Ahruman, any name? Blockade?

Re: WIP - ToughGuys 2

Posted: Fri Jan 21, 2011 1:12 pm
by another_commander
Smivs wrote:
Edit:- It's OK, I think I've fixed it. There was a missing semi-colon after

Code: Select all

 if (system.economy > 4 && system.government < 3)
No, it is wrong having a semicolon at the end of that line. Unless JavaScript is different to C in that regard, a semicolon's presence there will generate buggy behaviour. I suggest you restart with Shift down.

Re: WIP - ToughGuys 2

Posted: Fri Jan 21, 2011 1:30 pm
by Smivs
This is weird!
Without the semicolon it doesn't work and I get the log error shown above.
With the semicolon it seems to work but I get the same log error.
Tested both times with cache cleared.

Re: WIP - ToughGuys 2

Posted: Fri Jan 21, 2011 1:34 pm
by another_commander
Please post blockade_script.js.

Re: WIP - ToughGuys 2

Posted: Fri Jan 21, 2011 1:50 pm
by CheeseRedux
Smivs wrote:
Next problem....my team of crack test pilots like the pirate blockade, but don't think it should be every single planet, and I agree with this.
I would only like the blockade at Industrial worlds (economy >4), and stable governments (say govt type <3).
Just as a bit of lateral thinking here: If you want to take your control even further, you could go down the route of the infamous Zaonce/Eagle2 planetinfo.plist. More work, certainly, but it'd allow you to make certain areas be infested with your blockades while others are clear.
(Of course, combining the two could be even more powerful: You'd get your guys at all worlds that fit the bill, and in addition they'd be added to the 'special selected' worlds.)

Re: WIP - ToughGuys 2

Posted: Fri Jan 21, 2011 1:59 pm
by Smivs
Just done some more testing...without the semicolon the script seems to be loading, but it's not working in the sense that no pirates/police are appearing. I've tried this at
Poor Industrial Corporate (where I would expect the blockade)
Poor Agricultural Feudal (where I would not expect one)
Poor Industrial Feudal (not sure about this one - industrial should trigger a blockade, Feudal shouldn't)

The script is the one you supplied, renamed thus

Code: Select all

// Configuration -- customize here 
this.role1 = "pirate"; 
this.count1 = 5;
this.role2 = "police";
this.count2 = 3;

// Standard attributes 
this.name           = "WitchpointBlockade"; 
this.author         = "Jens Ayton"; 
this.copyright      = "This script is hereby placed in the public domain."; 
this.version        = "1.0.1"; 
this.description    = "Script to make several ships of a given role appear at the witchpoint after every jump." 


this.shipWillExitWitchspace = function() 
{
    if (system.economy > 4 && system.government < 3)
    {  
        system.addShips(this.role1, this.count1, player.ship.position, 10000);
        system.addShips(this.role2, this.count2, player.ship.position, 10000);
    }
}

The relevant log entry for the above is

Code: Select all

[loading.complete]: ========== Loading complete. ==========
[script.load.world.listAll]: Loaded 23 world scripts:
    assassins
    behemoth 2.5.4
    Furball 1.0 alpha 1
    GalNavy Build 0139
    hofd GalNavy Build 118 / HOFD Build 55
    IR-defences.js 1.0
    IR-finance.js 1.0
    IR-main-script.js 1.0
    IR-SDF.js 1.0
    IR-shipment.js 1.0
    IronHide Armour Script 1.01
    oolite-cloaking-device 1.74.2
    oolite-constrictor-hunt 1.74.2
    oolite-nova 1.74.2
    oolite-thargoid-plans 1.74.2
    oolite-trumbles 1.74.2
    Pi-Forty-Two Con stores 4.1.4
    Random_Hits 1.4.6
    Repair system 2.0
    rockHermit_Locator 1.3.3
    stellarSerpents_masterScript.js 1.00
    System Redux 1.2 1.2
    WitchpointBlockade 1.0.1
where WitchpointBlockade is the last script listed. This was with cache cleared, and checked that world_scripts.plist is correct for the script.

Re: WIP - ToughGuys 2

Posted: Fri Jan 21, 2011 2:27 pm
by another_commander
Smivs wrote:
I would only like the blockade at Industrial worlds (economy >4), and stable governments (say govt type <3).
The specs seem to be somewhat wrong. Industrial worlds have economy < 4 and stable governments should be above 3. The list of enumerations for the two attributes are as follows:
economy =
(
"Rich Industrial",
"Average Industrial",
"Poor Industrial",
"Mainly Industrial",
"Mainly Agricultural",
"Rich Agricultural",
"Average Agricultural",
"Poor Agricultural"
);
government =
(
"Anarchy",
"Feudal",
"Multi-Government",
"Dictatorship",
"Communist",
"Confederacy",
"Democracy",
"Corporate State"
);
Enumeration starts at 0 for the first element, 1 for the second, etc.

As for the error you are getting, something else is wrong. I checked the script as printed above on my system and got the blockade at a system that fulfilled the conditions. The fact that it is looking for this.role, when inside the script only this.role1 and this.role2 are mentioned seems strange.

Re: WIP - ToughGuys 2

Posted: Fri Jan 21, 2011 2:35 pm
by Smivs
:oops: So I've got my 'greaterthan' and ' lessthan' the wrong way round. Doh. This explains why I was chuffed to get a grade 4 CSE maths.
I'll sort that out and have another go. Thanks for your patience.