backExamples

Xelagot action script

SkullCounter Bot

requires version 2.99967 or higher
modified in June and July 2000

Use this script to count and optionally delete the objects made by the PaintBal script. Read the instructions at the begining of the script to customise it. If you chose to delete the objects they will be saved to file in xlg project format. You can use a program kindly written and made available by Andras to extract the scores from this project file, it can be downloaded at http://andras.net/tools/pbscore.zip.

You can download this script: click here.

[Head]
Type=Script
Version=2.0

[Settings]
Origin=0.000n 0.000w 0.00a 0.0°
Run

[Script]

                         ########################################
                         #        The SkullCounter Bot          #
                         #          a Xelagot script            #
                         #           third version             #
                         # (c) 1999-2000 Alex Grigny de Castro  #                       
                         ########################################

# This bot script is a complement to the PaintBall Bot
# it counts the objects dropped by the paintball bot,
# and turns them into a project that can be saved and deleted
# using the Survey Manager.
# edit $m and $d:
# $m is the model your Paintball Bot uses to drop
# $d contains part of the description field
# The variables @a and @b have the coordinates
# of the oposite corners of the world (field)

#########################################################
#          TO SAVE THE OBJECTS AUTOMATICALLY TO FILE
#          AND DELETE THEM IN THE WORLD
#########################################################
#   Test first this script to see whether it counts the
#   right objects. If it is working ok,
#   you can enable the 'delete' part of the script
#   to automatically remove all the 'skulls' or 'flames'
#   Look for the line in the script, just before the End
#   statement, some 25 lines below this one.
#   It looks like this:
#   # IfInt %c > 0 Gosub Delete
#   To enable automatic save and delete,
#   remove the # sign at the begining of that line.
#########################################################

   OnQueryBeginEvent QB
   OnQueryCompleteEvent QC
   %i = 1
   @a = "25.1n 25.1w"
   @b = "25.1s 25.1e"
   $m = "flame1.rwx"
   $d = "ejected by"
   Concat  $a "Searching, looking for skulls... model: " $d
   Say $a
   FilterClear
   FilterModel $m
   FilterDescription $d
   ProjectClear
   ProjectBackup @a @b %r
   Label Loop
   IfInt %i <= %r Goto Loop
   ResClear
   ResFromProjectFilter
   ResCount %c
   Concat $a %c " skulls counted."
   Say $a
   ProjectClear
   ProjectFromRes
   # IfInt %c > 0 Gosub Delete
End

Event QB
   # only the first query triggers this event
   Concat $a "Searching zone " %i " of " %r
   Say $a
EndEvent

Event QC
   inc %i
   IfInt %i > %r Goto QC1
   Concat $a "Searching zone " %i " of " %r
   Say $a
   EndEvent
   
   Label QC1
   Concat $a "Search completed."
   Say $a
   OnQueryBeginEvent
   OnQueryCompleteEvent
EndEvent

Sub Delete
  GetMyDir $f
  GetWorld $w
  GetDateTime !t
  GetYear $y !t
  GetMonth $m !t
  Length %L $m
  IfInt %L < 2 Concat $m "0" $m
  GetDay $d !t
  Length %L $d
  IfInt %L < 2 Concat $d "0" $d
  GetHour $h !t
  Length %L $h
  IfInt %L < 2 Concat $h "0" $h
  GetMinute $n !t
  Length %L $n
  IfInt %L < 2 Concat $n "0" $n
  GetSecond $s !t
  Length %L $s
  IfInt %L < 2 Concat $s "0" $s
  Concat $g "Paintball_" $w "_" $y $m $d $h $n $s ".xlg"
  Concat $f $f $g
  SayConcat "Saving the survey as file " $g " in the script folder..."
  ProjectSave $f
  Say Deleting them now!...
  ProjectDestroy
EndSub



backExamples