BlackJacks bullion mission addon

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Talisker
Competent
Competent
Posts: 50
Joined: Mon Apr 23, 2012 1:47 pm
Location: London (Corporate State, Mostly Industrial, Tech Level 12)

Re: BlackJacks bullion mission addon

Post by Talisker »

Yoink!

Thank you :)
What were the skies like when you were young?

Currently: piloting the Boa Clipper Photic Sneeze II around Galaxy 2, bearing gifts of dubious legality but high entertainment value.
User avatar
maik
Wiki Wizard
Wiki Wizard
Posts: 2028
Joined: Wed Mar 10, 2010 12:30 pm
Location: Ljubljana, Slovenia (mainly industrial, feudal, TL12)

Re: BlackJacks bullion mission addon

Post 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.
richard.a.p.smith
Deadly
Deadly
Posts: 174
Joined: Mon Jun 07, 2010 9:03 am

Re: BlackJacks bullion mission addon

Post 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.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2446
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: BlackJacks bullion mission addon

Post 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. :(
Last edited by Wildeblood on Fri Jun 08, 2012 8:33 am, edited 1 time in total.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: BlackJacks bullion mission addon

Post by Thargoid »

It should be mission.runScreen, not mission.runMissionScreen. That's the source of the log errors above, just for clarity.
richard.a.p.smith
Deadly
Deadly
Posts: 174
Joined: Mon Jun 07, 2010 9:03 am

Re: BlackJacks bullion mission addon

Post 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.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: BlackJacks bullion mission addon

Post 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.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2446
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: BlackJacks bullion mission addon

Post 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?
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: BlackJacks bullion mission addon

Post by Commander McLane »

See here.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2446
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: BlackJacks bullion mission addon

Post by Wildeblood »

Commander McLane wrote:
See here.
I already looked there. It's too cryptic for me to ken.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: BlackJacks bullion mission addon

Post 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. :)
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2446
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: BlackJack's Bullion mission addon

Post 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
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: BlackJack's Bullion mission addon

Post 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;
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2446
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: BlackJack's Bullion mission addon

Post 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
richard.a.p.smith
Deadly
Deadly
Posts: 174
Joined: Mon Jun 07, 2010 9:03 am

Re: BlackJacks bullion mission addon

Post 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.
Post Reply