Page 9 of 70

Posted: Sun May 25, 2008 11:16 pm
by LittleBear
Yep can happen. However, Marks will flee an attack by an NPC if the player is not present and only Cops or Thargoids will attack them in the first place. Its unlikely that you will fail because an NPC does the deed but it is possible. If an NPC kills or captures a Mark (if the pod ejects and the killer has fuel scoops it'll get picked up), then you'll get a mission failed message and a consolation payment when you dock. I woudn't expect you to fail more than 5% or so of jobs because on an NPC kill, but don't hang about in the System one you jump in. Other hunters may be on the case!

Posted: Mon May 26, 2008 12:35 am
by Commander Mysenses
Got 'er this time!... She didn't eject.
I swapped to v.1.71.2 not sure if that made any difference.

Posted: Fri May 30, 2008 4:43 pm
by Commander Mysenses
Different hit, same problem! :?

In Galaxy 2 hunting down Yogi Phrostbite in a reliable Wolf Mk II in Esrece.
Found her, took out her hired hands, chased her through two more systems, blew up her ship and got the message, "Yogi Phrostbite has ejected, delete her escape capsule". But the only object within 25 klicks was a piece of hull plating (which I zapped, just in case). Getting a bit frustrating this! Is this happening to anyone else?

Running Oolite 1.71.2 and Random Hits 1.2

Posted: Fri May 30, 2008 5:12 pm
by LittleBear
Hmm. Something is clearly up, but I can't seem to reproduce it on my machine on 1.71.2 Windows XP. The Script is being run and the 'dice' have chosen the option that the victim makes it to his / her pod. This bit is working properly as this is why your getting the "Destroy the pod" message. The next line in the script is meant to spawn a pod. It is doing this on my system with the pod appearing at the position where the Victim's ship's was when it died. I'm a bit stumped.

This is the Java Script for the Victim's Ship :-

Code: Select all

/*
this.name = "oolite-random-hits-mark40";
this.author = "LittleBear";
this.copyright = "January 2008 - But do what you like with it in your OXPs!";
this.description	= "Tests who killed a RandomHits OXP Victim Ship and how they did it. The main script acts on the setting of variables."
this.version = "1.1";
*/

this.shipDied = function(whom)
{	
		    if(Math.random() < 0.66) // Role the Dice to see if the Victim made it to his Pod.
	{
		missionVariables.random_hits_status = "PODED" // Victim made it to his Pod! Set the variable to reflect that the player still needs to kill or scoop the Pod!
		this.ship.spawn("random_hits_pod2", 1); // Spawn a Pod. Any shooting or scooping of the Pod is handled by the Pod's own Script.
	}
	else
	{	
		missionVariables.random_hits_status = "KILLED" // Victim died with his ship. Set the variable to reflect this.
		this.ship.spawn("RANDOM_HITS_MINE", 1); // Spawn a Q-Mine which taunts the player before exploding! Nasty!
	}
	
}

this.shipBeingAttacked = function(whom)
{
    if(whom == player)
    {
      missionVariables.random_hits_whoshot = "PLAYER_ATTACK" // Shooter was the player not using an e-bomb, q-mine or cloak. The variable remains undefined if the player e-bombs, q-mines or kills the victim whilst cloaked as thisBeingAttacked does not get run. The main script then awards the player the credit for the kill, but fines him for dishonerable conduct!
    }
    else
    {
     missionVariables.random_hits_whoshot = "NPC_ATTACK" // Shooter was NPC ship. Every time the victim is hit, the variable is reset. Once he's dead the variable is not longer reset. So the last ship to hit him was also the killer!
    }
}

The legacy script also contains this:-

Code: Select all

<!-- If the mark was destroyed but launched a pod, set the mission description to tell the player to destroy the pod  -->

	 <dict>
            <key>conditions</key>
            <array>
	       <string>mission_random_hits_status equal PODED</string>
            </array>
            <key>do</key>
            <array>
	       <string>setMissionDescription: random_hits_shortdescription4</string>
	       <string>set: mission_random_hits_status PODEDOUT</string>
	       <string>consoleMessage6s: [random_hits_poded]</string>
            </array>
         </dict>
The Variable is clearly been set to PODED as Commander Mysenses is getting the [random_hits_poded] randomised message telling him to scoop or destroy the pod, but for some reason the "this.ship.spawn("random_hits_pod2", 1); " isn't creating a pod. The Java Script seems to be working though because it has set the Variable.

Any ideas?

Posted: Fri May 30, 2008 5:54 pm
by LittleBear
@Commander MySenses.

This may be a dumb question, but when you installed RandomHits1.2 did you hold down the SHIFT key whilst you loaded up Oolite for the first time? If you didn't Oolite will still be using the OLD version of the script which won't spawn a pod on Oolite 1.71.2. If you didn't can you do this and try again. If you did then:-

Could you do this? Go and kill that pesky Wolf again. Once he's dead pause the game with P and then press 0 (zero). This'll dump the list of ships in the system to the stdrr file. Can you open it up (notepad or any text editor) and have a look. You should see something like this:-

Code: Select all

2008-05-30 18:47:45.890 oolite.exe[2752]   [universe.objectDump]: -> Ent:2		<ShipEntity 0x1c6e29b0>{"Worm Escape Craft (Target Aboard)" ID: 402 position: (25178.7, 4715.25, 61537.6) scanClass: CLASS_CARGO status: STATUS_IN_FLIGHT} mass 8977.24 <AI 0xb687b78>{"randomhitshomeAI.plist" in state: "FLEE" for Worm Escape Craft (Target Aboard) 402}
2008-05-30 18:47:45.890 oolite.exe[2752]   [universe.objectDump]: -> Ent:3		<ShipEntity 0xcca9178>{"Adder Mk II (Hired Help)" ID: 390 position: (25189.1, 8292.4, 65013.2) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT} mass 18477.52 <AI 0xb20aa38>{"randomhitsescort26AI.plist" in state: "ATTACK_SHIP" for Adder Mk II (Hired Help) 390}
2008-05-30 18:47:45.890 oolite.exe[2752]   [universe.objectDump]: -> Ent:4		<ShipEntity 0xb9a5f68>{"Adder Mk II (Hired Help)" ID: 392 position: (25493.2, 7843.26, 66527.6) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT} mass 18477.52 <AI 0xb2821d8>{"randomhitsescort26AI.plist" in state: "ATTACK_SHIP" for Adder Mk II (Hired Help) 392}
2008-05-30 18:47:45.890 oolite.exe[2752]   [universe.objectDump]: -> Ent:5		<ShipEntity 0x1b091988>{"Adder Mk II (Hired Help)" ID: 389 position: (24420.3, 3447.88, 67581.5) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT} mass 18477.52 <AI 0xb1d5468>{"randomhitsescort26AI.plist" in state: "ATTACK_SHIP" for Adder Mk II (Hired Help) 389}
2008-05-30 18:47:45.890 oolite.exe[2752]   [universe.objectDump]: -> Ent:6		<ShipEntity 0x1a9af0a8>{"Adder Mk II (Hired Help)" ID: 393 position: (24540.7, 8964.7, 65162.6) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT} mass 18477.52 <AI 0xb3c7968>{"randomhitsescort26AI.plist" in state: "ATTACK_SHIP" for Adder Mk II (Hired Help) 393}
2008-05-30 18:47:45.890 oolite.exe[2752]   [universe.objectDump]: -> Ent:7		<ShipEntity 0xacb4f50>{"Adder Mk II (Hired Help)" ID: 391 position: (23257.8, 1721.65, 57844.2) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT} mass 18477.52 <AI 0xb22dd58>{"randomhitswormAI.plist" in state: "ATTACK_SHIP" for Adder Mk II (Hired Help) 391}
2008-05-30 18:47:45.890 oolite.exe[2752]   [universe.objectDump]: -> Ent:9		<ShipEntity 0x1a783aa8>{"Asteroid" ID: 354 position: (3208.16, 6900.46, 130118) scanClass: CLASS_ROCK status: STATUS_IN_FLIGHT} mass 1319797.75 <AI 0xb6e7de8>{"dumbAI.plist" in state: "GLOBAL" for Asteroid 354}
2008-05-30 18:47:45.890 oolite.exe[2752]   [universe.objectDump]: -> Ent:10		<ShipEntity 0x1a8fc738>{"Anaconda" ID: 405 position: (15863.4, -3802.48, -5598.26) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT} mass 429553.06 <AI 0xfb89b8>{"route1traderAI.plist" in state: "HEAD_FOR_PLANET" for Anaconda 405}
2008-05-30 18:47:45.890 oolite.exe[2752]   [universe.objectDump]: -> Ent:11		<ShipEntity 0x1d2c7e70>{"Witchpoint Beacon" ID: 376 position: (11500, -6600, -7900) scanClass: CLASS_BUOY status: STATUS_IN_FLIGHT} mass 383595.94 <AI 0xb76a698>{"buoyAI.plist" in state: "GLOBAL" for Witchpoint Beacon 376}
2008-05-30 18:47:45.890 oolite.exe[2752]   [universe.objectDump]: -> Ent:12		<ShipEntity 0x1a70a598>{"GalCop Viper" ID: 353 position: (14247, -6461.53, 147006) scanClass: CLASS_POLICE status: STATUS_IN_FLIGHT} mass 22723.75 <AI 0xb7b4db8>{"route1patrolAI.plist" in state: "HEAD_FOR_WITCHPOINT" for GalCop Viper 353}
2008-05-30 18:47:45.890 oolite.exe[2752]   [universe.objectDump]: -> Ent:13		<ShipEntity 0x1a8d4ff8>{"Python" ID: 347 position: (4685.86, -6839.71, 249365) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT} mass 222284.38 <AI 0xb82dd68>{"route1traderAI.plist" in state: "ATTACK_SHIP" for Python 347}
2008-05-30 18:47:45.890 oolite.exe[2752]   [universe.objectDump]: -> Ent:14		<ShipEntity 0x1a5fbd90>{"Gecko" ID: 348 position: (4770.46, -8445.98, 257734) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT} mass 22592.23 <AI 0xb742c18>{"pirateAI.plist" in state: "ATTACK_SHIP" for Gecko 348}
Entry 2 here is the Pod. On my sysem he's appearing at the scean of the mark's death. Is the ship appearing on the list? This'll at least test whether the problem is that pod not being added at all or whether its being added in the wrong place for some reason.

Posted: Fri May 30, 2008 6:12 pm
by Commander Mysenses
Wilco.... later... off to surf now (IRL :D )

Posted: Fri May 30, 2008 11:07 pm
by JensAyton
LittleBear wrote:
This may be a dumb question, but when you installed RandomHits1.2 did you hold down the SHIFT key whilst you loaded up Oolite for the first time? If you didn't Oolite will still be using the OLD version
This should not be the case when adding, removing or overwriting whole OXPs.

Posted: Fri May 30, 2008 11:14 pm
by Commander Mysenses
Not added at all, see stderr.txt I PM'ed to you.

Posted: Fri May 30, 2008 11:15 pm
by LittleBear
Yeah. I thought it did update if the date of the folder was different, but as I'm not getting this error the only thing I could think of was the old version of the script is being used somehow on Commander MySenses install (and so its using the old legacy_spawn command - which won't add a ship on 1.71.1, but the variable would still be set), so worth a go.

As I'm not getting this with 1.2 and it seems to be working on other systems, could you delete the OXP from AddOns and do a reinstall? Then give it another go? You won't lose the mission or your progress as this is stored in your Commander save game.

Posted: Fri May 30, 2008 11:20 pm
by LittleBear
Cheers for the PM. Yep the problem is here:-

Code: Select all

2008-05-30 23:37:56.343 oolite.exe[212] [script.javaScript.warning.206]: ----- JavaScript warning: The event handler beingAttacked has been renamed to shipBeingAttacked. The script oolite-random-hits-mark40 must be updated. The old form will not be supported in future versions of Oolite! 

Code: Select all

2008-05-30 23:49:24.687 oolite.exe[212] [script.javaScript.warning.206]: ----- JavaScript warning: system.legacy_spawn() is deprecated (and never worked), use Ship.spawn() instead. 
For some reason Oolite is using the OLD version of the script NOT the updated version used in V1.2. I dunno how exactly but for some reason Oolite is using the V1.1 version of the script. This won't work on Oolite 1.71.1 due to the command name change hence no pod!

Cool. At least I know what wrong. Can you delete the RandomHits OXP completely from AddOn and redownload and reinstall?

Posted: Fri May 30, 2008 11:21 pm
by Commander Mysenses
Hang on... my bad had the wrong version still installed!
Duh!

Not sure how I managed that!

Posted: Thu Sep 11, 2008 12:26 pm
by LittleBear
UPDATE 11/9/08 : Optimised Script available.

This patch does not add any new gameplay, but it patches the OXPs Script to make the OXP run much faster. You should now get no slow down in Oolite's running with Random Hits installed. Big thanks to Commander Svengali for doing this.

This is a patch (22k upzips to 200k), so you must already have Random Hits installed to use it. Unzip the download file and you'll see a new folder called RandomHitsPatch. Inside this is a file called Script.plist. Move this File INSIDE the RandomHits.oxp CONFIG folder to that it replaces the Old script. (ie you need to move it to AddOns\RandomHits.oxp\Config). The first time you load up Oolite after patching you will need to hold down the SHIFT key until you see the rotating Cobra on the start screen. As you changed the internal "innards" of an OXP you need to do this in order to update Oolite's cache. If you don't, Oolite will continue to use the old script code from Random Hits.

Link for the Patch:-

http://www.box.net/shared/fzggpctygc

Posted: Sat Sep 13, 2008 4:50 pm
by Eric Walch
LittleBear wrote:
UPDATE 11/9/08 : Optimised Script available.

This patch does not add any new gameplay, but it patches the OXPs Script to make the OXP run much faster. You should now get no slow down in Oolite's running with Random Hits installed. Big thanks to Commander Svengali for doing this.
Great work Little Bear. It is really a major speed improvement. I always said that restructuring the scripts would improve speed but never thought it would be that much.

Some people are afraid to add to many oxp's in their system. They are specially afraid for mission oxp's because of their long scripts. However it are not the oxp's with scripts that use time, but all the installed oxp's that add ships. I always wanted to time the script execution but never saw a way to do it. With JS I found a way to time the legacy scripts. When you are interested how scripts perform on your system, you can download it at the box: ScriptTimer 1.1

But don't leave it installed as it wastes processor time. It fires the scripts every 15 seconds and logs the time (in the log file and to the console). Time depends on location.

With all my usual scripts installed I normally get following result on my 700 mHz Mac:

Code: Select all

Status: STATUS_DOCKED, Script execution took: 9 ms.
Status: STATUS_DOCKED, Script execution took: 6 ms.
Status: STATUS_DOCKED, Script execution took: 7 ms.
Status: STATUS_IN_FLIGHT, Script execution took: 9 ms.
Status: STATUS_IN_FLIGHT, Script execution took: 6 ms.
Status: STATUS_IN_FLIGHT, Script execution took: 6 ms.
Status: STATUS_IN_FLIGHT, Script execution took: 6 ms.
With the old random Hits script installed it rose to:

Code: Select all

Status: STATUS_DOCKED, Script execution took: 62 ms.
Status: STATUS_DOCKED, Script execution took: 62 ms.
Status: STATUS_IN_FLIGHT, Script execution took: 61 ms.
Status: STATUS_IN_FLIGHT, Script execution took: 60 ms.
The difference is Random Hits that took 50 ms by itself. That is still not much and only took place every 10 seconds. Still, 50 ms time gaps during flight are just noticeable.

With the changed code I get:

Code: Select all

Status: STATUS_DOCKED, Script execution took: 16 ms.
Status: STATUS_DOCKED, Script execution took: 15 ms.
Status: STATUS_DOCKED, Script execution took: 15 ms.
Status: STATUS_IN_FLIGHT, Script execution took: 10 ms.
Status: STATUS_IN_FLIGHT, Script execution took: 9 ms.
Status: STATUS_IN_FLIGHT, Script execution took: 9 ms.
Status: STATUS_IN_FLIGHT, Script execution took: 13 ms.
On average it is now maybe 6 ms more than without RH. It means the code executes almost 10 times as fast. That's a major improvement by just moving a few (probably more than a few) condition checks to an other place. Now it selectively runs the code. Even for he old situation I was amazed that that amount of code took so little time. (But that is probably because I also knew how slow code ran on a 1 mHz C64)

Posted: Sat Sep 13, 2008 5:40 pm
by Thargoid
The new link in the wiki page to download the patch had a typo in it, so wasn't working properly. I've taken the liberty of correcting it with the link above. Hope that's OK.

Posted: Sat Sep 13, 2008 8:04 pm
by DaddyHoggy
@Eric - the C64 was (and mine still is) very slow but it definitely ran at 1MHz not 1mHz! :lol: