Space Engineers

Space Engineers

Automated Market
19 Comments
greendragonsegg 12 Jun, 2023 @ 1:29pm 
Love the script, i was able to translate it to english, would you be ok if i uploaded it? with the link to yours? also did you ever figure out how to use the blocks custom data to store price lists vs lists inside the script itself?
TheOnePunisher 22 May, 2023 @ 5:29am 
@Marcvs101: Basically I'd want the script to keep track of the items in my trading station inventory and keep them u for sale until the stock runs out then put back up when it's replenished.

Same thing for items I want to buy, I'd like to have the different prices for buying and selling too. The more I look into the store block the more I find out how painfully limited it is.
TheOnePunisher 22 May, 2023 @ 5:26am 
@Marcvs101: Thanks for the response...erm....would you be up to doing this? I'm too old/dumb to lean how to script. :P
Marcvs101  [author] 22 May, 2023 @ 3:35am 
@TheOnePunisher Sure! From what I remember I used one list (or dictionary) to keep track of items, price and desired amount.
You could freely modify this structure to allow for buy and sell prices, as well as buy and sell amounts. The logic checks that use this data should not be complicated.
Be aware that Space Engineers forces a minimum price for each item, and be also aware that this minimum price is not documented, so the function will just throw an error if you set something too low.
The quantity of the sold items should already reflect the quantity of these items in the inventories.
The idea is that you are telling the station to "only keep N of that item in your inventory", so if you have N+10, the station will try to sell 10. If you set N = 0, the station will try to sell all of its stock.
Marcvs101  [author] 22 May, 2023 @ 3:34am 
@Viper Unfortunately scripts are very picky with the names of the items.. I had a hard time too trying to find good documentation.

@maximeg80 That might be difficult to do for me, as I would need to add a new (programmable) block to each station, loaded up with the configured script.. Sorry

@acheaen Originally the script was coded to look for all the store blocks with a certain name, put them in a list and then apply all market operations on the stores of that list. If you want to split what is bought or sold at different stores, you could either run a second script, using a different store name, or you could edit the script to work with multiple store names.
It is not an ideal solution, but this script was cobbled up quickly.
TheOnePunisher 21 May, 2023 @ 8:01pm 
Can the script be edited to allow for different prices when creating buys and sells? Also could it make the quantity to sell tied to the quantity of the resource on the station/ship?
acheaen 26 Jan, 2023 @ 9:04pm 
Any way to incorporate multiple store blocks so I can split up what is being bought or sold at different store blocks
maximeg80 8 Mar, 2022 @ 11:32am 
Hi, do you think you could create a mod to add your script to NPC station as the "NPC Defense Shields Provider" do with shield?
Viper 5 Aug, 2021 @ 11:17pm 
i got ores and componets to list just fine but the tools throw a exception when i try to list those. thanks loving the script so far.
Marcvs101  [author] 1 May, 2021 @ 10:40am 
@Airomis, that would be really nice
Unfortunately Space Engineers puts a minimum price for all commodities.. This means that trying to sell uranium at 1 SC will result in the market block throwing an error.

In addition, I haven't been able to find any reference to this minimum price on the scripting API, this means that the only way of finding this lower bound is through tiral and error .
Airomis 1 May, 2021 @ 10:11am 
something i would love to see is 100% control on price if i want to sell uranium at 1 SC each i would like to be able to but not mod the files that control NPC shop prices
Marcvs101  [author] 1 May, 2021 @ 10:08am 
Nice!
This script was hastly coded for a friend, so it lacks many advanced functions.

You are all free to take the script and modify it to fit your needs.
Vicar 1 May, 2021 @ 2:59am 
I've made a modified version of the script that among other small changes allows for a different sell price and buy price to be set and having certain items only be sold or only be bought.

@Marcvs101
I've send you a friend request; when friends I can send you the modified script.
Marcvs101  [author] 20 Apr, 2021 @ 2:06pm 
That is actually a good idea, in this way one would not need to modify the code each time.
Airomis 20 Apr, 2021 @ 12:49pm 
have you thought to have the script read it from a list in custom data of the PB or the store block
Airomis 20 Apr, 2021 @ 12:47pm 
ahh i was looking in the custom data
Marcvs101  [author] 20 Apr, 2021 @ 12:44pm 
@Airomis The list should be at the head of the script
look for List<TargetEntries> autoMarketCommodities =
Airomis 20 Apr, 2021 @ 12:19pm 
where is the list at?
Spaceman Spiff 3 Mar, 2021 @ 3:10pm 
Now I have a reason to use store blocks. I'll check it out.