Space Engineers

Space Engineers

[EEM] Barter trade (Script)
21 Comments
Dots 27 Oct, 2024 @ 3:45am 
script is ancient and DOES NOT WORK ANYMORE!
Alexis(Mssun21) 16 Mar, 2024 @ 10:37am 
Can we get a Update?
Dorimanx 14 Sep, 2021 @ 9:48am 
I have fixed the script, it's not working as is, things changed.
here it's is:
https://pastebin.com/kWGQacyU
DogwaterGaming69 21 Jan, 2019 @ 5:01am 
its still working?
mahtrok  [author] 10 Dec, 2017 @ 3:42am 
Thanks, nice to know, but... this script does not require any faction settings...
Genbu Tetsukame 9 Dec, 2017 @ 8:23pm 
Hate to break it to ya, but they implemented factions, in case you already didn't know.
F.Writoni_Rune 30 Jul, 2017 @ 5:36pm 
Ok then
mahtrok  [author] 30 Jul, 2017 @ 5:26pm 
No, it's integrated inside the ships that are using it.
F.Writoni_Rune 20 Jul, 2017 @ 11:53am 
Do I need this for the Exploration Enhancement Mod?
mahtrok  [author] 30 Aug, 2016 @ 1:22am 
Nope. I never checked it again After creating it. Might take a look
Wolf 29 Aug, 2016 @ 9:56pm 
i hav update my game and server. and hav fails :( display notfound and more. the script ist not update :/ ore?
mahtrok  [author] 9 Nov, 2015 @ 5:36am 
To give you a hint, i would set it up with a small container of a specific name connected to a collector, check this container every run for the amount of the item you want as payment, a timer block, toggleing the connector On/Off, which has to be set to "share with all". And that's it.
Ah if you don't want to use scripted item transfer you could again build a conveyor sorter from your check container to the storage, turned off and set to drain all.
Once the amount of payment is reached, start the timer block, which then activates the connector and the conveyor sorter and shuts off the program block. If the player should be able to recharge completely, instead of a defined seconds count, just build a sensor, when the ship is leaving its range, trigger a reset timer shutting all down and turning on the program block again. If you want to have a certain time defined the ship is recharged, the activation timer should start the reset timer running the time defined.
Nutlesscats 9 Nov, 2015 @ 4:53am 
o ok that makes a lot more sense :) my bad :P

as for the connector i will take that under advisement and give it a go (probally end badly lol sub-basic scripting knowledge)

Thakyou for your reply was really helpfull
mahtrok  [author] 9 Nov, 2015 @ 4:26am 
About the Connector thing, it IS possible as long as the trading / refueling station is owned by a player. You can then check for the uranium and just turn it ON by a timer for example, while it is set to "share with all" the player could then dock and recharge.
The moment the connector belongs to an NPC faction all the "Share" settings are set to "no share" and it will no longer work. You therefor can't dock with this port even if turned on as long as keen doesn't implement custom factions.

But this would require a new Script (about 5 minutes scripting time).
mahtrok  [author] 9 Nov, 2015 @ 4:25am 
At first, yes it is possible to restart the script, but the barter trade script should be manually restarted by the owner of the terminal, the option is allready there.
The reason, why the restart is not automated, is that in difference to the trading script, the barter script uses Conveyor Sorters to transfer the goods and they don't have a counter, they only transfer everything that is in from A to B, as long as it passes the filter. The Owner has to restart the program, for he has to put in the items required in the correct amount back into the correct container before the trade can happen again.
The purpose of this script is more like a "quest trade" then a real trading setup. You get there, check the offer, provide what it says and get what it says in charge. Then thank you and good bye.
An automated trading setup is achieved with the Exodus Trading script, but this is much more complicated to set up.
Nutlesscats 9 Nov, 2015 @ 3:08am 
sorry to bother you again but i was working on the trade ship competition and i was wondering is it possible to make a script that wont allow a vessel to lock connector until say 10 uranium ingots are placed into a certain container therefore forcing people to pay to have there ship refuelled by trade ship?
Nutlesscats 9 Nov, 2015 @ 2:38am 
after transaction* sry my brother spilt shit on keyboard yesterday
Nutlesscats 9 Nov, 2015 @ 2:37am 
by ay chance can you add a function to check shop output after transation and if empty restart the script?
ContrastX 7 Oct, 2015 @ 1:54pm 
Will do.
mahtrok  [author] 7 Oct, 2015 @ 12:36am 
Thank you very much :) If you run into any problems just ask, i will answer as soon as possible.
ContrastX 6 Oct, 2015 @ 3:59pm 
Very nice script sir. I played with your demo map and it may be what I need for my server. Thankyou for your hard work and well done on the way you wrote it for us non-code people. I was actually able to understand how it works.