Page 22 of 46

Posted: Tue Sep 07, 2010 8:43 pm
by Ramirez
Thanks. I thought I fixed the tournament problem in 1.7 but I realised there was something still at fault. I can't quite tell how the discrepancy between Oreseren and Ededleen has come about as they're meant to be driven by the same thing, but I've done some tweaks to the mission script to try to and minimise the risk of such errors .

Here's a quick test OXP for you to try - to save you time, I've modified it so that missions and promotions are offered at the main station rather than on the planet surface, so you only need to press F8 or re-dock to trigger the appropriate screen.

Feudal States v1.9 TEST

In your save game file you can delete the tournament-related entries and also the mission_feudal_player_credits which I realise isn't being used. Then, delete the mission_feudal_mission entry, then press F8 again while docked at Oreseren. This should generate a new mission and correct the house name in the last line.

[As an aside, what happens is that while you don't have a rank, a 'feudal_mission_home' variable is created each time you take on a mission so as to record which house you're working for. Once you join one of the houses, you're only offered missions from that one house and so the variable becomes effectively fixed until you happen to move into a different galaxy]

Posted: Wed Sep 08, 2010 10:48 am
by Mauiby de Fug
Well, I'm now delivering precious metals from Oreseren to Onusorle, for Oreseren, so that part works now. Took a test flight about the system and haven't been invited to a Tournament, so that seems fine.

However, it would appear that you do make use of mission_feudal_player_credits - I docked at the Hunting Lodge, accepted a challenge and was told
You currently have mission_feudal_player_credits Cr available in your account.
Apart from that, it seems fine!

Posted: Wed Sep 08, 2010 11:23 am
by Mauiby de Fug
I left the mission_feudal_player_credits variable in and the message I mentioned before now works correctly. However, the value is incorrect.

I noticed that I appeared to have a deficit of 113741.3 Cr between what was available and what was in actually in my account.

Manually editing the values to make them the same, I then flew to the Hunting Lodge, accepted a challenge, and the value seems fine. I then bought equipment (Quirium Bomb and Passenger Berth), just to see what that did. But the mission_feudal_player_credits didn't appear to change, as I had the same amount as before, i.e. it thought I had *more* money available to me than I actually had.
Similarly, it isn't updated when I win a challenge. The money is credited to the account, but the mission_feudal_player_credits doesn't change.

I may well not be understanding how this works, but something doesn't seem to be working there...

Incidentally, I seem to have accidentally won a challenge by using witchdrive injectors to fly through the ship and destroying it...

Posted: Wed Sep 08, 2010 12:45 pm
by Ramirez
Sorry - bit of brain fade about the player_credits thing. It is indeed used, though only to display a rounded-up value of your current cash on the challenge screens. I'll re-instate it but if you want to try a quick fix, open up the feudal-challenge.js script and search for 'this.feudalChallengeOffer = function()'. Modify the block of text to include an entry for player_credits in the last line so it looks like this:

Code: Select all

this.feudalChallengeOffer = function()

{	
		this.defineChallengerGender()
		this.defineGeneratorInputs()
		player.feudalRankGenerator()
		this.defineChallengerDetails()
		this.defineGeneratorOutputs()
		this.defineChallengerShips()
		this.defineChallengerOdds()
		missionVariables.feudal_challenger_offer = "CHALLENGE_OFFERED"
		missionVariables.feudal_player_credits = Math.round(player.credits*100)/100
}
Interesting point on crashing into a challenger - not very sporting is it! The OXP's currently written so that you only win by forcing your opponent's energy down, which would usually mean using lasers. Killing them instantly shouldn't result in a victory, though I guess collisions also can also cause a bit of energy damage. Just looking at the wiki I see it's now possible to differentiate between a ship dying because of energy damage or scrape damage (which I assume means a collision). Has anyone made use of these with this.shipDied yet? I'll have to give it a try.

Posted: Wed Sep 08, 2010 1:18 pm
by Eric Walch
Ramirez wrote:
Just looking at the wiki I see it's now possible to differentiate between a ship dying because of energy damage or scrape damage (which I assume means a collision). Has anyone made use of these with this.shipDied yet? I'll have to give it a try.
With 1.74 it works okay. In 1.73 were two responses switched in the code, so you can only use it reliable for a 1.74+ oxp. New in 1.74 is death by q-bomb as cause in the shipDied() handler. Before q-bomb death was registered as plain energy damage.

Also the shipCollided() handler is more reliable since 1.74. Since 1.65 the fact that two ships collided was only send to one of the two colliding ships. In that time it was only an AI message send to ships. The bug was not corrected when a handler response was added to that AI message. Only since 1.74 both ship-scripts do get the collision notifications.

Posted: Wed Sep 08, 2010 3:26 pm
by Thargoid
I quite often use shipDied's parameter to tell if a ship has been removed by script rather than killed. It is quite useful, albeit with the swap caveat Eric already mentioned.

Posted: Tue Sep 21, 2010 1:06 am
by Mauiby de Fug
Hmmm...

So, I'm now a Knight of Edzaon, and for my first mission I'm tasked with intercepting Geinona's shipment of machinery in the Tibecea system.

However, whenever I attempt to hyperspace into Tibecea, Oolite crashes. Once I hyperspace in, it runs fine for a second or two, and then freezes. Completely. I can still maximise/minimise the window, but it doesn't close. I have to force quit the application. Also, it causes my computer to run much slower than normal, even after I've managed to quit Oolite.

There are no problems at any of the neighbouring planets, just when I try to get to Tibecea, so I'm assuming that it's a mission related problem with this OXP. This makes it somewhat tricky to complete the mission...

Just in case there's something in the save game code that can help, here's all the feudal-mission strings:

Code: Select all

<key>feudal-mission.js</key>
	<string>Feudal mission: Intercept Geinona&apos;s shipment of machinery in the Tibecea system.</string>
	<key>feudal-promotion.js</key>
	<string>Feudal rank: Knight of Edzaon</string>

	<key>mission_feudal_challenger</key>
	<string>NONE_SET</string>
	<key>mission_feudal_jumpcount</key>
	<string>9</string>
	<key>mission_feudal_mission</key>
	<string>RAID_RUNNING</string>
	<key>mission_feudal_mission_cargocount</key>
	<string>0</string>
	<key>mission_feudal_mission_commodity</key>
	<string>machinery</string>
	<key>mission_feudal_mission_home</key>
	<string>Edzaon</string>
	<key>mission_feudal_mission_home_galaxy</key>
	<string>0</string>
	<key>mission_feudal_mission_house</key>
	<string>Geinona</string>
	<key>mission_feudal_mission_location</key>
	<string>Tibecea</string>
	<key>mission_feudal_mission_location_no</key>
	<string>170</string>
	<key>mission_feudal_mission_reward</key>
	<string>3097</string>
	<key>mission_feudal_mission_role</key>
	<string>feudal-boa</string>
	<key>mission_feudal_mission_ship</key>
	<string>Boa</string>
	<key>mission_feudal_player_credits</key>
	<string>1509355.5</string>
	<key>mission_feudal_player_gender</key>
	<string>he</string>
	<key>mission_feudal_player_of</key>
	<string>of</string>
	<key>mission_feudal_player_rank</key>
	<string>Knight</string>
	<key>mission_feudal_player_rank_no</key>
	<string>1</string>
	<key>mission_feudal_player_title</key>
	<string>Sir</string>
	<key>mission_feudal_player_title_peer</key>
	<string>Lord</string>
	<key>mission_feudal_score</key>
	<string>6</string>
	<key>mission_feudal_tournament_jumpcount</key>
	<string>30</string>
On the more positive side, all my earlier problems appear to have disappeared, so thank you for solving those!

Posted: Tue Sep 21, 2010 7:45 am
by Commander McLane
Just to be on the safe side: How long have you waited before force-quitting? In very rare situations, and depending on your hardware, it can take up to 30 seconds or so until a system is populated. The player would see that as a freeze. But as soon as all ships and entities are placed in the system, Oolite continues normally.

However, it is perfectly possible that there is indeed a bug somewhere in a script which causes an infinite loop or something of the like, which would lead to a real freeze. Are there any hints in your logfile?

Posted: Tue Sep 21, 2010 10:16 am
by Ramirez
Hmm, I may have an idea on what this is, though unfortunately I won't be free to test it for a few days.

The raid mission uses a special script that allows knights from the correct house to be set up as escorts to the shipment, in this case three Boa freighters. When you hyperspace into the mission location, the script spawns the Boas plus a handful of knights from the relevant house (Geinona) which then go into escort mode and form up on the freighters.

Recently I was trying to using the same technique in my WIP mission and I experienced some lockups similar to what's being described. I think it was caused by trying to add too many escorts in one go - the script couldn't seem to handle adding more than around four escorts per ship.

This may be relevant as by chance, the location for your mission happens to be Tibecea, which is another feudal state. All the feudal states are populated with a hunting lodge plus a handful of feudal ships just to add some colour. It may be that too many ships from Geinona are being populated, resulting in the lockup as the escort script struggles to do its work.

Try any of the following:

- remove the feudal-challenges.js from the script folder - this is the script that populates additional ships in each of the feudal systems. Try jumping into Tibecea and see what happens.
- alternatively, change the mission_feudal_location_no in your savegame to another number so that the mission is set in another system.
- if you're running any of the debug tools, try adding ships with roles 'feudal-boa' and 'Geinona-knight' to see if they're spawned correctly, regardless of which system you're in.

Posted: Wed Sep 22, 2010 11:55 am
by Mauiby de Fug
I've waited for 2 to 3 minutes, and there's still been no sign of life.

Removing feudal-challenge.js made no apparent difference.

I changed the mission_feudal_location_no to Ceedra in the save game. This allowed me to fly into Tibecea normally, but when I attempted to fly into Ceedra the same problem occurred.

I don't know how to use debug tools or change what shows up in the log file.

Looking through Latest.log, possible errors appear to be:
[shipData.load.begin]: Loading ship data.
[shipData.load.error]: ***** ERROR: the shipdata.plist entry "feudal-cannon-player" specifies non-existent model "feudal-cannon-body.dat".
and further down
[script.javaScript.warning.ooliteDefinedError]: ----- JavaScript warning (OXPConfig 1.08) : Mission.choice is deprecated and will be removed in a future version of Oolite.
[script.javaScript.warning.ooliteDefinedError]: /home/robert/.Oolite/AddOns/OXPConfig1.08.oxp/Scripts/OXPConfig.js, line 248.
although since the latter is talking about OXPConfig, I don't know if it's relevant or not...

Posted: Wed Sep 22, 2010 6:38 pm
by Ramirez
OK, thanks for the info. I've been able to have a good look and I can replicate your problem.

I'll share the details for the benefit of others: Kaks helped me out with the escort code back in Feb 2009, and it involved using a delayed one-shot timer triggered when the Boa was spawned:

Code: Select all

this.zETimer=new Timer(this,this.zeroEscorts,.2)
This calls the following function:

Code: Select all

this.zeroEscorts = function(){ 
   while(this.ship.escorts){ 
      this.ship.escorts[0].remove(); 
   } 
} 
This created a loop to remove the Boa's default escorts so that the knights can form up. However, whenever I use the 'while' statement I now I get a lockup. Has this statement been deprecated or something since I included it?

Now I know more about how timers work I can use an alternative method which seems to work just as well. A repeating timer is set up as follows:

Code: Select all

this.zETimer = new Timer(this,this.zeroEscorts,null,0.2)
and the function looks like this:

Code: Select all

this.zeroEscorts = function()
{ 
   if(this.ship.escorts)
   { 
      this.ship.escorts[0].remove();
	  //log('escort removed')
   }
   
   if(!this.ship.escorts)
   {this.zETimer.stop()
   //log('timer stopped')
   }
} 


Here's a v1.9.1 with this fix applied. Give it a try and let me know how you get on.

Posted: Wed Sep 22, 2010 7:20 pm
by Thargoid
Or you could just do a for loop that loops based on the number of escorts (this.ship.escorts.length) and sequentially removes this.ship.escorts[0].

Same effect as the while statement, but done a different way. And while is a native JS function not an Oolite one, so should not be a candidate for any kind of depreciation (outside that of Javascript itself of course).

Posted: Thu Sep 23, 2010 4:39 am
by Kaks
Thanks for the mention! :)

As Thargoid said, the while command is part of the js language itself. The one thing that possibly changed is the way the .escorts property is handled...

Though I'll need to look at the Oolite code in some detail to be sure, I suspect that changing the original while from

Code: Select all

while(this.ship.escorts){ 
to

Code: Select all

while(this.ship.escorts && this.ship.escorts.length > 0){ 
should also avoid infinite loops...

Posted: Thu Sep 23, 2010 2:50 pm
by Mauiby de Fug
The fix appears to work well - I've completed the first mission (at Tibecea) and done a second one as well. Loads with no problems whatsoever!

Minor points - when I attack the Boa/Anaconda etc, they shout for help. The first one or two "Mayday" shouts make sense, but after that they start saying "liner-plea".

Also, when I returned to Edzaon (both times) I was greeted by a blank mission screen. Presumably this would have been thanking me or acknowledging the completion of the mission. But as it was blank, I have no idea.

But the mission runs smoothly, with no other apparent errors, and, more importantly, without crashing, so much thanks!

Meanwhile, I probably ought to catch up on some sleep I didn't get last night whilst playing Oolite. Damn this addictive game...

Posted: Sun Sep 26, 2010 12:03 am
by Lone_Wolf
While doing challenges from royal hunting lodge, i noticed feudal states disables the energy bomb by damaging it.

As my cobra had the self-repair system (repairbots_2.00 oxp) , upon launch repairs on the energy bomb started.
several times it was repaired before the duel ended and i could have used it.