[MOD] Station Production Limiting v0.05 (6th Apr 2017)

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

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

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Thu, 18. Feb 16, 18:27

Finished playing with the final video, posted it on youtube and linked to it from Steam

X Rebirth Station Production limiting mod 301

Advanced X Rebirth station production limiting

More complex stations
Missile and Turret Forges
URV Wharf

Advanced Debug options

jth

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Thu, 25. Feb 16, 16:33

- [25.02.2016 - V0.02 Public Beta]

throttle_menu_st_prod.lua Add the minimum primary wares that are needed to start a production batch and a station Storage column
throttle_menu_st_prod.lua Improve onUpdate to only update the screen if something has changed
throttle_menu_st_prod.lua Add station storage to onUpdate
throttle_menu_st_prod.lua, production_menu_st_prod.lua and config_menu_st_prod.lua menu.remotelog Compensate for changes to AddUITriggeredEvent parameters in 4.00 RC2
production_menu_st_prod.lua Compensate for changes to gEncyclopedia_ware parameters in 4.00 RC2
production_menu_st_prod.lua Incorporate Egosoft version of fix for onUpdate
st_prod.xml St_Prod_Logger Compensate for changes to AddUITriggeredEvent parameters in 4.00 RC2

jth

Armodeus
Posts: 13
Joined: Sun, 31. Jan 16, 09:47

Post by Armodeus » Sun, 28. Feb 16, 16:50

The mod doesn't work, the window closes when clicking the product icon and the UI becomes stuck. Got 2 errors:

Error: Error while executing onEvent script for event: showStationProduction_ProdThrottle.
Errormessage: [string "extensions/station_prod/ui/stationprod/thrott..."]:258: attempt to concatenate a nil value

Error: D:/Archivos de programa (x86)/Steam/steamapps/common/X Rebirth/extensions/station_prod/ui/stationprod/thrott...(258): ConvertIntegerString(): Invalid argument #1 <money> (got nil, expected number)

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Sun, 28. Feb 16, 17:50

Armodeus wrote:The mod doesn't work, the window closes when clicking the product icon and the UI becomes stuck. Got 2 errors:

Error: Error while executing onEvent script for event: showStationProduction_ProdThrottle.
Errormessage: [string "extensions/station_prod/ui/stationprod/thrott..."]:258: attempt to concatenate a nil value

Error: D:/Archivos de programa (x86)/Steam/steamapps/common/X Rebirth/extensions/station_prod/ui/stationprod/thrott...(258): ConvertIntegerString(): Invalid argument #1 <money> (got nil, expected number)
Its got a problem either getting the amount of one particular ware in Storage or getting the maximum capacity of that ware. Unfortunately lua scripts don't cope well with the unexpected.

What type of station is it ?

What type of ware are you trying to limit ?

EDIT 02/03/2016
I have released a new version 0.03 with some increased error checking that I hope will cope a bit better

Please give it a go and let me know how you get on
Last edited by jth on Wed, 2. Mar 16, 19:22, edited 1 time in total.

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Wed, 2. Mar 16, 19:11

- [02.03.2016 - V0.02 Public Beta]
renamed throttle_menu_st_prod.lua to limit_menu_st_prod.lua to line up better with mod naming
Changed names within lua scripts to line up better with mod naming
"increased paranoia" by doing more input and API return value checking in lua scripts. I hope this will help to cope with weird and wonderful game scenarios, duff stations, API calls that unexpectedly fail and other oddities

jth

antoniut
Posts: 198
Joined: Sat, 4. Oct 14, 13:07
xr

Post by antoniut » Sun, 6. Mar 16, 11:55

I'm sot sure 100%, but it seems your mod bugs the omicron urv production module, its possible?

This drones appears in albion (or default) method production (microchips, food rations.... etc):

URV Assault
URV Cargolifter
URV Interceptor MK1
URV Intrepid MK1
URV Overrun MK1
URV Overrun MK2
URV Surface Miner MK1
URV Surface Miner MK2

The rest of drones are correct, as omicron method production

Thanks

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Sun, 6. Mar 16, 14:15

antoniut wrote:I'm sot sure 100%, but it seems your mod bugs the omicron urv production module, its possible?

This drones appears in albion (or default) method production (microchips, food rations.... etc):

URV Assault
URV Cargolifter
URV Interceptor MK1
URV Intrepid MK1
URV Overrun MK1
URV Overrun MK2
URV Surface Miner MK1
URV Surface Miner MK2

The rest of drones are correct, as omicron method production

Thanks
Please read ALL of this as it took me over an hour to write

I don't think that it can do anything to affect actual production but what you are saying is interesting

Lets get the denial bit done [denial]The Production Limiting mod makes no changes to urv wharf or ware definitions. If you look in the mod there is no assets folder and no wares.xml which means that it cannot change them. It also makes no changes to the production process as I can't find it which is why this mod works around it[/denial] :)

Now for the messy bit if you found the information by using the encyclopaedia then you need to know that what it shows you is filtered by your personal Library. This is like a personal database of what you know. If it thinks that you don't know it then it does not show it to you ... It may not show the omicron production method for a specific drone until your OL URV wharf has actually produced some of each drone

This did cause the mod problems before I found out what the Library was up to. So when I display the possible products that can be limited I also add them to your library. I have to separately add the production methods for each ware as its a separate library. Once I have done that then the encyclopaedia will then show the production method or at least it did in version 0.01. Just checked that it still does it in v0.03 and it does.

The mod originally had trouble getting the list of products and resources to populate the production Limiting menu EDIT which it does by using the encyclopaedia as the production info only shows what is currently producing and not what can be produced. If you now have no products or resources or a lot of zero's in the data of the Production Limiting slider menu then I would be interested in finding out why. Note the Solar stations have no primary resources.

All stuff is X Rebirth 4.00

So as far as wares.xml is concerned the OL methods do exist

Assault URV is a drp_assault and has a default, omicron and fieldsofop production method

URV Cargolifter is a drp_cargolifter and has a default, devries, omicron and fieldsofop production method

URV Interceptor MK1 is a drp_interceptor_mk1 and has a default, devries, omicron and fieldsofop production method

URV Intrepid MK1 is a drp_intrepid_mk1 and has a default, omicron and fieldsofop production method

URV Overrun MK1 is a drp_overrun_mk1 and has a default, omicron and fieldsofop production method

URV Overrun MK2 is a drp_overrun_mk2 and has a default, omicron and fieldsofop production method

URV Surface Miner MK1 is a drp_surfaceminer_mk1 and has a default, devries, omicron and fieldsofop production method

URV Surface Miner MK2 is a drp_surfaceminer_mk2 and has a default, omicron and fieldsofop production method

EDIT 14:00 BST

I have just checked the two possible stations that build OL drones struct_bt_ol_drone_complex_macro and struct_bt_ol_drone_factory_macro. They both use struct_econ_prod_drones_ol_macro to produce drones and looking inside it is

Code: Select all

      <production wares="drp_assault drp_cargolifter drp_construction drp_interceptor_mk1 drp_interceptor_mk2 drp_intrepid_mk1 drp_intrepid_mk2 drp_overrun_mk1 drp_overrun_mk2 drp_scoopcollector_mk1 drp_scoopcollector_mk2 drp_surfaceminer_mk1 drp_surfaceminer_mk2">
        <queue>
          <item ware="drp_assault" method="omicron" />
          <item ware="drp_cargolifter" method="omicron" />
          <item ware="drp_construction" method="omicron" />
          <item ware="drp_interceptor_mk1" method="omicron" />
          <item ware="drp_interceptor_mk2" method="omicron" />
          <item ware="drp_intrepid_mk1" method="omicron" />
          <item ware="drp_intrepid_mk2" method="omicron" />
          <item ware="drp_overrun_mk1" method="omicron" />
          <item ware="drp_overrun_mk2" method="omicron" />
          <item ware="drp_scoopcollector_mk1" method="omicron" />
          <item ware="drp_scoopcollector_mk2" method="omicron" />
          <item ware="drp_surfaceminer_mk1" method="omicron" />
          <item ware="drp_surfaceminer_mk2" method="omicron" />
        </queue>
which is the omicron production method

It should all go as ES have bolted it all together correctly AFAIK

If you are prepared to PM me with a dropbox link to a savegame then I would be very interested to see an OL URV wharf in action. All my stuff is Albion or Devries.

jth

antoniut
Posts: 198
Joined: Sat, 4. Oct 14, 13:07
xr

Post by antoniut » Sun, 6. Mar 16, 16:17

Sorry for annoying you man. I wrote that post because after revising wares.xml
and other rebirth files and saw that all were correct, I was not understanding why was ocurring that strange bug

I'm using a megastation shipyard made by me (not published) Well, not only shipyard, actually it mades all the necessary wares to produce ships (ALL WARES) and really is working like a charm. BUT, is not possible at this moment to build it trough CV (dunno yet but I guess there is not enough sequences and/or stages to build it with CV, or I suspect that CV will not have enough storage to build if I group a lot of modules into the same sequences or stages) I use the trascend mod tweaked (and the md scripts from CWIR to deploy NPC_Shiptraders, well I use the entire mod) to start a new game with the station already builded.

It has,among other things, 8 URV omicron method:

Code: Select all

<!--DRONES PRODUCTION-->
	  
	  <connection ref="ConnectionFor_struct_econ_prod_drones_ol_macro1">
        <build mode="optional" group="production" sequence="E" stage="1" tags="primary" />
        <macro ref="struct_econ_prod_drones_ol_macro" connection="space" />
      </connection>
	  <connection ref="ConnectionFor_struct_econ_prod_drones_ol_macro2">
        <build mode="optional" group="production" sequence="E" stage="2" tags="primary" />
        <macro ref="struct_econ_prod_drones_ol_macro" connection="space" />
      </connection>
	  <connection ref="ConnectionFor_struct_econ_prod_drones_ol_macro3">
        <build mode="optional" group="production" sequence="E" stage="3" tags="primary" />
        <macro ref="struct_econ_prod_drones_ol_macro" connection="space" />
      </connection>
	  <connection ref="ConnectionFor_struct_econ_prod_drones_ol_macro4">
        <build mode="optional" group="production" sequence="E" stage="4" tags="primary" />
        <macro ref="struct_econ_prod_drones_ol_macro" connection="space" />
      </connection>
	  <connection ref="ConnectionFor_struct_econ_prod_drones_ol_macro5">
        <build mode="optional" group="production" sequence="E" stage="5" tags="primary" />
        <macro ref="struct_econ_prod_drones_ol_macro" connection="space" />
      </connection>
	  <connection ref="ConnectionFor_struct_econ_prod_drones_ol_macro6">
        <build mode="optional" group="production" sequence="E" stage="6" tags="primary" />
        <macro ref="struct_econ_prod_drones_ol_macro" connection="space" />
      </connection>
	  <connection ref="ConnectionFor_struct_econ_prod_drones_ol_macro7">
        <build mode="optional" group="production" sequence="E" stage="7" tags="primary" />
        <macro ref="struct_econ_prod_drones_ol_macro" connection="space" />
      </connection>
	  <connection ref="ConnectionFor_struct_econ_prod_drones_ol_macro8">
        <build mode="optional" group="production" sequence="E" stage="8" tags="primary" />
        <macro ref="struct_econ_prod_drones_ol_macro" connection="space" />
	  </connection>	 
I love your mod cause don't want to produce URVs MK1. I just want to produce war ships with MK2 war drones. I have more than 2000 hours in Rebirth and don't want to start from scratch again.

With this I do not mean that your mod is the direct culprit, simply it happens when I install it

Sorry for long post and my horrible english, and thanks for your attention

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Sun, 6. Mar 16, 16:40

Its Ok I suspect that there are one or two situations that I haven't seen that may do strange things with my mod and I would like to see them do it. CWIR and Transcend extend the game sufficiently that they may do something different but I simply don't have the time to try them both out at the moment.

If you just want MK2 URV's then you might want to define your own version of the struct_econ_prod_drones_ol_macro and remove all of the mk1 drones and anything else that you don't want from the queue.

I can't use this as a solution to skipping production slots in my mod as this will affect ALL of one type of station but you can for a custom station

Regards

jth

antoniut
Posts: 198
Joined: Sat, 4. Oct 14, 13:07
xr

Post by antoniut » Sun, 6. Mar 16, 16:48

jth wrote:
If you just want MK2 URV's then you might want to define your own version of the struct_econ_prod_drones_ol_macro and remove all of the mk1 drones and anything else that you don't want from the queue.
That was the idea, but man, at this moment I'm absolutly burnout from makin the station, I've spended several hundred hours putting modules n pieces in correct place. When I saw your mod I said: OMG this man is an angel, thanks! :D

Anyway, please don't worry about this problem! I will sell the MK1 and will make some extra money

Regards

EDIT 1 At this moment I just want to kickass some xenon and PMC... :twisted:
EDIT 2 http://imgur.com/9C4yjjX

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Sun, 6. Mar 16, 19:13

antoniut wrote:
jth wrote:
If you just want MK2 URV's then you might want to define your own version of the struct_econ_prod_drones_ol_macro and remove all of the mk1 drones and anything else that you don't want from the queue.
That was the idea, but man, at this moment I'm absolutly burnout from makin the station, I've spended several hundred hours putting modules n pieces in correct place. When I saw your mod I said: OMG this man is an angel, thanks! :D

Anyway, please don't worry about this problem! I will sell the MK1 and will make some extra money

Regards

EDIT 1 At this moment I just want to kickass some xenon and PMC... :twisted:
EDIT 2 http://imgur.com/9C4yjjX
Wow that is some station :)

I was thinking about designing my own station but I'm not sure that I am prepared to put that much time into it. But then again most of my mods do take a similar amount of time

I have built myself an OL URV forge and I think that I see at least one problem, its not recognising the Omicron method of making drones. Its got Argon and Albion but not omicron so its trying to recycle the wrong materials

Its going to take a while to work out precisely what is wrong but will have a go at fixing it as I suspect that you are not the only one affected just the only one to tell me and I do need to know so Thanks :)

jth

antoniut
Posts: 198
Joined: Sat, 4. Oct 14, 13:07
xr

Post by antoniut » Sun, 6. Mar 16, 19:21

Thanks to you, I think chinese language is more easy than lua! :o

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Tue, 8. Mar 16, 13:09

I have found out where one problem is and have come up with a work around

production_menu_st_prod.lua was always using the .default production method even with OL stations which causes food rations to be displayed as a primary resource instead of Bofu. Added a work around that should correctly display omicron, devries and xenon primary wares

There isn't a pure fix as there is no lua function that I can find that can report the correct production method for a ware that is not actively producing, so I am using string matching which should be OK provided that Egosoft stick to their naming conventions for production module macros.

I have sent you a private message with a dropbox link to some code. If you have 5 mins please give this version a go

I think that this issue may be purely cosmetic but if you have some food rations and bio optic wiring in station storage then please can you let me know asap.

I need to do some tests to see if it returns the wrong wares or not.

Thinking about how this mod actually works I think that it should be fine as it sets a limiting factor but that factor does not take effect until the production slot comes around. It then asks the running production (which will have the right wares) for info and applies the limiting factor to the wares at that point , so it should be fine.

If thats right then I may release the fix to the mod in a day or two. If it does return the wrong ware then I may have to code a fix to get the food rations out of the storage of an OL station

For some reason it is still not showing an omicron production method in the encyclopaedia for the URV's :( I will take another look at the code behind the encyclopaedia menus to try and see whats missing.

I hope that Chinese is more forgiving than lua scripting :)

jth

antoniut
Posts: 198
Joined: Sat, 4. Oct 14, 13:07
xr

Post by antoniut » Tue, 8. Mar 16, 15:21

Is working like a charm now! All drones produced omicron method.

Thanks a lot for your efforts and quick response :D

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Tue, 8. Mar 16, 15:51

jth wrote:For some reason it is still not showing an omicron production method in the encyclopaedia for the URV's :( I will take another look at the code behind the encyclopaedia menus to try and see whats missing.
Turns out it is there after all.

I totally missed the fact that the production method for Omicron Lyrae shows up as Argon rather than Omicron.

It was staring me in the face all the time. It even had a (New Entry) tag beside it Aaaaaaah :(

jth

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Tue, 8. Mar 16, 16:32

antoniut wrote:Is working like a charm now! All drones produced omicron method.

Thanks a lot for your efforts and quick response :D
I am not 100% sure how my changes are causing your station to produce all drones the omicron way, it may be a happy coincidence or side effect.

I am now registering the omicron productionmethods correctly. When you look at a production module with the mod present it registers all possible productionmethods (wares) even if they have never been produced. That makes sure that the Production Limiting menu has the necessary information to fill in the primary wares and lets the slider work properly

My guess is that the vanilla code only registers a productionmethod when production has taken place for that ware which is why you had some omicron (Argon) drone productionmethods but were missing others.

But there may be a bit of chicken and egg (what comes first) in there :)

Glad to know its helped you, it certainly helped me to spot something that needed fixing.

Thanks for doing some testing for me and for reporting the problem.

jth

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Tue, 8. Mar 16, 18:32

I have done a few more tests and my fears about the wrong ware being returned are unfounded. Its making the drones the right way and with the right resources and the Production Limiting is returning the right wares too even with version 0.03

What on earth is happening with the Argon production method not appearing in the vanilla game I really don't know. I just managed to have exactly the same problem with some Scoop Collector MK2 drones, it is correctly producing them but won't admit to knowing the omicron (Argon) method although its using it ... :(

I may wait until the production batch is finished and see if it then knows about the method it used to produce them

jth
EDIT waited and now thats its produced some it knows about them. I think that this one is beyond my pay grade :)

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Thu, 10. Mar 16, 14:41

- [07.03.2016 - V0.04 Public Beta]

production_menu_st_prod.lua was always using the default production method even with OL stations which caused food to be displayed as a primary resource instead of Bofu. Although it displayed food while setting the Limiting factor it actually correctly returned Bofu so this was actually cosmetic. Added a work around that should correctly display omicron, devries and xenon production methods

jth

antoniut
Posts: 198
Joined: Sat, 4. Oct 14, 13:07
xr

Post by antoniut » Thu, 10. Mar 16, 15:09

Great job! :)

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Thu, 6. Apr 17, 18:56

- [06.04.2017 - V0.05 Public Beta]

production_menu_st_prod.lua, limit_menu_st.prod, config_menu_st_prod gui - Compensate for format of game version string changing in 4.10 RC3 and add extra paranoia when checking version to prevent crashing the GUI

Return to “X Rebirth - Scripts and Modding”