Well I have done everything the forums said i needed to do to register and make posts but it keeps thinking i have hyperlinks in this paste.. here goes try #5 at this post.
Anyway been enjoying the program allot and it reminds me of the throwback days to MSdos and allot of command line work and with that came a education for me in batch files so without further ado here I present to you a basic batch file that will generate some basic trade routes. It doesn't use all the advanced features like the x52 or the avoid or via commands. It will generate a route based on your answers to the questions it asks into a text document you can then open and read without squinting at that bad word wrapped command window. note its generating the most detailed reports as i didn't see a need to multi-variable the verbose details.
Indeed, it was amazing to get comms from you and then see your ship, just great gaming moment![]()
Hey Brute,
Would you like me to include this in the scripts directory? There's a "trade.bat" for Windows users in there, but I'd be happy to include yours there too; "brute.bat"?
Can I give TD start system and list (loong list) of systems I want to travel to and it would then output a planned route from this start system to the closest system on the list and then the next closest... looping until we are done?
@maddavo, just to be sure, it's usefull, what i'm doing here:
Currently i'm uploading my prices with your plugin and also my changed station.csv to your market share.
New currently unknown systems are done via your link to Elite Dangerous Star Coordinator.
From time to time you are using your changed station.csv and system.csv to pull your new data to kfsone tradedangerous git, right?
Shall we assist in another way, or is it all you need?
Station.csv has many stations without the landing pad size info, I would like to try to map these stations a little bit and add the missing info.
First I would take Station.csv and make new list of system/station names which don't have landing pad info (or can TradeDangerous return such list for me?), then I would need to plot a route for all these systems.
Can I give TD start system and list (loong list) of systems I want to travel to and it would then output a planned route from this start system to the closest system on the list and then the next closest... looping until we are done?
That way TD (as long as you run EDDN-tap.py) will always be up to date ;-)
Station.csv has many stations without the landing pad size info, I would like to try to map these stations a little bit and add the missing info.
First I would take Station.csv and make new list of system/station names which don't have landing pad info (or can TradeDangerous return such list for me?), then I would need to plot a route for all these systems.
Can I give TD start system and list (loong list) of systems I want to travel to and it would then output a planned route from this start system to the closest system on the list and then the next closest... looping until we are done?
> pip install ipython # or pip3 if you're using mac/lin
...
> ipython
In [1]: import tradedb
In [2]: tdb = tradedb.TradeDB()
In [3]: origin = tdb.lookupPlace("Sol/Abraham Lincoln")
In [4]: jumps=5, jumpLy=12.11
In [5]: tdb.getDestinations?
# ... [help on the function]
In [6]: dests = tdb.getDestinations(origin, maxJumps=jumps, maxLyPer=jumpLy, maxPadSize='?')
In [7]: dests.sort(key=lambda dest: dest.distLy)
In [8]: nextStop = dests[0]
In [9]: nextStop
Out[9]: Station(ID=3806, system'WISE\ 1506\+7027', dbname='Silverberg Relay', lsFromStar=100, blackMarket='?', maxPadSize='?')
In [10]: tdb.updateLocalStation(nextStop, maxPadSize='M')
import tradedb
import re
tdb = tradedb.TradeDB()
origin = tdb.lookupPlace("Sol")
jumps = 5
jumpLy = 16.11
print("Commands are: 'quit', 'go', or 'origin placename'.\n")
while True:
print("jumps:{}, lyPer:{}, origin: {}".format(
jumps, jumpLy, origin.name()
))
cmd = input("command: ").strip()
space = cmd.find(' ')
if space > 0:
cmd, args = cmd[:space], cmd[space+1:]
else:
args = None
if cmd.startswith('q'):
raise SystemExit("Right you are")
try:
if cmd.startswith('ori'):
origin = tdb.lookupPlace(args)
elif cmd == "go":
dests = tdb.getDestinations(
origin, maxJumps=jumps, maxLyPer=jumpLy, maxPadSize='?'
)
dests.sort(key=lambda dest: dest.distLy)
print(dests[0])
for i in range(0, len(dests)):
if dests[i].system.ID ==20559 and dests[i].station.dbname == "Silverberg Relay":
print("pos {}: {}".format(i, dests[i].distLy))
nextSystem = dests[0].system
dests = [ dest.station for dest in dests if dest.system == nextSystem ]
dests.sort(key=lambda dest: dest.lsFromStar)
for stn in dests:
print("{}: ls from star: {}, max pad size: {}".format(
stn.name(), stn.lsFromStar, stn.maxPadSize
))
newLs = input("Updated ls from star: ")
if newLs:
updateLs = int(newLs)
else:
updateLs = None
newPad = input("Updated max pad size: ").upper()
if newPad:
assert newPad in "SML?"
updatePad = newPad
else:
updatePad = None
if updateLs or updatePad:
tdb.updateLocalStation(stn, lsFromStar=updateLs, maxPadSize=updatePad)
origin = nextSystem
print()
except Exception as e:
print("Something went horribly wrong.\n"+str(e)+"\n")
c:\blah\blah\trade> python findpads.py
Really? Lol I am gonna go look now at your Batch file. nice menu system i may adapt some of that's in your into mine and compile a joint batch-file
It was 3am and it was a quick and dirty batch i made i'll improve it over time and put out newer versions![]()
I had just assumed by the 71 pages of skimming in this thread there wasn't one so i made one.
Feel free to distro the batch file as you see fit just wanted to assist the rest of the community in using your great tool.
Thanks for the code! I ran it and it did this:
Any ideas?Code:python3 findpads.py[/FONT] [FONT=Verdana]Commands are: 'quit', 'go', or 'origin placename'.[/FONT] [FONT=Verdana]jumps:5, lyPer:16.11, origin: SOL[/FONT] [FONT=Verdana]command: go[/FONT] [FONT=Verdana]Something went horribly wrong.[/FONT] [FONT=Verdana]jumps:5, lyPer:16.11, origin: SOL[/FONT] [FONT=Verdana]command:
![]()
trade.py run
--avoid slaves
Hi.
Small question - how to avoid only "usual slaves" and still try to search route with "Imperial slaves" ?
And another question - is it possible to add option circle, to found profitable circle route, with parameter - number of hops ...
Thanks for the code! I ran it and it did this:
Any ideas?Code:python3 findpads.py Commands are: 'quit', 'go', or 'origin placename'. jumps:5, lyPer:16.11, origin: SOL command: go Something went horribly wrong. jumps:5, lyPer:16.11, origin: SOL command:
![]()
import tradedb
import re
tdb = tradedb.TradeDB()
origin = tdb.lookupPlace("Sol")
jumps = 1
jumpLy = 30
print("Commands are: 'quit', 'go', 'jumps N', 'ly N.NN' or 'origin placename'.")
while True:
print()
print("origin: {}, jumps:{}, ly/jump:{}".format(
origin.name(), jumps, jumpLy
))
cmd = input("command: ").strip()
space = cmd.find(' ')
if space > 0:
cmd, args = cmd[:space], cmd[space+1:]
else:
args = None
if cmd.startswith('q'):
raise SystemExit("Right you are.")
try:
if cmd.startswith('ori'):
if not args:
print(
"'origin' command needs a system/station name, e.g: "
"origin i bootis"
)
continue
origin = tdb.lookupPlace(args)
elif cmd.startswith('ju'):
if not args:
print(
"'jumps' command needs a number of jumps, e.g: "
"jumps 5"
)
continue
jumps = int(args)
elif cmd.startswith('ly'):
if not args:
print(
"'ly' command needs a lightyears value, e.g: "
"ly 4.2"
)
continue
jumpLy = float(args)
elif cmd == "go":
dests = tdb.getDestinations(
origin, maxJumps=jumps, maxLyPer=jumpLy, maxPadSize='?'
)
if not dests:
print(
"Nothing found!\n"
"Adjust the search parameters by changing the "
"start system ('origin'), max jumps ('jumps') "
"or light-years per jump ('ly')."
)
continue
dests.sort(key=lambda dest: dest.distLy)
for i in range(0, len(dests)):
if dests[i].system.ID ==20559 and dests[i].station.dbname == "Silverberg Relay":
print("pos {}: {}".format(i, dests[i].distLy))
nextSystem = dests[0].system
dests = [ dest.station for dest in dests if dest.system == nextSystem ]
dests.sort(key=lambda dest: dest.lsFromStar)
for stn in dests:
print("{}: ls from star: {}, max pad size: {}".format(
stn.name(), stn.lsFromStar, stn.maxPadSize
))
newLs = input("Updated ls from star: ")
if newLs:
updateLs = int(newLs)
else:
updateLs = None
newPad = input("Updated max pad size: ").upper()
if newPad:
assert newPad in "SML?"
updatePad = newPad
else:
updatePad = None
if updateLs or updatePad:
tdb.updateLocalStation(stn, lsFromStar=updateLs, maxPadSize=updatePad)
origin = nextSystem
print()
except Exception as e:
print("Something went horribly wrong.\n"+str(e)+"\n")
Still the same, something went horribly wrong. I placed the .py into TD root dir along side trade.py is that the correct place for it?
python3 findpads.py
Commands are: 'quit', 'go', 'jumps N', 'ly N.NN' or 'origin placename'.
origin: SOL, jumps:1, ly/jump:30
command: go
PROCYON/Manakov Dock: ls from star: 0, max pad size: ?
Updated ls from star: 100
Updated max pad size: L
NOTE: PROCYON/Manakov Dock (#3364) updated in /home/<stuff>/data/TradeDangerous.db: ls=100, bm=?, pad=L
origin: PROCYON, jumps:1, ly/jump:30
command: