Galactic News Network - Personalised news

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
ffutures
---- E L I T E ----
---- E L I T E ----
Posts: 2172
Joined: Wed Dec 04, 2013 12:34 pm
Location: London, UK
Contact:

Galactic News Network - Personalised news

Post by ffutures »

Something that might be fun for the Galactic News Network - maybe an occasional story that mentions the captain or ship by name, e.g.

"In local news, notorious outlaws xxxx and yyyy were today captured by the Boa Cruiser Kiki's Delivery Service under Captain Rowland (Elite)."

"The Anaconda 'Rust Bucket' was today destroyed by a pirate attack; fortunately its captain was rescued by the Boa Cruiser Kiki's Delivery Service under Captain Rowland (Elite)."

"An urgent GalCop announcement - Be on the lookout for Boa Cruiser Kiki's Delivery Service, which has been declared fugitive. Notorious Captain Rowland (Elite) is quoted as saying 'It wasn't me, it was a one-armed space pirate!' before fleeing the scene"

Obviously you wouldn't want to do this too often, but just once in a while might be fun.
User avatar
mossfoot
---- E L I T E ----
---- E L I T E ----
Posts: 827
Joined: Fri May 30, 2014 4:07 pm
Contact:

Re: Galactic News Network - Personalised news

Post by mossfoot »

ffutures wrote:
Something that might be fun for the Galactic News Network - maybe an occasional story that mentions the captain or ship by name, e.g.

"In local news, notorious outlaws xxxx and yyyy were today captured by the Boa Cruiser Kiki's Delivery Service under Captain Rowland (Elite)."

"The Anaconda 'Rust Bucket' was today destroyed by a pirate attack; fortunately its captain was rescued by the Boa Cruiser Kiki's Delivery Service under Captain Rowland (Elite)."

"An urgent GalCop announcement - Be on the lookout for Boa Cruiser Kiki's Delivery Service, which has been declared fugitive. Notorious Captain Rowland (Elite) is quoted as saying 'It wasn't me, it was a one-armed space pirate!' before fleeing the scene"

Obviously you wouldn't want to do this too often, but just once in a while might be fun.

I like it!
--
Image
Pilot: Mossfoot - Ship ID: Viaticus Rex (Cobra MKII)
Rank: Competent - Status: Clean

http://www.noahchinnbooks.com/
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Galactic News Network - Personalised news

Post by Switeck »

Fame and Infamy -- because you want to be remembered as more than just a number.
Return to a system, regain most of your old bounty that you "acquired" there.
Be a hero of a system, maybe there's some minor benefits?
User avatar
Tricky
---- E L I T E ----
---- E L I T E ----
Posts: 821
Joined: Sun May 13, 2012 11:12 pm
Location: Bradford, UK. (Anarchic)

Re: Galactic News Network - Personalised news

Post by Tricky »

A sample piece of code that can be used in your worldscript. Obviously more work needs to be done to use it.

Code: Select all

    this.startUp() = function() {
        /* Set true for some logging. */
        this.$logging = false;

        if (missionVariables.your_oxp_snoopers_news) {
            /* Retrieve the snoopers news variable and parse it. */
            this.$newsForSnoopers = JSON.parse(missionVariables.your_oxp_snoopers_news);
        } else {
            this.$newsForSnoopers = {};
        }
    };

    /* NAME
     *   playerWillSaveGame
     *
     * FUNCTION
     *   Player is about to save the game.
     */
    this.playerWillSaveGame = function () {
        /* Stringify the snoopers news variable and store it. */
        missionVariables.your_oxp_snoopers_news = JSON.stringify(this.$newsForSnoopers);
    };

    /* NAME
     *   $sendNewsToSnoopers
     *
     * FUNCTION
     *   Send news to Snoopers (if available).
     *
     * INPUTS
     *   message - news to show
     *   agency - agency to use (optional)
     */
    this.$sendNewsToSnoopers = function (message, agency) {
        var news = {},
        result;

        if (!worldScripts.snoopers) {
            /* Snoopers not installed. */
            return;
        }

        if (!agency || typeof agency !== "number") {
            /* Random agency. [1, 2 or 3] */
            agency = Math.floor(Math.random() * 3.0) + 1;
        }

        news.ID = this.name;
        news.Message = message;
        news.Agency = agency;
        /* Snoopers Documentation on the wiki has a list describing what the result number means.
         * http://wiki.alioth.net/index.php/Snoopers_Doc#Errorcodes
         */
        result = worldScripts.snoopers.insertNews(news);

        if (result < 0) {
            /* Save for later. Snoopers only allows one news item at a time. */
            this.$newsForSnoopers.push(news);

            if (this.$logging) {
                log(this.name, "$sendNewsToSnoopers::Saving news for later.\n" +
                    "* ID: '" + this.name + "'\n" +
                    "* Message: '" + message + "'\n" +
                    "* Agency: " + agency + "\n" +
                    "* result: " + result);
        } else if (result > 0) {
            /* Problem. */
            log(this.name, "$sendNewsToSnoopers::Problem with news.\n" +
                "* ID: '" + this.name + "'\n" +
                "* Message: '" + message + "'\n" +
                "* Agency: " + agency + "\n" +
                "* result: " + result);
        } else {
            /* News inserted. */
            if (this.$logging) {
                log(this.name, "$sendNewsToSnoopers::News inserted.\n" +
                    "* ID: '" + this.name + "'\n" +
                    "* Message: '" + message + "'\n" +
                    "* Agency: " + agency + "\n" +
                    "* result: " + result);
            }
        }
    };

    /* NAME
     *   newsDisplayed
     *
     * FUNCTION
     *   Called by Snoopers when the news item has been displayed.
     *   Check for any more news available and send it.
     */
    this.newsDisplayed = function () {
        var news = this.$newsForSnoopers.shift();

        if (news) {
            /* More news available. Send it to Snoopers. */
            this.$sendNewsToSnoopers(news.Message, news.Agency);
        }
    };
User avatar
ffutures
---- E L I T E ----
---- E L I T E ----
Posts: 2172
Joined: Wed Dec 04, 2013 12:34 pm
Location: London, UK
Contact:

Re: Galactic News Network - Personalised news

Post by ffutures »

So far as I can understand it that looks good, but I wouldn't like to try to make it work, I'm rubbish at that sort of thing. A few suggestions on things that might trigger a report occasionally - but not every time they happen:

Capture 2 or more pirates in a single flight
Rescue someone
Go from clean to fugitive (offender is a bit too common, I think)
Set a long-distance "record" for continuous flights without docking (could be triggered in the same way as Witchspace Sickness)
And of course various crimes such as Q-bombing clean ships or a station.
User avatar
mossfoot
---- E L I T E ----
---- E L I T E ----
Posts: 827
Joined: Fri May 30, 2014 4:07 pm
Contact:

Re: Galactic News Network - Personalised news

Post by mossfoot »

ffutures wrote:
So far as I can understand it that looks good, but I wouldn't like to try to make it work, I'm rubbish at that sort of thing. A few suggestions on things that might trigger a report occasionally - but not every time they happen:

Capture 2 or more pirates in a single flight
Rescue someone
Go from clean to fugitive (offender is a bit too common, I think)
Set a long-distance "record" for continuous flights without docking (could be triggered in the same way as Witchspace Sickness)
And of course various crimes such as Q-bombing clean ships or a station.
Certain things should happen every time, though (or at least more frequently). For example, capturing a pirate worth 500 credits or more.

And Q-bombing a station would always be news worthy.
--
Image
Pilot: Mossfoot - Ship ID: Viaticus Rex (Cobra MKII)
Rank: Competent - Status: Clean

http://www.noahchinnbooks.com/
Neelix
---- E L I T E ----
---- E L I T E ----
Posts: 288
Joined: Sat May 31, 2014 9:02 pm
Location: Melbourne, Australia

Re: Galactic News Network - Personalised news

Post by Neelix »

mossfoot wrote:
And Q-bombing a station would always be news worthy.
Not that that actually accomplishes much... I was messing around with the debug console and triggered a cascade explosion in a ship which had just launched. When it was all over all the local traffic and the nav beacon were gone, but the main station was still spinning in place, completely unscathed. :-)


- Neelix
Talaxian Enterprises: [wiki]Vacuum Pump[/wiki] [wiki]Waypoint Here[/wiki]
User avatar
mossfoot
---- E L I T E ----
---- E L I T E ----
Posts: 827
Joined: Fri May 30, 2014 4:07 pm
Contact:

Re: Galactic News Network - Personalised news

Post by mossfoot »

Oh, of course. Indestructible. Forgot ;)
--
Image
Pilot: Mossfoot - Ship ID: Viaticus Rex (Cobra MKII)
Rank: Competent - Status: Clean

http://www.noahchinnbooks.com/
User avatar
ffutures
---- E L I T E ----
---- E L I T E ----
Posts: 2172
Joined: Wed Dec 04, 2013 12:34 pm
Location: London, UK
Contact:

Re: Galactic News Network - Personalised news

Post by ffutures »

Unless hit by a giant meteor, of course...
Post Reply