Page 2 of 3

Re: BlackJacks bullion mission addon

Posted: Tue Jun 05, 2012 11:08 am
by Talisker
Yoink!

Thank you :)

Re: BlackJacks bullion mission addon

Posted: Tue Jun 05, 2012 4:38 pm
by maik
Wildeblood wrote:
Talisker wrote:
licensing permitting, obviously
this.name = "blackjacks"
this.author = "Rustybolts"
this.copyright = "Do with as you wish"
this.description = "Starts in Galaxy 2 at Telace.";
https://www.box.com/s/1b042baf433f0bb92059
Thanks, I put this link on its wiki page.

Re: BlackJacks bullion mission addon

Posted: Thu Jun 07, 2012 7:55 pm
by richard.a.p.smith
Hi. Given recent updates, should this work with 1.76.1? In the last log I get

20:18:09.306 [script.javaScript.exception.notFunction]: ***** JavaScript exception (blackjacks 1.22): TypeError: mission.runMissionScreen is not a function
20:18:09.306 [script.javaScript.exception.notFunction]: ../AddOns/galaxy 2, Blackjack's Bullion 1.25.oxp/Scripts/blackjacks.js, line 10.
20:18:39.277 [script.javaScript.exception.notFunction]: ***** JavaScript exception (blackjacks 1.22): TypeError: mission.runMissionScreen is not a function
20:18:39.277 [script.javaScript.exception.notFunction]: ../AddOns/galaxy 2, Blackjack's Bullion 1.25.oxp/Scripts/blackjacks.js, line 10.

Rich.

Re: BlackJacks bullion mission addon

Posted: Fri Jun 08, 2012 3:28 am
by Wildeblood
richard.a.p.smith wrote:
Hi. Given recent updates, should this work with 1.76.1?
I don't know anything about it; I've never played it and never poked around inside it. I did not hesitate to upload it the other night because I can vouch for my copy being unchanged from the last version RustyBolts published; I cannot, however, vouch for it actually working. :(

Re: BlackJacks bullion mission addon

Posted: Fri Jun 08, 2012 5:43 am
by Thargoid
It should be mission.runScreen, not mission.runMissionScreen. That's the source of the log errors above, just for clarity.

Re: BlackJacks bullion mission addon

Posted: Fri Jun 08, 2012 7:48 am
by richard.a.p.smith
I tried 1.26 and the log now shows

08:45:34.431 [script.javaScript.exception.ooliteDefinedError]: ***** JavaScript exception (blackjacks 1.22 (1.2.6)): Error: mission.runScreen: Invalid arguments ("pod.png") -- expected function.
08:45:34.431 [script.javaScript.exception.ooliteDefinedError]: ../AddOns/galaxy 2, Blackjack's Bullion 1.2.6.oxp/Scripts/blackjacks.js, line 10.

Rich.

Re: BlackJacks bullion mission addon

Posted: Fri Jun 08, 2012 8:00 am
by Commander McLane
Well, yes. The syntax of runScreen is different from the syntax of the removed runMissionScreen. They're not the same thing.

This means that that OXP in its current form indeed isn't compatible to Oolite 1.76.

Re: BlackJacks bullion mission addon

Posted: Fri Jun 08, 2012 8:32 am
by Wildeblood
Well, now we have started down this road, we might as well finish the job. What's the correct syntax, Commander McLane?
This is an example of what is in the script now:-

Code: Select all

		if (guiScreen != "GUI_SCREEN_MISSION" && player.ship.dockedStation.isMainStation && galaxyNumber==1 && !missionVariables.bolts && system.ID==241){
			mission.runMissionScreen('revengebolts_briefing','pod.png');
			mission.setInstructionsKey ('bolts1');
			missionVariables.bolts='STAGE1';
		}
What should be there?

Re: BlackJacks bullion mission addon

Posted: Fri Jun 08, 2012 10:06 am
by Commander McLane
See here.

Re: BlackJacks bullion mission addon

Posted: Fri Jun 08, 2012 10:17 am
by Wildeblood
Commander McLane wrote:
See here.
I already looked there. It's too cryptic for me to ken.

Re: BlackJacks bullion mission addon

Posted: Fri Jun 08, 2012 12:15 pm
by Commander McLane
It's not that cryptic.

Code: Select all

			mission.runMissionScreen('revengebolts_briefing','pod.png');
Obviously 'revengebolts_briefing' is the key in missiontext.plist, and 'pod.png' is a model which shall be shown. Thus it's:

Code: Select all

			messageKey:'revengebolts_briefing', model:'pod.png'
Now we only have to keep in mind that these (and the possible background pictures, overlays, and what have you) are forming the first parameter for runScreen (the second parameter would be the callback function if there were any), thus we need to combine them into one parameter with brackets:

Code: Select all

			{messageKey:'revengebolts_briefing', model:'pod.png'}
And finally we put what he have translated now as the argument into runScreen:

Code: Select all

			mission.runScreen({messageKey:'revengebolts_briefing', model:'pod.png'});
And there you are. :)

Re: BlackJack's Bullion mission addon

Posted: Fri Jun 08, 2012 1:25 pm
by Wildeblood
Commander McLane wrote:
It's not that cryptic.
I'm flattered that you over-estimate my kenning ability.

Let's try this: https://www.box.com/s/ed1c019b87b021ee54db

Re: BlackJack's Bullion mission addon

Posted: Fri Jun 08, 2012 2:14 pm
by Eric Walch
Wildeblood wrote:
Should probably work. Since 1.74 we have a better trigger for showing mission screens. I would propose the following:

Code: Select all

this.name           = "blackjacks"
this.author         = "Rustybolts"
this.copyright      = "Do with as you wish"
this.description    = "Starts in Galaxy 2 at Telace.";
this.version        = "1.2.6 (1.22)"
	
this.missionOffers = function()
	{
		if (player.ship.dockedStation.isMainStation && !missionVariables.bolts && system.ID==241){
			mission.runScreen({messageKey:'revengebolts_briefing', background:'pod.png'});
			mission.setInstructionsKey ('bolts1');
			missionVariables.bolts='STAGE1';
		}
		if (player.ship.dockedStation.isMainStation && missionVariables.bolts == 'STAGE2'){
			mission.runScreen({messageKey:'revengebolts_firearms', background:'firearms.png'});
			mission.setInstructionsKey ("bolts2");
			missionVariables.bolts='STAGE3';		
		}
		if (player.ship.dockedStation.isMainStation && missionVariables.bolts == 'STAGE3' && system.ID==233){
			mission.runScreen({messageKey:'revengebolts_robbery'});
			player.ship.awardCargo("Firearms",1);
			missionVariables.bolts='STAGE4';
			mission.setInstructionsKey ('bolts3');
		}
		if (player.ship.dockedStation.isMainStation && missionVariables.bolts == 'STAGE4' && system.ID==127){
			mission.runScreen({messageKey:'revengebolts_flee', background:'vipers.png'});
			player.ship.bounty = 64;
			missionVariables.bolts='STAGE5';
			mission.setInstructionsKey ('bolts4');
		}
		if (missionVariables.bolts=='STAGE5'){
			player.ship.bounty = 64;
		}
		if (missionVariables.bolts=='STAGE6'){
			player.ship.bounty = 64;
		}
		if (player.ship.dockedStation.isMainStation && missionVariables.bolts == 'STAGE6' && system.ID==67){
			mission.runScreen({messageKey:'revengebolts_finish', background:'end.png'});
			player.credits+=9500;
			missionVariables.bolts='STAGE99';
			player.ship.bounty = 0;
			mission.setInstructionsKey (null);
		}
	}

this.missionScreenOpportunity = function()
	{
	if(!player.ship.docked || galaxyNumber != 1) return;
	this.missionOffers();
	}

this.shipExitedWitchspace = function()
	{
		if (system.ID==99 && galaxyNumber==1 && missionVariables.bolts=='STAGE5'){
			system.legacy_addSystemShips("witness", 1, 0.10);
		}
		if (system.ID==88 && galaxyNumber==1 && missionVariables.bolts=='STAGE1'){
			system.legacy_addSystemShips("bolts", 1, 0.10);
		}
	}
Its based on your new code were I changed the triggers. Using missionScreenOpportunity also allows to skip the test for a missionscreen. The opportunity only fires when it is correct to show them.

One other thing is 'risky' in the original. The used images have names like 'end', 'firearms', 'vipers' etc. And because all images of all oxps go into one big image pool, there could be another oxp using those same names. Unique names are always better. e.g. by preceding them with 'blackjacks_'

EDIT:
and in one of the ship scripts I find:

Code: Select all

player.ship.awardCargo("Gold",20);
That is also deprecated some time ago. Should be:

Code: Select all

player.ship.manifest.gold += 20;

Re: BlackJack's Bullion mission addon

Posted: Fri Jun 08, 2012 3:15 pm
by Wildeblood
Eric Walch wrote:
Since 1.74 we have a better trigger for showing mission screens. I would propose the following:

Code: Select all

this.missionScreenOpportunity = function()
	{
	if(!player.ship.docked || galaxyNumber != 1) return;
	this.missionOffers();
	}
Its based on your new code were I changed the triggers. Using missionScreenOpportunity also allows to skip the test for a missionscreen. The opportunity only fires when it is correct to show them.
Done.
Eric Walch wrote:
One other thing is 'risky' in the original. The used images have names like 'end', 'firearms', 'vipers' etc. And because all images of all oxps go into one big image pool, there could be another oxp using those same names. Unique names are always better. e.g. by preceding them with 'blackjacks_'
I saw that, too. Already done.
Eric Walch wrote:
and in one of the ship scripts I find:

Code: Select all

player.ship.awardCargo("Gold",20);
That is also deprecated some time ago. Should be:

Code: Select all

player.ship.manifest.gold += 20;
Done. I fixed one of my pet peeve grammatical errors in the mission text, and changed the version numbers on the scripts to 1.2.7, and updated the wiki, so there's no confusion that-

this is indeed the most recent version: https://www.box.com/s/ed1c019b87b021ee54db

Re: BlackJacks bullion mission addon

Posted: Fri Jun 08, 2012 7:06 pm
by richard.a.p.smith
Cool - someone has asked me to go somewhere and kill someone else. In Oolite, just to be clear. Thanks! Rich.