Scripting Examples for Mulitple Top10 Outputs

From Geoqo
Revision as of 15:00, 6 April 2007 by Yamar (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

brdad wanted to do this:

 I'd like to list the top ten cache placers, and for each of those placers, I'd like to have the stats for their placed caches.

Which can functionally be done with a script called multiple times. (ie, geoqo can't do exactly what he wants in one pass; there's a todo item!)

Create a script in $HOME/.geoqo/scripts/mytop10 that looks like:

Contents

Creating a Top10 Script to Display Information for a Cache Owner

 %search
 cache:owner_name==%[Owner]

 %print
 ======================================================================
 %print
 STATS FOR CACHES MADE BY %[Owner]

 %display
 top10:groundspeak_container

 %display
 top10:groundspeak_difficulty

 %display
 top10:groundspeak_terrain

Then you can run the script on multiple people by hand:

 > geoqo -x mytop10:Owner=Spelunk
 ======================================================================
 STATS FOR CACHES MADE BY Spelunk
 Top 10 'groundspeak_container's
  Num    % Value
 ----------------------------------------------------------------------
    8   40 Small
    4   20 Regular
    4   20 Micro
    3   15 Other
    1    5 Not chosen
 Top 10 'groundspeak_difficulty's
  Num    % Value
 ----------------------------------------------------------------------
    7   35 1.5
    5   25 2
    4   20 3
    2   10 1
    1    5 4
    1    5 2.5
 Top 10 'groundspeak_terrain's
  Num    % Value
 ----------------------------------------------------------------------
    8   40 1
    6   30 1.5
    4   20 2
    2   10 2.5

Calling That Script On Multiple Cache Owners

You could also creat a script to run that script multiple times for a given set of people, say in $HOME/.geoqo/scripts/mytop10s (note the ending 's').

 %script
 mytop10:Owner=Spelunk
 %script
 mytop10:Owner=Yamar
 %script
 mytop10:Owner=47Dad47

Then you could call that for everyone quickly:

 > geoqo -x mytop10s
 ======================================================================
 STATS FOR CACHES MADE BY Spelunk
 Top 10 'groundspeak_container's
  Num    % Value
 ----------------------------------------------------------------------
    8   40 Small
    4   20 Regular
    4   20 Micro
    3   15 Other
    1    5 Not chosen
 Top 10 'groundspeak_difficulty's
  Num    % Value
 ----------------------------------------------------------------------
    7   35 1.5
    5   25 2
    4   20 3
    2   10 1
    1    5 4
    1    5 2.5
 Top 10 'groundspeak_terrain's
  Num    % Value
 ----------------------------------------------------------------------
    8   40 1
    6   30 1.5
    4   20 2
    2   10 2.5
 ======================================================================
 STATS FOR CACHES MADE BY Yamar
 Top 10 'groundspeak_container's
  Num    % Value
 ----------------------------------------------------------------------
   17   47 Micro
   13   36 Regular
    4   11 Small
    1    2 Not chosen
    1    2 Other
 Top 10 'groundspeak_difficulty's
  Num    % Value
 ----------------------------------------------------------------------
   14   38 2
    9   25 1.5
    6   16 1
    3    8 2.5
    2    5 3
    1    2 4
    1    2 3.5
 Top 10 'groundspeak_terrain's
  Num    % Value
 ----------------------------------------------------------------------
   16   44 1.5
   15   41 1
    5   13 2
 ======================================================================
 STATS FOR CACHES MADE BY 47Dad47
 Top 10 'groundspeak_container's
  Num    % Value
 ----------------------------------------------------------------------
   33   54 Regular
   22   36 Micro
    2    3 Not chosen
    2    3 Small
    2    3 Large
 Top 10 'groundspeak_difficulty's
  Num    % Value
 ----------------------------------------------------------------------
   28   45 2
   14   22 1
   13   21 3
    3    4 2.5
    1    1 4
    1    1 3.5
    1    1 1.5
 Top 10 'groundspeak_terrain's
  Num    % Value
 ----------------------------------------------------------------------
   22   36 1
   11   18 2
   11   18 4
   10   16 3
    3    4 3.5
    2    3 2.5
    1    1 4.5
    1    1 1.5


Auto-calling on Top10 List Output itself

You can also call a script once per Top10 output, so if you were searching for the top10 cache placers in an area you could then call your mytop10 script above on each of those automatically by using the script= flag as follows (%s gets replaced by the current top 10 value):

 %search
 set:import:nearme
 %display
 top10:groundspeak_owner_name,script=mytop10:Owner=%s,show=3

And the results when called with geoqo -x script:

 ======================================================================
 STATS FOR CACHES MADE BY DaveX
 Top 10 'groundspeak_container's
  Num    % Value
 ----------------------------------------------------------------------
   14   51 Micro
    6   22 Small
    4   14 Regular
    3   11 Not chosen
 Top 10 'groundspeak_difficulty's
  Num    % Value
 ----------------------------------------------------------------------
   11   40 1.5
    9   33 2
    6   22 1
    1    3 5
 Top 10 'groundspeak_terrain's
  Num    % Value
 ----------------------------------------------------------------------
   19   70 1.5
    7   25 1
    1    3 3.5
 ======================================================================
 STATS FOR CACHES MADE BY BootyBuddies
 Top 10 'groundspeak_container's
  Num    % Value
 ----------------------------------------------------------------------
   23   63 Micro
    5   13 Regular
    5   13 Small
    3    8 Other
 Top 10 'groundspeak_difficulty's
  Num    % Value
 ----------------------------------------------------------------------
   11   30 1.5
    8   22 2
    6   16 1
    6   16 3
    4   11 2.5
    1    2 4
 Top 10 'groundspeak_terrain's
  Num    % Value
 ----------------------------------------------------------------------
   19   52 1.5
    9   25 1
    7   19 2
    1    2 2.5
 ======================================================================
 STATS FOR CACHES MADE BY sailorscodgers
 Top 10 'groundspeak_container's
  Num    % Value
 ----------------------------------------------------------------------
   15   60 Micro
    5   20 Small
    4   16 Regular
    1    4 Virtual
 Top 10 'groundspeak_difficulty's
  Num    % Value
 ----------------------------------------------------------------------
   13   52 2
    5   20 1
    5   20 1.5
    1    4 3.5
    1    4 2.5
 Top 10 'groundspeak_terrain's
  Num    % Value
 ----------------------------------------------------------------------
   21   84 1
    4   16 1.5
 Top 3 'groundspeak_owner_name's
  Num    % Value
 ----------------------------------------------------------------------
   22    4 DaveX
   21    4 BootyBuddies
   20    4 sailorscodgers

Note the bug though: currently the main top10 output for the top 3 cache placers in the parent script is actually displayed last, and each script run happens first...


Tips and Tricks

Personal tools