Ian, I now uploaded the changed files here. This code should run a bit faster and probably avoid the "slow-computer" message on those systems that suffer from it. It contains all files I changed since RH 1.4.8. Let me hear if this improves things.
When you have the console installed, I like to know how this code profiles on your computer. Start Oolite and choose the Jameson. Than open the console window. For Oolite 1.75.0 or trunk, just type:
When using 1.75.1, the 'time' macro is not working
You can work around that by dropping this file into your AddOns directory. Don’t forget to remove it when 1.75.2 drops.
On further consideration this doesn’t make sense, since we don’t normally post a new debug OXP for minor version bumps. I’ve posted a fixed version on the wiki.
Opened connection with Oolite version 1.75
> console.profile(eval("(function codeToBeProfiled() { (" + "worldScripts[\"Random_Hits\"].setupHitpages()" + ") })"), this)
Total time: 862.36 ms
JavaScript: 50.552 ms, native: 811.727 ms
Counted towards limit: 758.356 ms, excluded: 104.004 ms
Profiler overhead: 45.141 ms
But it makes me more puzzled. The ratio JS vs. native time is comparable with my system, but somehow is seems it does not look at the JS time itself for the limiter.
Ian, I now uploaded the changed files here. This code should run a bit faster and probably avoid the "slow-computer" message on those systems that suffer from it. It contains all files I changed since RH 1.4.8. Let me hear if this improves things
I have changed the files as suggested. But I am still getting the "Too Slow" problem I have to launch and re-dock a number of times before I get offered missions. But at least I can still get them.
Find out about the early influences of Fatleaf here. Also his OXP's!
Holds the Ooniversal record for "Thread Necromancy"
I have changed the files as suggested. But I am still getting the "Too Slow" problem I have to launch and re-dock a number of times before I get offered missions. But at least I can still get them.
Good to hear that it at least partially works. Apparently your computer has still to many background tasks sometimes that slow down Oolite. e.g. when I run two versions of Oolite simultaneously, my fps drops significantly. The same will be true for other open applications that stay busy in the background. Killing those when playing will also improve Oolites overall performance.
Anyhow, I noticed that Ahruman raised the limit during the docking handler from 1 to 5 seconds. That should help all long code running during docking. It is already in trunk, so you might download a nighty when you don't want to wait on a next release. Normally trunk is not for playing because it could be full of bugs. But, as we are in a feature lock phase, no new functions are added to trunk, so it is less likely that new bugs are introduced and only fixes are added.
When used as a constructor it must be capitalised. You use it as constructor in the static methods. There also exists an instance of this constructor. That is 'system' in lowercase. That casing is to be used with properties and methods. See System
In oolite-random-hits-mark.js file, I see a few lines I'd expect would have ;'s on the end...yet they don't:
missionVariables.random_hits_status = "PODEDOUT" // Victim made it to his Pod! Set the variable to reflect that the player still needs to kill or scoop the Pod!
missionVariables.random_hits_status = "COMPLETE" // Record the fact that the Victim's ship has been destroyed.
missionVariables.random_hits_status = "NPCKILL" // Record the fact that the Victim's ship has been destroyed.
missionVariables.random_hits_status = "JUMPED"
I doubt semicolons are completely optional, as I've hard a few bugs when I've missed one myself.
But is there something special about these lines which makes ;'s optional?
Semicolons are generally optional, as long as you put each statement on a separate line. (There’s a formally specified process called “automatic semicolon insertion” that handles this.) However, there are nasty edge cases and it’s widely considered good practice to use explicit semicolons. The only time I omit them these days is using the console.
I've still got the 'too slow' problem (on my fast computer). I'm on trunk 1.75.2.4544-dev.win32 - and had the problem on 1.75.1 as well. I've got Anarchies 2.5.
I've still got the 'too slow' problem (on my fast computer). I'm on trunk 1.75.2.4544-dev.win32 - and had the problem on 1.75.1 as well. I've got Anarchies 2.5.
I just ran into this as well (on a certainly fast enough computer). Relevant log excerpt:
23:32:25.930 [oolite-random-hits-hopper]: The miningHopper: GalMine Hopper IS6-S30 was killed by [Ship "GalMine AutoMiner" position: (846.509, -8806.35, 619754) scanClass: CLASS_ROCK status: STATUS_DEAD] because of scrape damage
23:35:19.995 [station.launchShip.failed]: Cancelled launch for a Imperial Courier with role defense_ship, as it is too large for the docking port of the Rock Hermit.
23:36:06.306 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (Random_Hits 1.4.10): TypeError: System.infoForSystem(galaxyNumber, targetSystem.systemID).routeToSystem(thisSystem) is null
23:36:06.306 [script.javaScript.exception.unexpectedType]: /Users/maik/Games/Oolite beta 1.75.2/AddOns/RandomHits1.4.10.oxp/Scripts/oolite-randomHits.js, line 960.
23:36:12.602 [Random_Hits]: Succeeded in generating 0 hitpages. You should only see this message with Oolite debug builds or in release builds at slow computers.
23:36:52.745 [Random_Hits]: (Hatred : 0. Events Timer : 1. Dockings : 1. Events Number : 0. Special Mission Timer : 1. Revenge Status : KILLED. Time to Strike : mission_random_hits_striketime. Revenge Jumps Made : mission_random_hits_timer. Special Mission : WAITING. Master Timer : 1. Dice Roll : 63)