[MOD] ATIS - Automatic Trading Inside Station [BETA v0.6 - 22th may 2014]

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

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

User avatar
ybeline
Posts: 83
Joined: Sun, 22. Aug 10, 13:55
x4

[MOD] ATIS - Automatic Trading Inside Station [BETA v0.6 - 22th may 2014]

Post by ybeline »

.


Author: ybeline
Version: BETA v0.6
Date: 22th may 2014
  • Automatic Trading Inside Station (ATIS)
Everytime you land on a station platform, a little tip will tell you Who to buy what from, Who to sell that to, And get maximum profits.
This mod gives you the best trade run inside a landing platform to get the best profits.
Keep visiting platforms, and you may find nice deals.



[ external image ]



Download last version (0.6)



Installation note:
Extract file in "...STEAM\SteamApps\common\X Rebirth\extensions".

Nota:
- This mod doesn't create or destroy anything.
- This mod only uses data from the game.
- It supports: Arms Dealers, Drone Dealers, Mining Suppliers, Junk Dealers, Space Farmers, Ship Technicians, Equipment Vendors, Food merchants and Black Marketeers
- You still should back up your savegames.
- Compatibility shouldn't be a problem.
- You obviously have to dock.
- Should you choose not to follow the proposed trade, you'll have to manually disable the guidance (for now).

Please, feel free to test it and share your opinion and critics :)



BETA v0.6 - 22th may 2014
- Older (but working) code
- Guidance added
- "save" parameter of "content.xml" set to "false"

BETA v0.5 - 8th dec 2013
- Code fully rewritten to allow the implementation of further improvements
- Number of lines of code shrinked by a factor of 7
- Some rare possibilities of wrong display have been fixed

BETA v0.4 - 1st dec 2013
- Some minor bugs fixed.
- Some minor features added.

BETA v0.3 - 30th nov 2013
- Some minor bugs dealt with.

BETA v0.2 - 30th nov 2013
- Added support for every trader NPCs.

ALPHA v0.1 - 30th nov 2013
- REDUCED version of the mod.
- it only works with Black Marketeers for the moment.






















Original post
Edit#01
So, after some days of coding, reverse-engineering of X Rebirth modding capacities (and help from other modders), I got a fully functionnal mod, working as intended. It gives you the info of (inside a landing platform): who to buy what from, and who to sell what to, to get the best profits. I'll probably post it as soon as I've cleared some of the code. It's currently not displaying in a very sexy way, because it's currently impossible to use the display tabs.

If you're interested in how the mod works, go here to learn a bit about it.



Original post
Hello,



Some say that interacting with people inside stations is a hassle.
It is also a nice source of income at the beginning of a game.

The next paragraphs will describe the mod that informs you of the right 'trading plan' to follow in order to make maximum profits on one particular station:
who to buy what from, and who to sell what to.

  • Preliminary
Correct me if I'm wrong.
  • 1) It seems that, for every NPC, the ratio: (NPC buying price) / (NPC selling price) is a constant (~ 90%)
    2) Moreover, it seems that, inside one station, NPCs of the same type share the same ratio
    3) Just for the record, those prices are not a function of their current storage
  • Example
So, knowing this, I'll now illustrate how to make money this way, by taking a simple example.

Inside one on the landing platforms of a station, you find 2 'Arms Dealers': AD_1 and AD_2.
They both sell and buy the same one type of 'Missiles': M_1.
You write down each of their selling prices.
Now, you determine which one is the lowest.
In this example, we take: 'AD_1 selling price' < 'AD_2 selling price'.
We will then buy M_1 from AD_1.

We now need to know if buying from AD_1 and selling to AD_2 will make profits.
What we need, is that: 'AD_1 selling price' < 'AD_2 buying price'.

How can we know the amount of money AD_2 will be willing to give us against some M_1?
To know this, if we do not have M_1 in our inventory, we'll estimate it by the '90% constant' I previously talked about in the preliminary:
'AD_2 buying price' ~ 0.9 * 'AD_2 selling price'

So, profits can only be made:
If 'AD_1 selling price' < 0.9 * 'AD_2 selling price'

  • Turning this into a mod
Once you've met the appropriate NPCs inside a landing platform of a station, the goal of this mod is to make automatic the need of noting prices and the calculation part.

So, inside a particular station, when you meet a NPC inventory trader, his prices will be kept by your copilot. Once you've met every NPC in the station, an additionnal option in your 'Main menu >>> Trading' will appear and give you the choice to get a report on profits to be made on this landing platform: who to buy what from and who to sell what to.

The mod will cross-check goods and NPCs so, if multiple trades are profitable, they will be ordered by max profits. The necessary investment will also be displayed, accordingly to your current credits and as a function or the number of units to purchase (you might even not have enough credits to buy a single unit).

Nota:
It might even be simplier and more exact than what I told you about: if the mod can have access to NPCs prices, the '90% rule' is not even useful. But it still seems important that the exploration of the various NPCs of the station remains important for immersion purposes, even if the mod itself doesn't need it.

  • I need your advice
The only problem is, I currently do not have the knowledge to write such a mod.

So, before trying to learn and understand the ropes, could someone experienced tell me if it's even possible?



Thank you,

Regards,

ybeline
Last edited by ybeline on Sat, 7. Mar 15, 16:20, edited 33 times in total.
aaronstatic
Posts: 9
Joined: Sat, 16. Nov 13, 16:44

Post by aaronstatic »

Maybe remove the [MOD] tag until it's actually a mod :)

I agree though, it's a great idea!
User avatar
Nibel
Posts: 208
Joined: Sat, 29. Apr 06, 16:53

Post by Nibel »

tl;dr plus it's NOT a mod !
it's hardly in progress,when you simply don't know how to write it...what in progress ? learning ?learning is not a mod by itself.
it's AN IDEA.
Last edited by Nibel on Wed, 20. Nov 13, 17:29, edited 1 time in total.
jeroll3d
Posts: 665
Joined: Thu, 26. Jun 08, 02:28
x3ap

Post by jeroll3d »

This is request or IDEA not a mod. =/

Change to [IDEA]

:)
Entusiasta da série X3! The best game.
DaveStrider
Posts: 11
Joined: Sat, 16. Nov 13, 23:10

Post by DaveStrider »

It's a good idea although i don't have the expertise to tell you if it's possible or not
Tyrant597
Posts: 299
Joined: Wed, 9. Apr 08, 05:52
x4

Post by Tyrant597 »

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

There you go! =)

For the record, npc prices are completely random, but as you noted, they are currently not effected at all by inventory amount.
Your '90%' constant is probably not far off, but if you wanted to be exact, you can load the price ranges and calculate the perfect 'break-even' point.

Hope we get access to the interface soon so that you can display your data.
You don't talks about X:Rebirth...
X4 Mods: Collect Inventory Wares Stations Supply Build Storage Mass Move Marines
User avatar
ybeline
Posts: 83
Joined: Sun, 22. Aug 10, 13:55
x4

Post by ybeline »

Tyrant597 wrote:http://forum.egosoft.com/viewtopic.php?t=352814

There you go! =)
Hello,

Well, in case you didn't notice, I actually am also the author of this other thread :D

By the way, I have managed to create the ATIS mod as I intended: it's fully working.

But as you said, there is currently no other way than "<show_help>" to display the results. So it's not very sexy.

But fully functionnal. I'll probably post it on Nexus once I've cleared my code and tested some more :)



Regards,

ybeline



Edit#01
Tyrant597 wrote:Your '90%' constant is probably not far off, but if you wanted to be exact, you can load the price ranges and calculate the perfect 'break-even' point.
In fact, it's impossible to get the price ranges. You can only get what I call the "medium price", the one that is calculated by the "NPC engine", which is actually (buying_price + selling_price)/2. And about that constant, I'm currently using 90.48% but it's actually hardcoded for the moment.
User avatar
Fumblesneeze
Posts: 75
Joined: Tue, 26. Nov 13, 10:07
x3tc

Post by Fumblesneeze »

1) It seems that, for every NPC, the ratio: (NPC buying price) / (NPC selling price) is a constant (~ 90%)
This is what kept me from making a "Sector-Map" Item which would reveal the whole sector. I see no way of making this purchase-only at the moment, or even setting the selling-price to 0. Correct me if I'm wrong :)
User avatar
ybeline
Posts: 83
Joined: Sun, 22. Aug 10, 13:55
x4

Post by ybeline »

Fumblesneeze wrote:I see no way of making this purchase-only at the moment, or even setting the selling-price to 0. Correct me if I'm wrong :)
Well, in fact, it's probably possible if you take inspiration of the 'npc.entitytype' of 'entitytype.upgradetrader'. They do not work the same way as 'entitytype.itemtrader'.

I invite you to dive into 'md\NPC_Upgradetrader.xml'. Good luck :)

Edit#01: you will also have to take a look and modify 'md\Setup.xml'.



Regards,

ybeline
User avatar
Fumblesneeze
Posts: 75
Joined: Tue, 26. Nov 13, 10:07
x3tc

Post by Fumblesneeze »

Yep, I still don't see how to modify the selling/buying price.

Of course, I could simply add another conversation option which basically just removes some player money and sets the sector to 'known', but that is not using the trade menu as I would've wanted it.
User avatar
ybeline
Posts: 83
Joined: Sun, 22. Aug 10, 13:55
x4

Post by ybeline »

Hello,



Going BETA!

All trader NPCs are now supported.

Please, feel free to test it and share your opinion and critics :)



Regards,

ybeline
Staberind
Posts: 128
Joined: Wed, 5. May 10, 23:32
x4

Post by Staberind »

Congrats on beta, As I currently have NESA installed, I will have a go with this after editing a savegame and turning off Nesa.
Presently I am just scanning up as much junk in space filing cabinets as possible, before Auditioning traders and finding the best looking price for an item, obviously, your system will be fun to use when I have plenty of seed money.

Oh, please disregard my post on nexus asking about NESA,
Although if I might suggest mentioning that on the nexus, :)
User avatar
ybeline
Posts: 83
Joined: Sun, 22. Aug 10, 13:55
x4

Post by ybeline »

Staberind wrote:As I currently have NESA installed, I will have a go with this after editing a savegame and turning off Nesa.
Hello Staberind,

In fact, I've badly expressed myself. ATIS isn't incompatible with NESA. Both can run at the same time as of today versions. It's just that my mod only triggers if one actually lands on platform. And if you're using NESA, it's because you don't want to land anymore. So basically, you can have NESA installed and you can still make the choice to land on platform: ATIS will work.

By the way, it's totally possible to make ATIS fully compatible with NESA. I'll ask Mad_Joker if he can set up a backdoor in his code that I can use to activate ATIS. There is still some problem: as NESA can work zone/sector/galaxy wide, ATIS could have some calculation issues if it goes higher than sector wide :D

Edit#01
Moreover, it seems that the 'NPC engine' isn't really spawning anything outside the 'zone' in which the player is operating.
It also seems that the 'NPC engine' isn't keeping every spawned NPC in the savegame or in memory.



Regards,

ybeline
skadog
Posts: 180
Joined: Tue, 7. Oct 03, 14:34
x3

Post by skadog »

Great idea, congrats, and thanks for sharing! One thing, I don't know if it's possible but it would be cool if you could access these tips from one f the many unused consoles on the station rather than a pop-up.
"Who do you think pays for all this rubbish? They're not gonna make their money back, you know, I told them, I said to them, Bernie, I said they'll never make their money back." - Eric Idle, Always look on the bright side of life.
mrowka
Posts: 128
Joined: Tue, 30. Jun 09, 19:50
x4

Post by mrowka »

Maybe instead of messages you could use the quest system
MK3 Optimization "If you get stinky rich its his fault"
IEX - Sector Visual Enhancement "Dont enjoy the view navigating thrugh asteroid field, Seriously!"
Marine Repair 2 "Tip 19: Modern coffie cup`s are made of hull plating, beware"
User avatar
ybeline
Posts: 83
Joined: Sun, 22. Aug 10, 13:55
x4

Post by ybeline »

Hello,
skadog wrote:Great idea, congrats, and thanks for sharing! One thing, I don't know if it's possible but it would be cool if you could access these tips from one f the many unused consoles on the station rather than a pop-up.
Unfortunately, only a few ways of displaying information are currently available.
Accessing them from these unused consoles isn't one I've heard of. Could you elaborate?

skadog wrote:Maybe instead of messages you could use the quest system
This is indeed possible and already totally planned :)



Regards,

ybeline
Staberind
Posts: 128
Joined: Wed, 5. May 10, 23:32
x4

Post by Staberind »

Re, your reply about local data being available; Ahh, yes, that makes perfect sense, I edited my nesa to be very local, so, while it can interact with, say, three closely grouped stations, ones further away are out of range, as it were.
it would be amazing to slightly merge the two, so the nesa editor also ties into ATIS, allowing range editing as well. while still keeping the "Dock at x, receive notification" but limited to local stations of the same organisation, depending on standings with that organisation.
hmmmm, its all very well to have these ideas, I really should learn how to implement them.
Pimpace
Posts: 268
Joined: Tue, 1. Jan 13, 15:48
x4

Post by Pimpace »

And what if there are more NPC pair where you can make profit? I mean, what about with your notification popup in this case? It will popup up the first "buy here, then sell there" then popup another note with 2nd trade opportunity?
User avatar
ybeline
Posts: 83
Joined: Sun, 22. Aug 10, 13:55
x4

Post by ybeline »

Hello,
Staberind wrote:it would be amazing to slightly merge the two, so the nesa editor also ties into ATIS, allowing range editing as well. while still keeping the "Dock at x, receive notification" but limited to local stations of the same organisation, depending on standings with that organisation.
Could you perhaps elaborate a bit more?
Pimpace wrote:And what if there are more NPC pair where you can make profit? I mean, what about with your notification popup in this case? It will popup up the first "buy here, then sell there" then popup another note with 2nd trade opportunity?
ATIS is actually very simple in the last released version. It gives you, inside a specific landing platform, the best trade run between 2 NPCs of the same type, but also the best trade run amongst all the NPCs on platform. For the moment, ATIS only starts on landing which means it won't update by itself. Once you've exploited the first trade run hint, you can go back to your ship and land again: you'll be presented the next best trade run.



Here are the next features I'm working on:
- cleaning the code by using a single loop
- adding more conditions in the code so that, on some rare occasions, ATIS stop telling you 'Go buy null from null and sell them to null'
- adding a condition on the amount of money you have to invest
- mission waypoints system to point to NPCs (station limited)
- modifying the amount of products that are spawned in NPCs inventory so that some trades become interesting (for the moment, even if ATIS calculates over all trader NPCs, only Arms Dealers and Drones Dealers offer interesting trades): I have to find a balance
- full compatibility with NESA mod
- updating ATIS in real time (each time a transaction is made on a platform)



Regards,

ybeline
Anubitus
Posts: 693
Joined: Fri, 21. Jan 05, 00:44
x4

Post by Anubitus »

I am using this and loving it.. I was wondering tho, could you add a hotkey that one can press so the best trade of that moment shows in the little screen..? Its just, when i have completed the trade, i would like to move on to the next.. :) Also handy if you forgot who to sell the items to..

Return to “X Rebirth - Scripts and Modding”