Forums » Community Projects

Trade Assistant (TGFT version)

Jul 24, 2008 blacknet link

I am releasing this as a TGFT app. This is the core foundation of trade in the VO verse.

Trade routes: for the buy/sell to work you need items from the buy station at the sell station and it will show only profit.

Item lookup: all stations you dock at, buy and sell prices. each time you dock it will update the cached copy so you get current rates.

No data is wrote or saved between sessions, no config settings and the like. This is due to volatility of the data.

If you find this super useful then you may want to apply at TGFT.

To launch it use /ta

To purge all data /ta purge

This version (1.5+) saves data between sessions.

Mad Miner Moda
Jul 25, 2008 blacknet link
OK just updated it, there was a bug in sorting an empty matrix. that problem is now fixed.
Jul 28, 2008 ArAel link
anyway this can write to something external other than an online db
Jul 30, 2008 Ion link
blacknet, how does this plug-in relate to Vorgas' TradeAssistant v.03? Useful to know for inclusion of the plug-in on the wiki plug-in list.
Jul 30, 2008 blacknet link
From here, I was told that the old version was broke and needed to be updated so I wrote this version.

As far as saving goes that will have to be a later down the road type project, maybe.
Oct 05, 2008 tarthesius link
I would like to offer to help with making the information perpetual. Lua is brand new to me (though I've developed in a number of other languages), and I've been looking through the existing module and other sources in an attempt to do the basic planning. I would like to propose a server based solution for two reasons.
1) Shared data is more complete than individual data.
2) This appears to be the only I/O that makes sense (aside from the message notes/ini stuff which just seems ugly).
I have a full server (home) at my disposal, and it's quite in working order. I don't know if it's possible (sensible?) to try to do MySQL in the LUA, or if I should write my own connector server (which wouldn't be horifically difficult; and has the added advantage of being more secure via a limited API; and could make the interface from the plugin quite easy).

I would be very interested in anybody's feedback on this.
Oct 05, 2008 blacknet link
sure welcome on. You may wish to join in on the irc channel we have. it's #vo-lua on slashnet. Also we have a lua guild for these things and then there's the PCC as well.
Oct 17, 2008 cspag link
I have modified Trade Assistant 1.2 to save its data to the local drive between sessions. I will be releasing this modification to the community (as version 1.2b) after a few more days, as I want to exercise it a bit more in order to make sure that everything is OK. I will be including in that release a "starter" data file which contains the sale inventory for all of the stations.

I do not feel that it is in the best interests of anyone to set this up to run against a central server in order to share the preserved data, and I would be happy to discuss the multiple reasons why not if anyone wishes to do so. But I comment that it would be trivial to further modify 1.2b in order to write/read to a central server, if anyone wanted to do that.
Oct 17, 2008 slime73 link
Cool. :)

You're using system notes to save the data, right?
Oct 17, 2008 cspag link
In order to get TA to save its data between sessions, what I did was create a separate (extremely simple) application which acts as a "proxy" for writing and reading the local hard drive. This "proxy writer application" (TAWriter) listens on a socket and then just writes whatever data comes in over that socket out to a file. It also listens on a second socket, and whenever anything connects on that second socket it writes the contents of that file back out over that second socket. I then (after spending a fair bit of time deciphering the implementation of sockets in VOs LUA) added the necessary code to TA's main.lua to send its station and goods data out via socket to TAWriter on player logout, and also read it back in on player login.

This means that if a player wants his TA data to save/restore between sessions, he will need to run TAWriter before he logs into VO, and leave it running until after he finishes logging out of VO. TAWriter is written in java, so it should run on any platform that VO runs on, and I have no problem distributing the source (anyone so inclined can examine the source and recompile before running to verify that there is nothing "bad" in there). So, the PC will need to have java (runtime) installed in order to run TAWriter. If TAWriter is not running, then TA 1.2b will otherwise function as 1.2 does (without any errors), it just will not be able to save and read its data between player sessions.

It is certainly not fancy, but so far it seems to work OK.
Oct 17, 2008 slime73 link
Check out the SaveSystemNotes and LoadSystemNotes functions. You can save to a file that way.
Oct 17, 2008 blacknet link
When I released this version of TA the load/save system notes was not ready for production at that time. We were still making changes to the structure and I was not sure when it would get into production.
Oct 20, 2008 cspag link
That SaveSystemNotes LoadSystemNotes functions would indeed have been a better way to have implemented saving this data. Perhaps I will do a version at some point which uses those.

But for now, what I have as version "1.2b" does work. So if anyone is interested in it, they are welcome to it:

After downloading, unzip into the "Vendetta Online / plugins / TA" directory. Read the ReadMe.txt for info.

Note: for the save and restore of your TA info to work, you need to start TAWriter running *before* you run VO.

Oct 26, 2008 Scottso link
I hope I'm not stepping on anyone's toes but I took it upon myself to implement the session saving with SaveSystemNotes and LoadSystemNotes so no external application is necessary. I bumped the version to 1.2c and removed all TCP socket code. Details are in the main.lua file and ReadMe.txt.

The new version is available here:

and my code diffs for anyone interested:

Feel free to incorporate the changes into the "official" version if anyone is so inclined. Have fun!
Oct 26, 2008 vskye link
Excellent Scottso! Will check it out a little later.
Oct 26, 2008 IcabarCrane link isn't working on my mac... how do I open the .java file? It needs to be running while I'm playing VO, but I don't know how to run it. Any ideas?
Oct 26, 2008 cspag link
No worries Scottso, I was already working in that direction myself - and saving to the local drive using SaveSystemNotes is *definitely* a better deal for usability. Thanks for putting 1.2c out there!

For where I am going with this (and why I looked into doing TCP sockets first):
In the end, I want to end up with *both* local saving (fast and reliable), *plus* a remote "shared" data server or better yet servers (shared data rocks for this sort of stuff, but only if done right). Which means adding a new mechanism to TA to resolve "conflicts", and making the server end smart enough to also resolve "conflicts", plus implementing a proper database on the server side to store it all. I know how to do this (no problemo), it will just take me a bit to hook all the pieces together...
Oct 26, 2008 cspag link
IcabarCrane: Use 1.2c, and read the included ReadMe.txt. It will tell you how to place the system71531notes.txt file which comes with 1.2c so your character can start with the entire game data.

PS: The easiest way to figure out where to put that file, is to simply load in TA 1.2c without it, then fire up VO, then exit VO. Find out where the (small) file gets created, then overwrite that (small) file with the (large) one which was included in
Oct 26, 2008 IcabarCrane link
cool, thanks cspag!
Oct 26, 2008 Scottso link
The shared server idea is interesting. Of most concern to me would be a way to keep the data integrity and protect it from those with malicious intent.

I can't see how to keep someone from ruining the shared data since there is no way to authenticate random people -- unless you limit data modification to only a select few folks and make it read only for the rest. That sort of defeats the point of the shared data though. It would be a very simple matter to make a plugin send whatever data you like to your shared server. How do you verify that the data is valid?