Maintenance upon demmand

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Maintenance upon demmand

Post by phkb »

It seemed appropriate to include the code in the actual OXP, so here it is, v0.3, with maintenance emails: MaintenanceTuneUp.oxz.

For the really keen, here's what I did:
First, the startupComplete event, I added this code:

Code: Select all

    if (worldScripts.GalCopAdminServices) {
        var ga = worldScripts.GalCopAdminServices;
        ga._purchase_ignore_equip.push("EQ_MAINTENANCE_TUNEUP"); // don't sent a normal purchase email for this one
    }
Essentially, this tells the GalCop Admin Services worldscript to ignore any purchase of the tune up equipment item. That's so we only get one email, not two.

Next, I added the following event handler

Code: Select all

this.guiScreenChanged = function(to, from) {
    if (to === "GUI_SCREEN_EQUIP_SHIP") {
        this._cost = player.ship.renovationCost;
    }
}
This grabs a copy of the players current renovation cost, so we can apply it to the email if required.

Finally, in the "playerBoughtEquipment" routine, I added this code:

Code: Select all

        if (worldScripts.GalCopAdminServices) {
            var ga = worldScripts.GalCopAdminServices;
            ga._maintCost = this._cost / 10;
            ga.$setupRepNames();
            ga.$sendMaintenanceEmail();
        }
All this does is applies the cost value we recorded earlier to GalCop Admin Servers, forces the rep names to be defined, and then sends the maintenance email.

Hope that makes sense!
User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 558
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: Maintenance upon demmand

Post by Nite Owl »

Geez - No wonder it would not work for me, left out almost every step. Thank you again for both the update and the scripting lesson, much appreciated.
Humor is the second most subjective thing on the planet

Brevity is the soul of wit and vulgarity is wit's downfall

Good Night and Good Luck - Read You Soon
User avatar
Cholmondely
Archivist
Archivist
Posts: 5381
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Maintenance upon demand

Post by Cholmondely »

This one is another little gem. It really should be on the Expansions Manager, in my humble opinion. Actually, it should be in the vanilla (non-strict) game!

But, the title is wrong. EquipmentRemoveItemColor - it seems not to affect "Remove Items", just "Sell Items".

- See here: http://wiki.alioth.net/index.php/File:F ... P%27d).png

Could I suggest: Equipment "Sell Item" Colour or F3 screen "Sell Item" Colour as more accurate - and more comprehensible?
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: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Maintenance upon demmand

Post by phkb »

Cholmondely wrote: Fri May 28, 2021 5:42 pm
it seems not to affect "Remove Items", just "Sell Items".
Well, it should have affected remove items.

*has peek under the hood*

Oh, right. HUD Selector doesn't have "remove" in the description for its remove item, only in the name.

*grumbles something about inconsistent OXP descriptions*
*takes hammer to code*
(sound of bashing and thumping, followed by breaking glass and the screech of a stray cat)

*wipes hands on overalls*

Right! Sorted! With a name change to aid the unwary.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Maintenance upon demmand

Post by phkb »

Although... this has been posted to the wrong thread, really...
User avatar
hiran
Theorethicist
Posts: 2410
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Maintenance upon demmand

Post by hiran »

phkb wrote: Sat May 29, 2021 7:10 am
Cholmondely wrote: Fri May 28, 2021 5:42 pm
it seems not to affect "Remove Items", just "Sell Items".
Well, it should have affected remove items.

*has peek under the hood*

Oh, right. HUD Selector doesn't have "remove" in the description for its remove item, only in the name.

*grumbles something about inconsistent OXP descriptions*
*takes hammer to code*
(sound of bashing and thumping, followed by breaking glass and the screech of a stray cat)

*wipes hands on overalls*

Right! Sorted! With a name change to aid the unwary.
:D :D :D
Sunshine - Moonlight - Good Times - Oolite
User avatar
Cholmondely
Archivist
Archivist
Posts: 5381
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Maintenance upon demand

Post by Cholmondely »

phkb wrote: Sat May 29, 2021 7:18 am
Although... this has been posted to the wrong thread, really...
I somehow posted Maintenance and Equipment Remove Item Colour together.

Apologies. Old age, galloping senility, dying brain cells, ... They need Maintenance on demmmand!
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: 5381
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Maintenance upon demand

Post by Cholmondely »

phkb wrote: Sat May 29, 2021 7:10 am
(sound of bashing and thumping, followed by breaking glass and the screech of a stray cat)
Wiki page now up: https://wiki.alioth.net/index.php/Maintenance_Tune_Up
Last edited by Cholmondely on Fri Sep 30, 2022 11:28 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?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Maintenance upon demmand

Post by phkb »

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

Re: Maintenance upon demand

Post by Cholmondely »

phkb wrote: Fri Sep 30, 2022 10:37 am
Thanks!
My pleasure. Great pleasure, in fact. Thank you for all that you do for the rest of us...
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