Page 1 of 1

GNN adding custom/external backgrounds

Posted: Fri Apr 05, 2024 8:55 am
by Zafrusteria
I have created some generic backgrounds for GNN, but am having random results when trying to use them.

In my oxp in this.startUpComplete() i have

Code: Select all

this.$GNN._addExtImages([["ShrewsRights_GNN_11.png", "ShrewsRights_GNN_12.png", "ShrewsRights_GNN_13.png"], ["ShrewsRights_GNN_21.png", "ShrewsRights_GNN_22.png", "ShrewsRights_GNN_23.png"], ["ShrewsRights_GNN_31.png", "ShrewsRights_GNN_32.png", "ShrewsRights_GNN_33.png"], ["ShrewsRights_GNN_41.png", "ShrewsRights_GNN_42.png", "ShrewsRights_GNN_43.png"]], this.name);
This should register three images for each on the four news channels.

In the debug console after running and while docked I can see them as being registered with:

Code: Select all

worldScripts.GNN.$doop.expImages
and

Code: Select all

worldScripts.GNN.$doop.expPrefixes
Gives this the expected result of the array of arrays and

Code: Select all

["ShrewsRights"]
Then again from the debug console I can use the following to show a new article, that will "sometimes" show the correct background image and "sometimes" just pick one at random. The image displayed seems to be random and also use the stock images from the oxp. :shock:

Code: Select all

>worldScripts.GNN._insertNews({ID: "ShrewsRights", Message: "Simple test text to keep it simple", Agency: 3, Priority: 1, Pic: {name: "ShrewsRights_GNN_32.png", height: 512,}, PicExt: "ShrewsRights"})
In the JS script I and calling something like:

Code: Select all

let news.params = {ShrewsRights_what_was_attacked: "Some big thing I attacked"};
this.$GNN._insertNews({
            ID:       this.name,
            Message:  expandMissionText("ShrewsRights_news" + this.$missionNewsCount, news.params),
            Agency:   news.agency,
            Priority: 1,
            Pic: {name: "ShrewsRights_GNN_" + news.agency + ~~(Math.random() * 3 + 1) + ".png", height: 512},
            PicExt: this.name, });
Any ideas?