Page 5 of 5

Re: [RELEASE] Jaguar Company 2.5r29

Posted: Mon Sep 04, 2023 6:10 pm
by phkb
The changes were fairly small, because there weren't many format changes between Snoopers and GNN:

Code: Select all

    /* 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,
        index;

        if (!worldScripts.snoopers && !worldScripts.GNN) {
            /* 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;
        if (worldScripts.GNN) {
        	result = worldScripts.GNN.insertNews(news);
        } else {
        	result = worldScripts.snoopers.insertNews(news);
        }
        index = result + 5;

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

            if (this.$logging && this.$logExtra) {
                log(this.name, "$sendNewsToSnoopers::Saving news for later.\n" +
                    "* ID: '" + this.name + "'\n" +
                    "* Message: '" + message + "'\n" +
                    "* Agency: " + agency + "\n" +
                    "* result: " + result + (result >= -5 ? ") " + p_const.snoopersErrorCodes[index] : ""));
            }
        } 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 + (result <= 30 ? ") " + p_const.snoopersErrorCodes[index] : ""));
        } else {
            /* News inserted. */
            if (this.$logging && this.$logExtra) {
                log(this.name, "$sendNewsToSnoopers::News inserted.\n" +
                    "* ID: '" + this.name + "'\n" +
                    "* Message: '" + message + "'\n" +
                    "* Agency: " + agency + "\n" +
                    "* result: " + result + ") " + p_const.snoopersErrorCodes[index]);
            }
        }
    };

    /* 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.$playerVar.newsForSnoopers.shift();

        if (news) {
            /* More news available. Send it to Snoopers. */
            this.$sendNewsToSnoopers(news.Message, news.Agency);
        }
    };
}.bind(this)());
The text for the news flashes is in descriptions.plist: keys are "jaguar_company_help_news", "jaguar_company_help_news_quote", "jaguar_company_rescue_news", "jaguar_company_rescue_multiple_news", and "jaguar_company_rescue_news_quote".

I don't know if it helps, but here's the version I was working on (I think with dybal if memory serves): Jaguar_Company_2.6.0.zip

Re: [RELEASE] Jaguar Company 2.5r29

Posted: Mon Sep 04, 2023 7:18 pm
by Cholmondely
phkb wrote: Mon Sep 04, 2023 6:10 pm
The changes were fairly small, because there weren't many format changes between Snoopers and GNN:

Code: Select all

    /* 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,
        index;

        if (!worldScripts.snoopers && !worldScripts.GNN) {
            /* 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;
        if (worldScripts.GNN) {
        	result = worldScripts.GNN.insertNews(news);
        } else {
        	result = worldScripts.snoopers.insertNews(news);
        }
        index = result + 5;

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

            if (this.$logging && this.$logExtra) {
                log(this.name, "$sendNewsToSnoopers::Saving news for later.\n" +
                    "* ID: '" + this.name + "'\n" +
                    "* Message: '" + message + "'\n" +
                    "* Agency: " + agency + "\n" +
                    "* result: " + result + (result >= -5 ? ") " + p_const.snoopersErrorCodes[index] : ""));
            }
        } 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 + (result <= 30 ? ") " + p_const.snoopersErrorCodes[index] : ""));
        } else {
            /* News inserted. */
            if (this.$logging && this.$logExtra) {
                log(this.name, "$sendNewsToSnoopers::News inserted.\n" +
                    "* ID: '" + this.name + "'\n" +
                    "* Message: '" + message + "'\n" +
                    "* Agency: " + agency + "\n" +
                    "* result: " + result + ") " + p_const.snoopersErrorCodes[index]);
            }
        }
    };

    /* 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.$playerVar.newsForSnoopers.shift();

        if (news) {
            /* More news available. Send it to Snoopers. */
            this.$sendNewsToSnoopers(news.Message, news.Agency);
        }
    };
}.bind(this)());
The text for the news flashes is in descriptions.plist: keys are "jaguar_company_help_news", "jaguar_company_help_news_quote", "jaguar_company_rescue_news", "jaguar_company_rescue_multiple_news", and "jaguar_company_rescue_news_quote".

I don't know if it helps, but here's the version I was working on (I think with dybal if memory serves): Jaguar_Company_2.6.0.zip
Thanks for both this and the link.

You were working on this with Milo:
Milo wrote: Fri Jul 10, 2020 2:30 pm
phkb and I are collaborating on an update for this OXP ...

Re: [RELEASE] Jaguar Company 2.5r29

Posted: Mon Sep 04, 2023 8:38 pm
by phkb
Ah! Memory error. Must need some upgrades.

Re: [RELEASE] Jaguar Company 2.5r29

Posted: Tue Sep 05, 2023 9:27 am
by Cholmondely
phkb wrote: Mon Sep 04, 2023 8:38 pm
Ah! Memory error. Must need some upgrades.
Added at https://wiki.alioth.net/index.php/Snoop ... ers_to_GNN

Your changes are in red at the bottom.

Thank you!!

Re: [RELEASE] Jaguar Company 2.5r29

Posted: Tue Sep 05, 2023 11:58 am
by Cholmondely
phkb wrote: Mon Sep 04, 2023 8:38 pm
Ah!
Sorry! Me again!!

Does Jaguar Company add in bases to every single anarchy/feudal/multi-gov? Or just some of them?

Re: [RELEASE] Jaguar Company 2.5r29

Posted: Tue Sep 05, 2023 9:14 pm
by phkb
Cholmondely wrote: Tue Sep 05, 2023 11:58 am
Does Jaguar Company add in bases to every single anarchy/feudal/multi-gov? Or just some of them?
Some of them. Based on what I can see in the code, there's a 37.5% chance in an anarchy, a 25% chance in a feudal, and a 12.5% chance in a multi-gov. But I think the randomness of the choice has been set so that it will be the same systems in each galaxy, although I haven't confirmed that.

Re: [RELEASE] Jaguar Company 2.5r29

Posted: Tue Sep 05, 2023 10:34 pm
by Cholmondely
phkb wrote: Tue Sep 05, 2023 9:14 pm
Cholmondely wrote: Tue Sep 05, 2023 11:58 am
Does Jaguar Company add in bases to every single anarchy/feudal/multi-gov? Or just some of them?
Some of them. Based on what I can see in the code, there's a 37.5% chance in an anarchy, a 25% chance in a feudal, and a 12.5% chance in a multi-gov. But I think the randomness of the choice has been set so that it will be the same systems in each galaxy, although I haven't confirmed that.
Thanks - and same systems makes sense if true...