Space Engineers

Space Engineers

Blueprint Component Requirements
the-phil  [developer] 1 Apr, 2016 @ 3:00am
Troubleshooting Guide
Basics
* Make sure the timer block is triggering the programmable block and starting itself every seconds. This script has a bunch of features to add delays to make sure processing power is not wasted by delaying the larger queries to assist is lag reduction!
* There is a 30 tick (tick being the amount of times the PB has been run, should be 30 - 60 seconds).
* Are you using English as your primary language? The script parses the detailed info section of the projector to get projection data to calculate the requirements.
* Recompile the code. Open the programmable block code editor, click check code then remember and exit. This will refresh the "init" section of the code reloading the projectors, cargo containers, etc.

Creative Mode
Make sure you are the owner of all of the blocks on the grid of the ship/station you using. If you are not the owner the programmable block will not read the data and inventory!

Check the output produced by Echo Detailed Info Section
Check the programmable blocks detailed info section for more info (e.g. in the terminal after you select the programmable block running blueprint component requirements in the lower right hand corner of the screen under block group and owner information).

It might be helpful to turn off the timer block when debugging and reading the detailed info section. The script should be firing off every second and you might miss some important info!

Turn on Debugging mode
modify line 19 and change
bool boolDebug = false;
to
bool boolDebug = true;

The debugging mode will display things like components found, how many ticks have passed, whether or not the script successfully made it into a method in the script (useful for crashes) into the detailed information section of the terminal block.

What blocks are searched for parts list
Upon first load the Init() method is triggered, after a successful validation of projector and LCD screen this will not be checked again until the code is recompiled. This will initially run the GetProjectorData() method, this method checks basic projector settings (on/off) and re-checks the parts list from the projector detailed info. Init will search all IMyCargoContainer, IMyShipConnector, IMyAssembler, and IMyShipWelder types of blocks and store them in the list AllStorageBlocks.

The cargo blocks MUST be on the same grid as the projector. It must be the same ship, be compiled when the ship is connected and/or merged to the ship/station with the cargo containers you want to check.

When projector data is found around line 340 there is a check to see if the projector has been properly loaded. Every 30 cycles of the script the cargo containers detected in the Init() method will be scanned for changes (line 345 (if intDelayCounter<30)). This is done by re-running the GetComponentCount method.

The GetComponentCount will generate a new dictionary dComponentsCount (well actually clear and regenerate) via the MakedComponentsCount method. Each block listed in the AllStorageBlocks list will be iterated/cycled.

30 Ticks?!
What this really boils down to is, you need the script to be triggered every second. 1 tick will roughly be one second depending on your games speed and performance. 30 ticks will generally be 30 seconds unless you have a bunch of things running and the SE games performance is slower than expected.

To save processing power, not searching the cargo blocks and checking the status of the projector every iteration of the script. This also allows the LCD screen to smoothly cycle through the list of components without the list being reset and altered every screen refresh. If these are checked every second the game is running you'll see a bunch of latency or lag.

I wanted the script to constantly check to see if there were changes with the projector, the ability to load blueprints on the fly and give an update to new components created. So an arbitrary number of 30 ticks or 30 cycles of the script being ran seemed pretty decent to me in testing.

A picture is worth a thousand words
Having issues? leave a comment here! Upload a picture to your steam library and link it in the comment by using bbcode/formatting remove the spaces after the first opening bracket [ or hit the formatting help button below the reply :)
Last edited by the-phil; 1 Apr, 2016 @ 5:32pm