[MOD] MultiAssignment

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Sun, 22. Mar 15, 18:06

He he. That could work too, except that Lepton's my fleet drone supplier. Drones are expensive. Fortunately, I don't have so many ships that doing it manually takes very long, so did it that way.

Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Post by Vim Razz » Sun, 22. Mar 15, 21:15

@ w.evans,

As a general note, YAT and other current trading/mining scripts aren't written to account for having their ships get pushed around by other mods, so trying to "mass reset" them using external tools can cause problem. It's much better to use their internal tools if at all possible.

Ideally, they'd all be configured to reset tracking and management values in their ai script's <on_abort> sections as a safeguard against rough handling by other mods (especially since they're all more than happy to mess with each other... >.<;; ), but that's just not common practice at this point in time.

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Sun, 22. Mar 15, 21:18

Thanks Vim. Good that I did it manually this time then. Figured it should work, though, since ships can be removed from YAT by ordering them to your squad. Of course, ordering them to someone else's squad isn't the same thing, so might not.

Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Post by Vim Razz » Sun, 22. Mar 15, 21:27

np. YAT actually does listen for it's ships being assigned to other ships or stations through the normal vanilla menu channels, but... MultiAssignment bypasses that completely so YAT never gets informed, unfortunately.

Phipsz
Posts: 335
Joined: Mon, 23. Apr 12, 23:56
x4

Post by Phipsz » Mon, 23. Mar 15, 12:36

@w.evans: heh, did not think this button could imply that :D that button only removes the ship from the list ;) will have to see if I find a different text that fits there. I did not want to block a t-page, so I chose the first entry in vanilla t-files I thought fitting.

hm, yes I am bypassing yats stop-script there. which is only partly bad, because they will stop yat but will still be in yats list. as a result it could be possible you cannot restart them. will see if I can make an if-condition to remove ships from yats list if it is available :) does mitch st logistics too make use of such a list that needs to be modified?

User avatar
wysiwyg
Posts: 585
Joined: Thu, 26. Feb 04, 00:08
x4

Post by wysiwyg » Mon, 23. Mar 15, 12:51

I'm currently looking at detecting YAT and Euclid ships for MTSL. I think Yorrick's ships are fairly easy to detect as there is a global list of traders so it's just a simple matter of checking if this list exists and if so filter the ships on it out of any list that your mod is working on. Haven't delved deep enough into Euclid's mod yet to find out how traders are logged but I'll have a look. MTSL maintains a global ship list called global.$XRCLS.$lTradeShips that is an associative table indexed by the ship id so you'll need to iterate through it using the .keys property if you want to access the list sequentially.

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Mon, 23. Mar 15, 14:34

Phipsz wrote:hm, yes I am bypassing yats stop-script there. which is only partly bad, because they will stop yat but will still be in yats list. as a result it could be possible you cannot restart them. will see if I can make an if-condition to remove ships from yats list if it is available :) does mitch st logistics too make use of such a list that needs to be modified?
That explains what happened. They were squadded under my Lepton, and acted like normal newly-assigned ships (with follow orders), but they wouldn't appear in the YAT add list. Wasn't sure if the requirement to be out of squad required them to be out of any squads, so I thought that it would be a simple matter of removing them from the Lepton's squad.
Phipsz wrote:@w.evans: heh, did not think this button could imply that :D that button only removes the ship from the list ;) will have to see if I find a different text that fits there. I did not want to block a t-page, so I chose the first entry in vanilla t-files I thought fitting.
Thanks for the clarification!

If it's not too much trouble, could you please add the functionality to remove from squads? Would make sense, I think, since Multiassignment is pretty much the most convenient way to add multiple ships to a squad, and I don't think it's possible to just remove a ship from a squad in vanilla unless it's to transfer them to the player's squad.

Phipsz
Posts: 335
Joined: Mon, 23. Apr 12, 23:56
x4

Post by Phipsz » Mon, 23. Mar 15, 16:21

@wysiwyg: thanks! are the tables for mtsl storing all relevant information? so if I have a shipid, would I have to delete the ship from the table or modify a specific key to disable the ships queue? or maybe do you have a cue/library to handle this?

@w.evans: sounds easy enough to do, nice idea :) will work on it the next few days, so stay tuned :)

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Mon, 23. Mar 15, 16:24

Thanks, Phipsz!

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp » Mon, 23. Mar 15, 16:43

Would love a "Leave squad" order. If it proves possible, I'll be advertising this mod in the following thread :)

http://forum.egosoft.com/viewtopic.php?t=378677

User avatar
wysiwyg
Posts: 585
Joined: Thu, 26. Feb 04, 00:08
x4

Post by wysiwyg » Mon, 23. Mar 15, 17:05

Phipsz wrote:@wysiwyg: thanks! are the tables for mtsl storing all relevant information? so if I have a shipid, would I have to delete the ship from the table or modify a specific key to disable the ships queue? or maybe do you have a cue/library to handle this?
Good point! I'm at work right now but I'll drop you a PM with my cue that's used to stop my traders - it would certainly make more sense just to call that cue (or a copy of it in this mod) - alternatively (and I think the preferred option) would be to simply not offer MTSL ships as an option to be added to a squad i.e. read my list of MTSL ships and filter them out of your list of unassigned ships. I suspect that most players will have some idea of what ships are running MTSL from the ship names they use and would simply want these (MTSL, YAT etc) ships excluding from a list of general (unassigned) ships that they might want to add to a squad using multi-assignment.

Bottom line - don't delete ships from the MTSL list as this would lose all the setup data for that ship (MTSL ships can be reassigned to other duties and then added back to MTSL duty - my list retains their setup data) - rather use the MTSL list as a filter for your lists.

Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Post by Vim Razz » Tue, 24. Mar 15, 08:26

You guys have no idea how happy I am to see this discussion. :)

I've been working on tightening these things up in Human Resources to minimize tracking issues, but the big gaping hole in my screen has been... MultiAssignment, MT Logistics, and YAT. HR already applies a check over UFO's current "free ship list" to remove ships running mods it recognizes, but since you guys build your lists in Lua rather than MD it hasn't been an option...

Checking registration lists is a valid strategy for MT Logi, YAT, and UFO, but JLP's trader mod and euclid's mod don't use them. I've found it easier to just filter by blackboard tags on the pilot or captain, tbh.

It's also worth noting that Yorrick is currently in the middle of what sounds like a significant restructuring of YAT, so that's something to keep an eye on.

UFO may be technically "not working" at the moment, but the only problem is that MJ hasn't updated it's Lua menu registration to the 3.50+ format yet, so I'm sure I'm not the only one running it right now....


The biggest challenge in managing compatibility is dealing with euclid's AutoTrader. He doesn't bother with any kind of tracking variable discipline in there at all, and when I messaged him a few months ago about he politely replied that he likes things the way they are, so... change on that front seems unlikely.

That makes writing for compatibility with AutoTrader a challenge that's worth considering whether you want to take on at all, quite frankly.

I can get away with covering it Human Resources because HR is a full re-write of employee menu scripts -- so I can apply tracking externally by controlling contextual access -- but that sort of thing is pretty far outside the scope MultiAssignment or MT Logi.


Anyway, here's a current list of pilot/captain blackboard tracking markers currently in use by active ship scripts:
(The "YATrad", "EATrad" and such are tags I use to keep track of active mods in HR.... )

Code: Select all

<!--	Blackboard tag ref list:
	YATrad: $task
	EATrad: $Miner $Strader $Sminer $Autotrade_hrtracking
	JUProv: $jlpUniTraderRun $jlpUniMiningRun
	UFOver: $UFO
	MTLogi: $XRCLS.{1}
-->
So, for example, if value="@$shiplist.{$i}.pilot.$task", then that ship is currently being used/tracked by YAT.

Be aware that JLP likes setting his markers false rather than null when not in use, so "?" will produce false positives for $jlpUniTraderRun or $jlpUniMiningRun.

$Autotrade_hrtracking is a tracking tag that Human Resources applies to AutoTrader because... as I mentioned earlier euclid hasn't been interested in clearly marking everything as of yet.... you'll have to figure out how you feel like approaching AutoTrader for yourselves...

And I'm kicking these examples out in MD rather than Lua I'm too lazy to remember the relevant grammar in Lua right now.



@wysiwyg --

I've been a bit unsure about what to check for MT Logistics, tbh, and have been bouncing back and forth between checking $npc.$XRCLS and $npc.$XRCLS.{1}..... It kind of feels like checking $npc.$XRCLS.{1} for t/f is the way to go, but do you have a preference?

Within my own mod, I use these filters to block NPCs from being fired, moved, or replaced while recognized mods are using them, so that's the context.


and before I go.... I'm pretty sure I haven't harassed you about setting up a conversation menu for your active pilots yet... :) If you ever happened to feel like diverting default coms for your active pilots/captains with a do_elseif after the kill relation check in NPC_Staff and Conversations, like:

Code: Select all

<add sel="//cue[@name='DefaultComm']/actions/do_if[@value='event.object.hasrelation.enemy.{faction.player}']" pos="after" >
   <do_elseif value="@event.object.$XRCLS.{1} == true" >

      <!-- XRCLS custom conversation options -->

   </do_elseif>
</add>
then that'd be pretty great.


aaaannndnddd... this post ended up looking like wallpaper, which it always seems to do when I get on this topic....

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Tue, 24. Mar 15, 09:23

@Vim, Euclid's Autotrader adds asterisks to the captains' names. "*" "**" and "***" depending on rank. That could be used to track them. He also adds stuff to their inventory. I don't think that anyone else does.

User avatar
wysiwyg
Posts: 585
Joined: Thu, 26. Feb 04, 00:08
x4

Post by wysiwyg » Tue, 24. Mar 15, 11:34

Yes I had spotted the 'Albion Visa' being added to the inventory. This method is ok if you are dealing with NPCs as Vim is but if you need to filter a list of ships to exclude ones that are doing something it can get a bit tedious (code wise) having to poll every player NPC's inventory. IMHO polling for the asterisks is prone to error (and possibly abuse) as the player could use asterisks in a bone fide name.

@Vim Razz and anyone else who needs a quick reference to what MTSL tracks:

i) Vim You're right - $npc.$XRCLS.{1} tracks the pilot's activity true means the pilot is actively running the mt_logistics.trade.ship script (or one of the scripts it calls) I guess this should be the variable you track to make decisions for human resources. My earlier versions had code in the abort section to set this value to false, thus ensuring that whenever the scripts were stopped this value would be set back to false. At some point it looks like I took out the code for some debugging activity and forgot to add it back in (DOH!) I'll add it back in the next minor update that should be this evening.

ii) global.$XRCLS.$lTradeShips.{$oShip}.{8} is set to 0 = unconfigured, 1 = configured but stopped (can be assigned other duties) 6 = trading, 7 = mining (soon(TM)!) - The numbers are currently slightly different in the current version but the next update will be as stated above! Also bear in mind that actively trading MTSL ships are by design assigned to their homebase station manager so the standard methods used in Lua for filtering ships that have a commander will by default exclude active MTSL ships.

The idea of tracking both NPCs and ships is so that NPCs can carry their stats and training records over to any ship, data stored in the ship list carries orders, setup and tracking specific to the ship

Yes it's great to see collaboration - feel free to PM me if anyone needs more info.

(Actually this stuff should probably go in its own thread instead of clobbering Phipsz's mod post ;) )

Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Post by Vim Razz » Tue, 24. Mar 15, 16:18

Thanks! I'll switch fully over to that marker for my own mod, then.

Regarding the topic in general, it may be a bit of a sidetrack but if the question is about adding mod filters to MultiAssignment, then experiences and practices related to that challenge seemed relevant? I've had difficulty with trying to broach this sort of discussion in the past because... no one has seemed interested... -.-

Phipsz, if you'd prefer this discussion was held elsewhere then I'd be happy to pop open a new thread or something.


While AutoTrade's inventory or name markers can be used to identify ships that have ever used the script in the past, they pose the same problem as it's limited blackboard tags in that they don't indicate whether the script is currently active. I impose tag discipline for tracking in HR because that comes closest to approximating a unified tracking model which makes filtering everything together possible, and removing them with HR's "Stop AutoTrade" function doesn't interfere with Autotrade's pilot XP features.

But, outside of HR's inherently greedy framework the challenge with filtering out AutoTrade by any of those means is that you're basically saying "my mod will never touch any captain that's ever used AutoTrade at any point in time" which is a pretty heavy restriction to lay down. So... filter for it? ignore it? It's a decision that needs to made separately from other script mods because it's handling (or lack thereof) is so unusual.

You can't even spot whether it's active or not with a command value check, which otherwise can be used as an easy "catch all" check for free trading ships.

If there's an expression for checking the name of the script a particular NPC is currently running then I haven't found it yet, but it would be very useful in this sort of case.


EDIT: As I re-read my last few posts here.... I don't want to sound like I'm criticizing euclid or other great mod authors who've taken the time to put these scripts together and share them with everyone.

If you're thinking of developing specific compatibility structures for particular mods, though, then it's important to understand the quirks, properties, and challenges associated with each of them when deciding how -- or even if -- you want to approach them.

So, my goal here has just been to provide as much relevant information as possible learned from my own experiences interacting with the current assortment of script mods to try and make that process a little easier.

Phipsz
Posts: 335
Joined: Mon, 23. Apr 12, 23:56
x4

Post by Phipsz » Mon, 30. Mar 15, 13:54

The discussion has helped me, thanks for that! Also I now realised I only need to maintain compatibility with mods that are having their own list to store info which ships are running. so I don't care about euclids trader, afaik they will realise if their script had been stopped, no?

@evans, sparky: I will upload the option to remove all the ships that are in the list from any superiors, this could also be used to stop yat-ships. but that is no "all squad ships leave" but rather the same menu as before with a button refunctioned.

@all: I am thinking of putting in a multi-renaming option. Ideally with placeholders like $SHIPTYPE$ or $AUTOINDEX$ or something like that. a list of options like that that you would want to use would be appreciated, one alone does not find all options one could need :)

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp » Mon, 30. Mar 15, 14:18

Thanks very much for the thought - i look forward to trying it out :)

Phipsz
Posts: 335
Joined: Mon, 23. Apr 12, 23:56
x4

Post by Phipsz » Sat, 4. Apr 15, 15:59

new version is up, still waiting for suggestions on renaming though :) atm, I have following placeholders in mind:
  • $SHIPTYPE$ (arawn, taranis...)
  • $AUTOINDEX$ (will count from 1 to n, n being the number of ships in the list)
  • $SUPERIOR$ (will put in the current superior object name)
  • $OBJECTAUTOINDEX$ (like autoindex, but will count for each shiptype individually. like taranis01,taranis02,arawn01 etc)
  • $CLUSTER$ (cluster the ships is in when renamed)
  • $SECTOR$ (sector the ship is in when renamed)
  • $CLUSTERSHORT$
  • $SECTORSHORT$
looking forward to new suggestions!

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Post by MegaJohnny » Mon, 29. Jun 15, 14:55

Argh, I'm sad I didn't notice this before, a mass renamer for X:R is a great idea :D

You've covered all my use cases already, all I can think of is perhaps $SHIPCLASS$ which gives the XS-XL abbreviations. I think some people might like another way to differentiate between a medium trader and a large one, for example.

Phipsz
Posts: 335
Joined: Mon, 23. Apr 12, 23:56
x4

Post by Phipsz » Thu, 13. Aug 15, 23:55

Renaming has now finally been added! you can use all of the above placeholders for their respective use :)

Post Reply

Return to “X Rebirth - Scripts and Modding”