Digebiti.oxp (Development Thread)

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

Moderators: another_commander, winston

User avatar
Cholmondely
Archivist
Archivist
Posts: 5009
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Digebiti.oxp (Development Thread)

Post by Cholmondely »

Links for what I hope to do:
Ideas for making Galaxy 1 more interesting
Ideas for adding oomph to Lave.oxp

____________________________________________________________________________________________________________

There are currently (29th April 2022) 3 topics in this thread:
1) Diplomancy.OXP: how to grant Digebitian subjecthood (no "citizens" (ptoo, ptoo) in Feudal States)
2) Library.OXP: how to insert extra information pages in the P.A.D.
3) Commodities: how to change the legality of slaves/price of slaves for Digebiti
____________________________________________________________________________________________________________
re: Diplomancy

Creating citizenship for Digebiti
phkb wrote: Fri Dec 10, 2021 1:34 am
OK, here's a link to an OXZ that I've now tested and confirmed it works as intended: RexebeCitizen.oxz.
So from Phkb's RexebeCitizen.oxp (second version posted above) I created DigebitiSubject.oxp - but I keep on getting several hundred credits added to my bank account. What am I doing wrong?

Code: Select all

"use strict";
this.name = "DigebitiSubject";
this.author = "phkb";
this.copyright  = "2021 phkb";
this.description = "Makes sure player has subjecthood in Digebiti.";
this.licence = "CC BY-NC-SA 4.0";

this.startUp = function() {
    if (worldScripts.DayDiplomacy_000_Engine) {
        worldScripts.DayDiplomacy_000_Engine.$subscribe(this.name);
    }
    delete this.startUp;
}

this._startUp = function() {
    let c = worldScripts.DayDiplomacy_060_Citizenships;
    if (!c.$hasPlayerCitizenship(0, 96)) {
        let s = System.infoForSystem(0, 96); // gal + id of Digebiti
        let price = c.$getCitizenshipPrice(s);
        // make sure we have enough credits to buy the subjecthood
        player.credits += price;
        c._buyCitizenship(0, 96);
        player.consoleMessage("You have been awarded subjecthood in " + System.systemNameForID(96), 5);
    }
}
Last edited by Cholmondely on Fri May 13, 2022 8:26 am, edited 4 times in total.
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

Re: Digebiti.oxp (WIP)

Post by montana05 »

Cholmondely wrote: Sat Apr 23, 2022 9:59 pm
So from Phkb's RexebeCitizen.oxp (second version posted above) I created DigebitiSubject.oxp - but I keep on getting several hundred credits added to my bank account. What am I doing wrong?
player.credits += price; could do that :wink:
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5009
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Digebiti.oxp (WIP)

Post by Cholmondely »

montana05 wrote: Sat Apr 23, 2022 11:34 pm
Cholmondely wrote: Sat Apr 23, 2022 9:59 pm
So from Phkb's RexebeCitizen.oxp (second version posted above) I created DigebitiSubject.oxp - but I keep on getting several hundred credits added to my bank account. What am I doing wrong?
player.credits += price; could do that :wink:
Umm... what does it actually do?
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

Re: Digebiti.oxp (WIP)

Post by montana05 »

Cholmondely wrote: Sat Apr 23, 2022 11:57 pm
montana05 wrote: Sat Apr 23, 2022 11:34 pm
Cholmondely wrote: Sat Apr 23, 2022 9:59 pm
So from Phkb's RexebeCitizen.oxp (second version posted above) I created DigebitiSubject.oxp - but I keep on getting several hundred credits added to my bank account. What am I doing wrong?
player.credits += price; could do that :wink:
Umm... what does it actually do?
This statement adds the price of the citizenship of Digebiti to the player's account.
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5009
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Digebiti.oxp (WIP)

Post by Cholmondely »

When I run the .oxp I get the subjecthood - but I also get the extra money.
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

Re: Digebiti.oxp (WIP)

Post by montana05 »

Cholmondely wrote: Sun Apr 24, 2022 12:11 am
When I run the .oxp I get the subjecthood - but I also get the extra money.
Yes you do, as the remark notes this line is only there to make sure you got enough money for the purchase, its for test reasons only:

// make sure we have enough credits to buy the subjecthood
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5009
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Digebiti.oxp (WIP)

Post by Cholmondely »

So...

if I add in the line

Code: Select all

        player.credits = 100;
then the credit balance gets reset to 100₢

This is not ideal as if one chooses the "Easy start" option under "Start New Commander", one now starts with 100₢ rather than 1,000₢ as one should.

Is there a better solution?





Next Question.

Library.oxp

Adding entries to the PAD on the F4 screen: Lib_PAD wiki page

I wish to include Digebiti under my "Origin" on the PAD "Persons" page

I wish to include a page for Prince-Elector Rupert XIX on the PAD "Persons" page

I wish to include a page for Digebiti on the PAD "Systems" page

NAME: Digebiti G1
INFO: Home Planet
Located just to the south of GalCenter G1.



How do I do this?
Last edited by Cholmondely on Fri Apr 29, 2022 6:16 pm, edited 1 time in total.
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4656
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Digebiti.oxp (WIP)

Post by phkb »

Cholmondely wrote: Sun Apr 24, 2022 7:57 am
Is there a better solution?
I suspect something is failing inside Diplomacy, not in code, but in the logic. The logic of the tweak OXP is pretty simple:

1. Check to see if we have citizenship in the targeted system. If we do, don't do anything.
2. If we don't have citizenship, get the price of what the citizenship would cost.
3. Add those credits to the player's account, so that during the process of buying the citizenship, the net effect is zero. (eg if the citizenship costs, 100cr, add 100cr to the players account, so that in the next step there will be enough credits to complete the purchase).
4. Purchase the citizenship in the targeted system.
5. Display a console message.

If you keep getting credits added to your account, that means that step 4 is failing (ie the citizenship is not purchased, so credits are not being removed). It would also mean that every time you load your saved game, you get those credits added because at step 1, the answer would be no every time.

If you *do* get citizenship, but keep getting credits, then something else is at play. I'll have to do some tests to try and narrow down what.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4656
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Digebiti.oxp (WIP)

Post by phkb »

Cholmondely wrote: Sun Apr 24, 2022 7:57 am
I wish to include a page for Digebiti on the PAD "Systems" page
Using the debug console, enter:

Code: Select all

worldScripts.Lib_PAD._addPageInCategory("SYSTEMS.Digebiti G1", {name:"Digebiti G1", info:["Home planet","Located just to the south of GalCenter G1"]})
Cholmondely wrote: Sun Apr 24, 2022 7:57 am
I wish to include a page for Prince-Elector Rupert XIX on the PAD "Persons" page
Using the debug console, enter:

Code: Select all

worldScripts.Lib_PAD._addPageInCategory("PERSONS.Prince-Elector Rupert XIX", {name: "Prince-Elector Rupert XIX", origin:"Digebiti G1",species:"Human colonial",gender:"Male",age:41,ship:"None",rank:"Prince",t0:0,t1:"lib_user.png",t2:0})
Note: if you have an image to use for the person, you can change "lib_user.png" to whatever that file is (it would have to be in the "Textures" folder of an OXP, though).
Cholmondely wrote: Sun Apr 24, 2022 7:57 am
I wish to include Digebiti under my "Origin" on the PAD "Persons" page
Updating your information through the "Player data" menu will update the information on the "Persons" page.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5009
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Digebiti.oxp (WIP)

Post by Cholmondely »

phkb wrote: Tue Apr 26, 2022 5:12 am
Cholmondely wrote: Sun Apr 24, 2022 7:57 am
Is there a better solution?
I suspect something is failing inside Diplomacy, not in code, but in the logic. The logic of the tweak OXP is pretty simple:

1. Check to see if we have citizenship in the targeted system. If we do, don't do anything.
2. If we don't have citizenship, get the price of what the citizenship would cost.
3. Add those credits to the player's account, so that during the process of buying the citizenship, the net effect is zero. (eg if the citizenship costs, 100cr, add 100cr to the players account, so that in the next step there will be enough credits to complete the purchase).
4. Purchase the citizenship in the targeted system.
5. Display a console message.

If you keep getting credits added to your account, that means that step 4 is failing (ie the citizenship is not purchased, so credits are not being removed). It would also mean that every time you load your saved game, you get those credits added because at step 1, the answer would be no every time.

If you *do* get citizenship, but keep getting credits, then something else is at play. I'll have to do some tests to try and narrow down what.
Thanks for looking at this. Yes, I do get subjecthood, and get the credits too (I usually give them away in Life in the Frontier's Art Gallery - they do not come back in subsequent reloads of my save).

Image
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
Cholmondely
Archivist
Archivist
Posts: 5009
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Digebiti.oxp (WIP)

Post by Cholmondely »

F8 screen: Changing the status of slaves as a commodity for Digebiti
Switeck wrote: Wed Apr 27, 2022 8:44 am
Code example for you:
(I don't know Digebiti's system number...so substitute its number for the 186 guess.

Code: Select all

this.shipExitedWitchspace = function()
{
	if(galaxyNumber == 2 && system.ID ==186) {
		var commodity = 3; // 3 = slaves?
		system.mainStation.market[commodity].quantity = 0;
		system.mainStation.market[commodity].price = 0;
	}
}
Switeck: thank you for this. I tried it with the Digebiti galaxyNumber (0 96 - but also 1 96 just in case!) and got nothing. No error messages in latest log, but no change in the markets either when I arrived at Digebiti from Geerra.

I tried it as a script.js in a "Config" folder created inside the AddOns folder (Cody's tip)

Code: Select all

"use strict";
this.name	= "Digebiti.oxp";
this.author	= "Cholmondeley";
this.copyright	= "2022 Cholmondeley (but it's really Switeck's!)";
this.description= "Digebiti.oxp";
this.licence	= "CC BY-NC-SA 4.0";

this.shipExitedWitchspace = function()
{
	if(galaxyNumber == 0 && system.ID ==96) {
		var commodity = 3; // 3 = slaves?
		system.mainStation.market[commodity].quantity = 0;
		system.mainStation.market[commodity].price = 0;
	}
}
What am I doing wrong? Do I need to sacrifice another police-person to the Witchspace Lobster using the putrid purple pillory of pusillanimous protuberances?

Reference: Trade-goods.plist
Last edited by Cholmondely on Fri Apr 29, 2022 6:18 pm, edited 1 time in total.
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

Re: Digebiti.oxp (WIP)

Post by montana05 »

Cholmondely wrote: Fri Apr 29, 2022 8:48 am
What am I doing wrong?
Did you define the script as a world-script ?
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5009
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Digebiti.oxp (WIP)

Post by Cholmondely »

montana05 wrote: Fri Apr 29, 2022 9:08 am
Cholmondely wrote: Fri Apr 29, 2022 8:48 am
What am I doing wrong?
Did you define the script as a world-script ?
No, I didn't. But the other scripts I've bunged in that config folder in the path worked fine, as does Phkb's PAD add-on script.js
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

Re: Digebiti.oxp (WIP)

Post by montana05 »

Cholmondely wrote: Fri Apr 29, 2022 10:26 am
montana05 wrote: Fri Apr 29, 2022 9:08 am
Cholmondely wrote: Fri Apr 29, 2022 8:48 am
What am I doing wrong?
Did you define the script as a world-script ?
No, I didn't. But the other scripts I've bunged in that config folder in the path worked fine, as does Phkb's PAD add-on script.js
Sorry, my bad. As soon as you drop the script in a config folder, it becomes automatically a world-script. The past days just too hot to think straight without an aircon. :roll:
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5009
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Digebiti.oxp (WIP)

Post by Cholmondely »

montana05 wrote: Fri Apr 29, 2022 11:00 am
Cholmondely wrote: Fri Apr 29, 2022 10:26 am
montana05 wrote: Fri Apr 29, 2022 9:08 am


Did you define the script as a world-script ?
No, I didn't. But the other scripts I've bunged in that config folder in the path worked fine, as does Phkb's PAD add-on script.js
Sorry, my bad. As soon as you drop the script in a config folder, it becomes automatically a world-script. The past days just too hot to think straight without an aircon. :roll:
It's starting to warm up over here - we had several lovely days, but are now in a chillier snap. Spring! The bluebells are out!

Edited to add: Whilst my programming skills are rather naff, Massively Locked might be adding some of this into the new version of "Life in the Frontier" just for Digebiti


Image
Last edited by Cholmondely on Mon Dec 12, 2022 11:18 am, edited 1 time in total.
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
Post Reply