Information desired!

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

Moderators: winston, another_commander

DGill
---- E L I T E ----
---- E L I T E ----
Posts: 292
Joined: Thu Jan 01, 2009 9:45 am

Re: Information desired!

Post by DGill »

Cholmondely wrote: Tue Jul 23, 2024 11:40 pm

But what I want to achieve is to have the switch in AI made as a response to the BCC. Which presumably requires different coding.

If you figure it out please let me know - I've been trying without success to do the same thing to control the actions of a number of wingmen (Lance Fournie).

I followed the BCC example given on https://wiki.alioth.net/index.php/BroadcastComms_MFD, which I coded as:


this.shipWillLaunchFromStation = function() {
this.broadcastcontrol();
}

this.broadcastcontrol = function() {

var w = worldScripts.BroadcastCommsMFD;
w.$createMessage({
messageName:this.name + "myMessage1",
callbackFunction:this.$broadcastCallback.bind(this),
displayText:"Evacuation message",
messageText:"Attention all ships. Please evacuate the area and move to a safe distance.",
transmissionType:"broadcast",
deleteOnTransmit:true,
delayCallback:4});
}

this.$broadcastCallback = function () {
this.ship.switchAI("feudal-attack5AI.plist");
};

The code is fine for in as far as getting BCC to broadcast the message but I haven't figured out how to get the ships receiving the broadcast to switch to my desired AI, i.e. the "feudal-attack5AI.plist" in the BCC procedure call. I presume I need some event handler command that the wingman ships (i.e. this.ship) can react to.

p.s. I needed to change some stuff: The Wiki page example under the 'dark side' heading has a typo: distplayText:"Evacuation message",
I had to change this to: displayText:"Evacuation message",

Hope you eventually get the scripting to work - I'm stuck at the moment.


p.p.s. Got it working with:

this.$broadcastCallback = function (){

this.ship = player.ship.target;
this.ship.switchAI("feudal-attack5AI.plist");

};

The ship I target now switches its AI to feudal-attack5AI.plist

However, I don't want to target each wingman individually to send instructions such as 'follow me', 'attack my aggressor', etc
Need to figure out how to broadcast a message so that all wingmen respond.
Last edited by DGill on Thu Jul 25, 2024 3:48 pm, edited 2 times in total.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2404
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

Re: Information desired!

Post by Wildeblood »

DGill wrote: Wed Jul 24, 2024 10:01 am
p.p.s. Got it working with:

this.$broadcastCallback = function (){

this.ship = player.ship.target;
this.ship.switchAI("feudal-attack5AI.plist");

};

The ship I target now switches its AI to feudal-attack5AI.plist
Just:

Code: Select all

    this.$broadcastCallback = function () {
	player.ship.target.switchAI("feudal-attack5AI.plist");
    }; 
- would accomplish the same result, but it's still not right. As you say:
DGill wrote: Wed Jul 24, 2024 10:01 am
However, I don't want to target each wingman individually to send instructions such as 'follow me', 'attack my aggressor', etc
Need to figure out how to broadcast a message so that all wingmen respond.
"Would somebody stop that bloody music!"
DGill
---- E L I T E ----
---- E L I T E ----
Posts: 292
Joined: Thu Jan 01, 2009 9:45 am

Re: Information desired!

Post by DGill »

Wildeblood wrote: Wed Jul 24, 2024 1:27 pm

Code: Select all

    this.$broadcastCallback = function () {
	player.ship.target.switchAI("feudal-attack5AI.plist");
    }; 
Thanks, good to know.
DGill
---- E L I T E ----
---- E L I T E ----
Posts: 292
Joined: Thu Jan 01, 2009 9:45 am

Re: Information desired!

Post by DGill »

Ok, got it to work as I wanted - needed to use system.shipsWithRole not player.ship.target
User avatar
Cholmondely
Archivist
Archivist
Posts: 5251
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Information desired!

Post by Cholmondely »

Alas, still no joy.

The Refugee Adders still just sit there, contemplating their navels and waltzing around themselves desultorily in ever-decreasing circles...

xpatAI.plist

Code: Select all

{
    GLOBAL = {
    ENTER = "setStateTo: CLOSE_WITH_PLAYER";
};

"CLOSE_WITH_PLAYER" = {
	ENTER = ("scanForNearestShipWithRole: player");
	"TARGET_FOUND" = (setTargetToFoundTarget, setDestinationToTarget, "setDesiredRangeTo: 1000.0", checkCourseToDestination); // Old-style plist parser: missing semicolon in dictionary on line 12.
	"COURSE_OK" = ("setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
	"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
	"ATTACKED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
	"ATTACKER_MISSED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
	"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, "setStateTo: ATTACK_SHIP");
	"DESIRED_RANGE_ACHIEVED" = ("setStateTo: MOVE_AWAY_FROM_PLAYER");
	"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
  // UPDATE = (performFlyToRangeFromDestination);
  UPDATE = ("scanForNearestShipWithRole: player", performFlyToRangeFromDestination);

};

"MOVE_AWAY_FROM_PLAYER" = {
	ENTER = ("scanForNearestShipWithRole: player");
	"TARGET_FOUND" = (setTargetToFoundTarget, setDestinationToTarget, "setDesiredRangeTo: 1000.0", checkCourseToDestination);
	"COURSE_OK" = ("setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
	"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
	"ATTACKED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
	"ATTACKER_MISSED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
	"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, "setStateTo: ATTACK_SHIP");
	"DESIRED_RANGE_ACHIEVED" = ("setStateTo: CLOSE_WITH_PLAYER");
	"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
	//UPDATE = (performFlyToRangeFromDestination);
  UPDATE = ("scanForNearestShipWithRole: player", performFlyToRangeFromDestination);

};


"ATTACK_SHIP" = {
	ENTER = (setTargetToPrimaryAggressor, performAttack);
	"FRIENDLY_FIRE" = ("setStateTo: BREAK_OFF");
	"ATTACKED" = (setTargetToPrimaryAggressor, performAttack);
	"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToFoundTarget, performAttack);
	"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
	"TARGET_DESTROYED" = (performIdle, "setStateTo: DECIDE_ROUTE");
	"TARGET_LOST" = (performIdle, "setStateTo: DECIDE_ROUTE");
	"NO_TARGET" = (performIdle, "setStateTo: DECIDE_ROUTE");
	"CASCADE_WEAPON_DETECTED" = ("setAITo: fleeQMineAI.plist");
	"FRUSTRATED" = (performAttack);
};
}
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: 4809
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Information desired!

Post by phkb »

Apologies for the late reply - I'm catching up of a few older posts.
Wildeblood wrote: Thu Jul 11, 2024 8:10 am
In reality, it's 11 OXPs in one, each having a different effect on NPCs, and the player selects which of those game-play alterations he wants by "transmitting a message". (Is this a fair comment, phkb, or am I over-simplifying too much?)
It would be one way of looking at it. It has different responses based on the message you transmit, so yeah, you could potentially divide it up into 11 separate mini-"OXPs".
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4809
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Information desired!

Post by phkb »

Cholmondely wrote: Thu Jul 11, 2024 6:11 am
The problem is not understanding Java script - I utterly fail to understand any of what goes on. I had a look (3 years ago) in the innards of what is now "Equipment 'Sell Item' Color" OXP to add in a couple of items which then were not reddened by it, and could not understand any of what I was looking at. Ditto with other attempts to decipher simple snippets of code (such as "BlOomberg Markets" OXP just a few months ago).
The easiest way to add missing items into the Equipment "Sell Item" Color OXP is to change line 9 of it's script file from this:

Code: Select all

this._inclusions = ["EQ_MANIF_SCANNERX"];
To this:

Code: Select all

this._inclusions = ["EQ_MANIF_SCANNERX","EQ_MISSING_ITEM1","EQ_MISSING_ITEM2"];
Important things to watch:
1. Make sure each equipment item is enclosed in double-quote marks (ie "EQ_MISSING_ITEM1")
2. Make sure there is a comma (ie ,) between each item. eg "EQ_MANIF_SCANNERX","EQ_MISSING_ITEM1","EQ_MISSING_ITEM2"
3. Don't accidentally remove the end backet (ie ]).
4. Make sure your double-quotes are the standard ones (ie ""), not the fancy ones (eg “”)
User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 537
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: Information desired!

Post by Nite Owl »

Probably the wrong thread to be posting code snippets in but here goes. My take on the Equipment "Sell Item" Color OXZ's lack of colors on some equipment items was not to add them to the inclusions code as that could end up with a very long list depending on the number of equipment OXZ's one has installed. Instead synonyms for remove were added a bit further down in the script as follows.

Code: Select all

{
	if (this._exceptions.indexOf(itm.equipmentKey) >= 0) continue;
	if ((desc.indexOf("remove") >= 0 || name.indexOf("remove") >= 0) || ((desc.indexOf("sell ") >= 0 || name.indexOf("sell ") >= 0) 
	&& desc.indexOf("buy ") === -1 && name.indexOf("buy ") === -1) || (desc.indexOf("unmount") >= 0 || name.indexOf("unmount")>=0)
	|| (desc.indexOf("undo ") >= 0 || name.indexOf("undo ") >= 0) || (desc.indexOf("removal") >= 0 || name.indexOf("removal") >= 0) 
	|| itm.equipmentKey.indexOf("REFUND") >= 0 || (desc.indexOf("delete") >= 0 || name.indexOf("delete") >= 0)
	||this._inclusions.indexOf(itm.equipmentKey) >= 0)
		{
                 	itm.displayColor = "orangeColor"; // <-- this can be changed to any of the specified colors as one prefers - originally was "redColor"
		}
}
There are probably more synonyms for remove that could be included but these are the ones found many moons ago in a brief parsing of the OXZ's installed in my Ooniverse at the time. The F3 screen in my Ooniverse has a few other colors associated with it for ease of identification but these are tediously coded into the individual equipment.plist files.
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
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4809
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Information desired!

Post by phkb »

Nite Owl wrote: Mon Aug 19, 2024 1:15 pm
My take on the Equipment "Sell Item" Color OXZ's lack of colors on some equipment items was not to add them to the inclusions code as that could end up with a very long list depending on the number of equipment OXZ's one has installed. Instead synonyms for remove were added a bit further down in the script as follows.
I'm curious as to what equipment items have "delete" in their name. I haven't seen them before, and none of the OXP's available via the download manager have it.
User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 537
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: Information desired!

Post by Nite Owl »

If memory serves it was not that delete was in the equipment name but might have been in the equipment's description. Could be wrong in this. It might also have been included just for what was considered at the time as completeness. That particular Tweak was done many moons ago before the age of Advanced Coding Enlightenment (somewhat) on my part.
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
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4809
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Information desired!

Post by phkb »

Nite Owl wrote: Mon Aug 19, 2024 1:15 pm
The F3 screen in my Ooniverse has a few other colors associated with it for ease of identification but these are tediously coded into the individual equipment.plist files.
A personal equipment-overrides.plist file would allow you to change the colours without having to manually edit those individual equipment.plist files. And it would survive updates to the OXPs.
User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 537
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: Information desired!

Post by Nite Owl »

True, but my equipment-overrides.plist is somewhat reserved for a personalized F3 screen sorting order. The F3 screen colors could be added as well but my current Tweaking methodology has made things somewhat less tedious then it is made out to be. When these Tweaks were first attempted (again many moons ago) going through all of the files made the tedium atrocious. Now it is not really that much of a bother as my knowledge of how to do it, the tools to use, and what to look for has increased exponentially. Thank You for the suggestion though.
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
Post Reply