Chapter 12:  Using QuickDog Scripting Files and Building Your Own

Scripting - Definition - Using text files to create DIRECTIONS for QuickDog so that QuickDog can run automatically to BACKTEST, HANDICAP and SUPERTUNE for you while you are away from the computer.

WARNING!!! - This is a very advanced feature and can be almost like programming.  It is NOT for everyone but we do want users to be aware of this feature and use it at your own risk/reward.  We CAN NOT build scripts for you unless you would like to pay us for this service, and we can not correct the ones you create.  We can provide examples, and you can use these examples to create your own.  You will have to study and work at it.

Most of QuickDog is "point and click", and, while you might not always know what you are doing, you are always doing something.  It's pretty easy to point and click after all.  Scripting is more difficult as it requires you to WRITE commands that QuickDog will then read.  It's like creating a recipe, giving step by step directions for making a cake.

Before beginning this Tutorial, please EXIT QUICKDOG, the RESTART QUICKDOG.  

For purposes of this discussion we shall again return to our CC20001007 program which is a 13 race program.  The user should then select the "Scripting" Menu Bar item.  

See Figure 1 Below where Scripting has been selected by using the Menu Bar Item "Scripting".

Figure 1 - The Scripting Drop Down Menu

Scripting is an ADVANCED feature because most QuickDog Users are not programmers, and scripting is like programming.  We've tried to make it straightforward and have provided examples of some scripts you might find helpful, but if you want to create your own scripts, well, you will be on your own but hopefully the samples will lead you in the right direction.  In addition, you can consult other QuickDog users on the forum.  

This tutorial explains how to edit, then select your scripts so that they will run while you go do something fun, like mow the grass!   First, let's take a look at a sample script provided.  Click on "Edit Script" and some sample script files will appear on the selection Menu.

Figure 2 - Sample Script Files

Select the line containing "GGSAMPLE".  A notepad window will pop up and you will be looking at the script file.

Figure 3 - A Sample Script File - GGSAMPLE.SCRIPT

The first thing you should do is use the FORMAT feature of Notepad, to UNCHECK the WORD WRAP.  You will then see each scripting command line by line the way QuickDog will read it.  After you've done that, then we can look at each line, and perhaps you'll get a feel for how to use script files.

Figure 4 - Word Wrap TURNED OFF

Now that Word Wrap has been turned off, let's talk about QuickDog's Scripting "language".

First, QuickDog ignores all lines which begin with an ASTERISK character '*'.  Notice the first 12 lines of this script file begin with an asterisk.  These are referred to as COMMENT LINES and you can use them freely as notes to yourself.  The 13th line is a BLANK LINE, and QuickDog will ALSO IGNORE all blank lines.  So, you may use BLANK LINES to create spacing in your script file.  You should read all the comment lines of our sample script files because they describe what the real script file lines do.  What are "real" script file lines?

Those that don't have an asterisk at the beginning and are not BLANK.  These are SCRIPT COMMANDS which QuickDog will perform when you "Run a Script File".  And these commands are what YOU MUST UNDERSTAND in order to use scripting properly.  Not using them properly can result in QuickDog doing things wrong, or even BOMBING OUT!!!

Though our samples include all the commands you may use in a Script File, we will explain them further here.  The command is shown in BOLD letters, then it is explained.  For examples of how it is used, see the sample script files included in QuickDog.  There is also one example included for each description below.  That sample is in BOLD letters after the "Ex:" characters.  The best way to learn scripting is by using our sample scripts and making changes to them.  When you do, make sure you RENAME the scripts to some name that you create as these scripts are included in the UPDATE versions of QuickDog.  If you don't create your own scripts and use these names, like ggsample.script, then all your changes will be overwritten next time you download.  Use notepad to change the name!!  And be careful when using NOTEPAD as it defaults to placing a ".TXT" after every file, unless you change the file type box to ALL FILES.

Renaming Example:  You EDIT ggsample.script.  You want to change the name to pb.script because you've changed it to Palm Beach. Do a SAVE AS, a window will popup allowing you to change the name.  Change the name to pb.script, then look below that name for the FILE TYPE box, and it will probably say *.txt, change this to ALL FILES before you SAVE!!  Otherwise your file will be called pb.script.txt and QuickDog will NOT find it.

Script File Commands:

backtest - This command BACKTESTS the currently select method (see style command) and uses the multiple setup commands (races, dates, perf, grade, dist, etc.).  Without any other words with this command, the assumption is you wish to tune all types of races, to create one track profile as identified by the other commands used already.  However, you may tune various distances and grades using the backtest distance command.

backtest distance - This command allows you to specify a single distance, and all/some grades at that distance to BACKTEST several track profiles with only one scripting command.  Ex:  tune distance 5-16 grades M J D C B AA A will tune the track profiles for 5-16M, 5-16J, 5-16D, etc...

begin date - for BACKTEST/SUPERTUNE the starting date which defines what programs you wish to use.  You may enter the mm/dd/yy value, for example, 05/16/03 or if you leave it blank, then it represents either the most recent date which is today's date, or the date of the oldest program you have.  This depends on the value of the "set fwd" command (see "set fwd"). Ex: begin date 05/01/03

begin date minus - for BACKTEST/SUPERTUNE , rather than specific a date, you use "minus 10" to indicate 10 days before today's date.  Ex: begin date minus 40

convert - perform a convert of the race programs/results charts which have been downloaded from the Internet.  You must specify either a REBUILD or UPDATE.  Ex: convert update will convert new programs/charts, and convert rebuild will rebuild your entire database using your .TAB files and any new programs/charts.

create base data - this command will tell QuickDog to calculate the base data for the track indicated by the last program mask command used.  It will limit that to the dates specified in the number of variants races command.   It will also limit that to the dates specified in the last begin date and end date command.

create base data all - this command will tell QuickDog to calculate ALL base data for ALL tracks in your database.  It will limit that to the dates specified in the number of variants races command.   It will also limit that to the dates specified in the last begin date and end date command.

create daily variants - this command will tell QuickDog to calculate all the Daily Variants indicated by the last program mask command used.  It will limit that to the dates specified in the last begin date and end date command.

create daily variants all - this command will tell QuickDog to calculate all daily variants for ALL tracks in your database.   It will limit that to the dates specified in the last begin date and end date command.

dist - this command is used to select which track profiles you wish to SUPERTUNE or BACKTEST.  You simply set dist no or dist yes.  Setting dist no is the same as setting DISTANCE to no on the TRACK PROFILE setup display on the CONVERT menu.  Ex: perf yes

end date - for BACKTEST/SUPERTUNE the ending date which defines what programs you wish to use.  It is entered in the same way the "begin date" is entered, and if left blank, represents the most recent or the oldest date of your data depending on the value of the "set fwd" command (see "set fwd").  Ex: end date 05/16/03

end date minus - for BACKTEST/SUPERTUNE, rather than a specific date, you can specify "minus 10", for example, to mean the end date is today's date minus 10 days.  Any number of days can be used.  Ex: end date minus 10

grade - this command is used to select which track profiles you wish to SUPERTUNE or BACKTEST.  You simply set grade no or grade yes.  Setting grade no is the same as setting GRADE to no on the TRACK PROFILE setup display on the CONVERT menu.  Ex: grade yes

initialize - This command will reset all the Weighting factors for a particular method to 1.0.  You might use it prior to SUPERTUNING with you script file, but it is NEVER necessary.  You may also set individual weighting factors using the set command along with the name of the weighting factor to use.  See sample script files for those individual names.  To use the initialize command, simply specify the name of the method.  If you wish to initialize one of your own methods, use its name, but also put method = before the name.  Otherwise, the method names to use are STANDARD, KNIFE, KNIFEADAPTED, MORGAN, and CONSENSUS.  Ex: initialize MORGAN Ex: You own method initialize method = mymethod

method - the method of display in BACKTEST or SUPERTUNE.  This has NOTHING TO DO WITH METHOD BUILDING!!  Valid settings are A, B, or C, just as you do on the BACKTEST display.  When using a B, you must also follow that up with a number from 1 to 8.  Ex: method B 1

number of backtest races - this is pretty self explanatory.  It's simply that NUMBER RACES setting you've been clicking in on the BACKTEST display.  Ex: number of backtest races 200 means a maximum of 200 races will be used, but no races will be used outside of the begin and end dates, so you may get less than 200 races.

number of variants races - this is pretty self explanatory.  It's simply that NUMBER RACES setting you've been clicking in on the Variants display for the creation of either your BASE DATA or Daily Variants (see the Help on VARIANTS for more information).  Ex: number of variants races 9999 means a maximum of 200 races will be used, but no races will be used outside of the begin and end dates, so you may get less than 200 races.

perf - this command is used to select which track profiles you wish to SUPERTUNE or BACKTEST.  You simply set perf no or perf yes.  Setting perf no is the same as setting PERFORMANCE to no on the TRACK PROFILE setup display on the CONVERT menu.  Ex: perf yes

profile - the profile command allows you to specify the folder where your initialization data and weighting factors will come from.  The folder name must exist and will begin with the letters "TP_" and end with the name you provide in the command.  Ex:  profile testvalues  This command will select and create if necessary,  the folder tp_testvalues.  All track profiles created after this point in the script file by way of SUPERTUNE will be created in this folder.  This command will AUTOMATICALLY set the "read track profiles = yes" command (see below).

program mask - this command tells QuickDog which race programs (track/performance) to use when BACKTESTING/SUPERTUNING.  When you use QuickDog, you first selected a TRACK, then you selected a race program, which was either Evening or Matinee, and BACKTEST/SUPERTUNE worked with these programs.  This command is the way the scripting process makes these selections.  Ex:  program mask gg????????e means use all evening performances at Gulf Greyhound Park.  You may change our sample scripts to fit your track by simply changing the TRACK ID.

quit - you may insert this command ANYWHERE within a script you are testing, to STOP IT!  It is best, when building a script to write some of it, then test it, then write more, then test it.  If you wish to learn from the scripts we've provided, then simply put the quit command anywhere in it to make it stop at any point, so that you can see what its done.

read track profiles - the settings for this command are either " = yes" or " = no".  What this command does is tell QuickDog NOT to read Track Profiles prior to a "tune" command.  Typically, after selecting a race, QuickDog will READ its associated TRACK PROFILE.   This command will STOP the reading of the TRACK PROFILE.  QuickDog automatically sets read track profiles = no when you use a SET command.  The assumption is that you don't wish to make settings, then have QuickDog simply READ in the TRACK PROFILE, thereby wiping out those settings.  Some other scripting commands will AUTOMATICALLY set this command to read track profiles = yes.

set - the set command is used to initialize all the settings you wish to use within a handicapping method.  Once you have worked with a handicapping method, these settings should make sense to you.  They have been named so that they should be easy to figure out.  Below are shown lines from the "SCRIPTFILE.SCRIPT" file.  These lines set your weighting factors.   Note the names of the "variables" which are used.  You must spell these out precisely or nothing will happen.  Also note that these values will be changed by the SUPERTUNE process, which you can script using the tune command.  See the SCRIPTFILE.SCRIPT file for the other set commands which are possible.  For example, setting the number of races to use in the Standard Method - set S_RACES_CONSIDERED 12, etc.  This command AUTOMATICALLY sets the "read track profiles = no" command.

* The following sets all weighting factors to 1.0 which is
* the same as the above INITIALIZE commands. But you can 
* set whatever the values to whatever you want
*
set S_WF_SPEED 1.0
set S_WF_EARLY 1.0
set S_WF_MAN 1.0
set S_WF_LATE 1.0
set S_WF_MONEY 1.0
set S_WF_CLASS 1.0
set S_WF_ODDS 1.0

* Set KNife Weighting Factors
set K_WF_TIME 1.0
set K_WF_BREAK 1.0
set K_WF_EARLY 1.0
set K_WF_LATE 1.0
set K_WF_WPS% 1.0
set K_WF_CLASS 1.0
set K_WF_STARTS 1.0
set K_WF_BESTTIME 1.0

* Set Knife Adaped Weighting Factors
set KA_WF_TIME 1.0
set KA_WF_BREAK 1.0
set KA_WF_EARLY 1.0
set KA_WF_LATE 1.0
set KA_WF_WPS% 1.0
set KA_WF_CLASS 1.0
set KA_WF_STARTS 1.0
set KA_WF_BESTTIME 1.0

* Set Morgan Displayed Weighting Factors
set M_WF_PPP 1.0
set M_WF_IGRD 1.0
set M_WF_BRK 1.0
set M_WF_18TH 1.0
set M_WF_STR 1.0
set M_WF_FIN 1.0
set M_WF_GAIN 1.0
set M_WF_FORM 1.0
set M_WF_CLASS 1.0
set M_WF_TIME 1.0
set M_WF_BTIM 1.0
set M_WF_WPS% 1.0
set M_WF_%TRB"
*Set Morgan PPP Weighting Factors
set M_WF_PPP_BRK 1.0
set M_WF_PPP_18TH 1.0
set M_WF_PPP_STR 1.0
set M_WF_PPP_FIN 1.0
set M_WF_PPP_GAIN 1.0
set M_WF_PPP_FORM 1.0
set M_WF_PPP_TIME 1.0
set M_WF_PPP_BTIM 1.0
set M_WF_PPP_WPS% 1.0
set M_WF_PPP_%TBR 1.0
*Set Morgan INGRADE Weighting Factors
set M_WF_INGRADE_BRK 1.0
set M_WF_INGRADE_18TH 1.0
set M_WF_INGRADE_STR 1.0
set M_WF_INGRADE_GAIN 1.0
set M_WF_INGRADE_FORM 1.0
set M_WF_INGRADE_TIME 1.0
set M_WF_INGRADE_BTIM 1.0
set M_WF_INGRADE_WPS% 1.0
set M_WF_INGRADE_%TBR 1.0
*Set Morgan Form Weighting Factors
set M_WF_FORM_EARLY 1.0
set M_WF_FORM_MID 1.0
set M_WF_FORM_LATE 1.0
set M_WF_FORM_FIN 1.0
*Set Morgan Gain Weighting Factors
set M_WF_GAIN_EARLY 1.0
set M_WF_GAIN_MID 1.0
set M_WF_GAIN_LATE 1.0

*Set Consensus Weighting Factors
set C_WF_STANDARD 1.0
set C_WF_KNIFE 1.0
set C_WF_KNIFE_ADT 1.0
set C_WF_MORGAN 1.0

* Set Supertune Precision and Algorithm - First number (5 in the example) 
* tells how many passe to make before quitting the SUPERTUNE process 
* when none of the Weighting Factors change during the pass. For example, 
* if QuickDog is supertuning a method, gets a high score, then goes through
* 5 more loops without getting a better result, then it will stop rather 
* than go on to 100. If it does find a better value, then the count will 
* start over again. The second number (1 in this example) gives the SUPERTUNE
* ALGORITHM to use. A '1' means H-L (HIGH TO LOW), '2' - Mean L-H (LOW TO HIGH)
* and nothing (or '0' - ZERO), means Top to Bottom Method - See the HELP file
* on the BACKTEST Menu for information on SUPERTUNE ALGORITHM.

set SUPERTUNE_PRECISION 5 1

set CLASS_TABLE_FILE \jaidogs\myclasstable.fil

set fwd - Set the direction of BACKTEST/SUPERTUNE from "begin date" forward to "end date" or "begin date" backward to "end date".  A "set fwd 1" means that BACKTEST/SUPERTUNE will process races from the "begin date" FORWARD day by day to the "end date".  This means that the "begin date" is earlier than the "end date". A "set fwd 0" means that BACKTEST/SUPERTUNE will process races from the "begin date" backward day by day to the "end date".  This will tell QuickDog that the "begin date" you enter will be the most recent date, and that the "end date" you enter will be the earlier date.  Some users don't care the order in which the results are tested, and some do.  The fastest method is "set fwd 0".  Ex:  set fwd 0 or set fwd 1

sub-methods - The Morgan method has 5 different areas that must be tuned to tune the entire method.  This command selects which one you wish to tune.  You may use gain, form, ingrade, ppp, or display or all/some of these.  Ex:  sub-methods gain form ingrade ppp will select these four sub-methods of Morgan to be tuned.  Ex: sub-methods display will tune the display Morgan values.

style - this command selects the Method you wish to SUPERTUNE/BACKTEST or Handicap.  Simply specify the method, STANDARD, KNIFE, KNIFEADAPTED, MORGAN, CONSENSUS or your own Custom Method name.  If you are using your own method, use method = before the name of the method.  Ex: style method = mymethod or style STANDARD

target - for a supertune operation, target is the A, B, C, D, etc. which corresponds to a "Target Value", that value you wish to MAXIMIZE when SUPERTUNING - See SUPERTUNE.  Ex:  target E means the value to maximize is the "wager 1 win %"

tune - This command SUPERTUNES the currently select method (see style command) and uses the multiple setup commands (races, dates, perf, grade, dist, etc.).  Without any other words with this command, the assumption is you wish to tune everything to create one track profile.  However, you may tune various distances and grades using the following command.

tune distance - This command allows you to specify a single distance, and all/some grades at that distance to SUPERTUNE several track profiles with only one scripting command.  Ex:  tune distance 5-16 grades M J D C B AA A will tune the track profiles for 5-16M, 5-16J, 5-16D, etc...

wager - simply set your wager as you did on the BACKTEST/SUPERTUNE displays but afterwards, enter the actual cost of the wager you wish to make.  Ex: wager 12345/12345/12345 $1 means the wager you wish to BACKTEST/SUPERTUNE is a 12345 trifecta box using Quickdog's first 5 top picks for each race with a $1 wager.

As always we invite your questions and comments via email - jai@gorge.net


Copyright 2003 JONSOG associates, Inc. PO Box 911, Lyle, WA 98635  Last Updated on - 11/30/2003