Skip to content

Commit

Permalink
Merged in OpenSS/tradedangerous (pull request #59)
Browse files Browse the repository at this point in the history
Create initial windows script
  • Loading branch information
kfsone committed Dec 23, 2014
2 parents 63d2c5d + f8f9b51 commit 8892786
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 2 deletions.
93 changes: 91 additions & 2 deletions scripts/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,17 @@ $ tdupd <station>


<WINDOWS USERS>:
For Windows users, you'll need "bash" from the msysgit package. You
can download it here: http://msysgit.github.io/

For Windows users, there are two options.

1. There is a basic trade.bat file which can import market data and
calculate simple trade runs. This trade.bat file can be run without
any further requirements once you have Python 3.4 installed. More
documentation for this option can be found in the <BATCH-FILE> section
of this file

2. To use the more powerful bash scripts you'll need "bash" from the
msysgit package. You can download it here: http://msysgit.github.io/

Once it's installed, press the Windows key and type: git

Expand Down Expand Up @@ -154,6 +163,86 @@ type in the command as seen above.

</BASH-USERS>

<BATCH-FILE>:

The trade.bat file was created by OpenSS to enable some simple usage
of Trade Dangerous without needing to install bash.

It currently implements:
1. Updating the local Trade Dangerous database to reflect the
database run at Maddavo's Market Share
(http://www.davek.com.au/td/default.asp).
This should give you a decent database to start running trade runs.
2. Importing a local "import.prices" file such as would be produced
from EliteOCR.
This can be used to add more recent market information to
the database.
3. Setting/Overriding currently stored default values.
This is simply an ease-of-use feature to prevent having to type
values multiple times.
4. Ask Trade Dangerous to calculate a trade run.
This will ask a series of questions and calculate a run.

Set Up:

If you will be using the same ship for an extended period of time, it
would be a good idea to set the default values (located at the top of
the trade.bat file) before you run it to prevent being asked for the
values each time the file is run. You can edit the file by right
clicking it and choosing "Edit". This will enable you to set default
values for your ship's capacity and range as well as setting options
such as how many hops (station visits) and jumps (hyperdrive jumps) to
make as well as the maximum age of the market data to use.

When you set these values make sure you do not leave a space after the
"=" sign. Eg: set DEFAULT_CAPACITY=40

Usage:

Throughout the batch file the following conventions are used:
() Round brackets signify the letter to enter for that part of the menu.
(I)n this example you would enter "i" and press enter
[] Square brackets signify the default value that has been set in the
"Set Up" section above. This value will be automatically used if
you press enter

When the batch file is first run it will ask if you want it to update
the local database to match Maddavo's Market Share. It is generally a
good idea to do this to ensure you have the most recent trade data to
work with. This is highly recommended for the first run of the batch
file to make sure there is actually some data to work with.

Main Menu:

The main menu will appear as such:
(U)pdate, (I)mport, (P)references or (R)un
Each option is detailed below.

Update:
This is the same update that is run when the batch file is first
opened. It will obtain the latest market data from Maddavo.

Import:
Import local market data from "import.prices". If you are using
EliteOCR you can set the "export directory" in EliteOCR's
preferences to match the main directory of Trade Dangerous
(not the scripts folder) and when you choose "Export Trade
Dangerous" in EliteOCR it should be placed in the right location to
simply choose Import from the batch file's main menu.

Preferences:
These are the values used to calculate trade runs. You can use this
to override the values set under the "Set Up" section above.

Run:
This is where you can start making credits. It will ask you for your
current credits and location and ask Trade Dangerous to calculate a
route according to the default values set above. If these values
have not been set, you will be asked for them and they will be stored
for the rest of the batch file session. They can be changed again
in the preferences option from the main menu.

</BATCH-FILE>

-Oliver

55 changes: 55 additions & 0 deletions scripts/trade.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
@echo off
rem --== Set default values below to prevent being asked each run ==--
set DEFAULT_CAPACITY=
set DEFAULT_LIGHTYEARS=
set DEFAULT_HOPS=
set DEFAULT_JUMPS=
set DEFAULT_AGE=
rem --== Set default values above to prevent being asked each run ==--

set /P update=Update database from maddavo? (Y\N):
if /I not "%update%"=="Y" goto menu
:update
..\trade.py import --maddavo --option=stncsv --option=syscsv -v
echo Update Complete
pause
:menu
cls
set /P menu=(U)pdate, (I)mport, (P)references or (R)un:
if /I "%menu%"=="U" goto update
if /I "%menu%"=="I" goto import
if /I "%menu%"=="P" goto preferences
if /I "%menu%"=="R" goto run
echo Invalid Selection
pause
goto menu
:preferences
set /P capacity=Capacity in Tons[%DEFAULT_CAPACITY%]:
set /P lightyears=Range in Light Years[%DEFAULT_LIGHTYEARS%]:
set /P hops=Number of station visits[%DEFAULT_HOPS%]:
set /P jumps=Number of jumps between stations[%DEFAULT_JUMPS%]:
set /P age=Max age of data in Days[%DEFAULT_AGE%]:
echo Preferences set
pause
goto menu
:import
..\trade.py import import.prices -vvv
echo Import Complete
pause
goto menu
:run
set /P credits=Credits:
set /P location=Start Location:
if "%DEFAULT_CAPACITY%"=="" if "%capacity%"=="" set /P capacity=Capacity in Tons:
if "%DEFAULT_LIGHTYEARS%"=="" if "%lightyears%"=="" set /P lightyears=Range in Light Years:
if "%DEFAULT_HOPS%"=="" if "%hops%"=="" set /P hops=Number of station visits:
if "%DEFAULT_JUMPS%"=="" if "%jumps%"=="" set /P jumps=Number of jumps between stations:
if "%DEFAULT_AGE%"=="" if "%age%"=="" set /P age=Max age of data in Days:
if "%capacity%"=="" set capacity=%DEFAULT_CAPACITY%
if "%lightyears%"=="" set lightyears=%DEFAULT_LIGHTYEARS%
if "%hops%"=="" set hops=%DEFAULT_HOPS%
if "%jumps%"=="" set jumps=%DEFAULT_JUMPS%
if "%age%"=="" set age=%DEFAULT_AGE%
..\trade.py run --cap=%capacity% --ly=%lightyears% -vvv --cr=%credits% --fr=%location% -MD=%age% --hops %hops% --jum %jumps%
pause
goto menu

0 comments on commit 8892786

Please sign in to comment.