[ create a new paste ] login | about

Link: http://codepad.org/ZF5Xvp1C    [ raw code | fork ]

Plain Text, pasted on Jul 5:
// AC racing by Bukz
// /map ac_complex
// view your minimap, you will see green lines that you need to run through to trigger the next checkpoint, the first checkpoint is to the right of the RVSF base
// Lap #, lap time, and lap time records will be reported as stats as you do laps on the map
checkpoints = [ "161 162 184 191" "175 188 124 125" "146 147 100 112" "120 121 72 78" "96 97 79 85" "73 79 140 141" "89 95 152 153" "104 105 153 159" "104 119 176 177" "126 132 200 201" ]

drawcheckpoint = [
  ckpt = (at $checkpoints $arg1)
  drawzone (at $ckpt 0) (at $ckpt 1) (at $ckpt 2) (at $ckpt 3)
  if (= $arg1 1) [
    if (! $gotchkpt1) [
      gotchkpt1 = 1
      += laps 1
      if (> $laps 0) [
        thislaptime = (divf (- (millis) $startlaptime) 1000)
        echo Lap (format #%1! $laps)
        echo Lap Time: $thislaptime seconds.
        
        if (> $laps 1) [
          if (<f $thislaptime $bestlaptime) [
            echo New Lap Record! Old record: $bestlaptime - New record: $thislaptime - Difference: (-f $bestlaptime $thislaptime) seconds.
            bestlaptime = $thislaptime
          ] 
        ] [ bestlaptime = $thislaptime ]
      ]
      startlaptime = (millis)
    ]
  ]
  if (= $arg1 (- (listlen $checkpoints) 1)) [
    gotchkpt1 = 0
  ]
]

checkinit mapstartalways [
  if (strcmp (curmap 1) ac_complex) [
    if (! (curteam)) [ team RVSF ]
    laps = -1
    gotchkpt1 = 0
    startmapmillis = (millis)
    startlaptime = 0
    bestlaptime = 1000000000
    drawcheckpoint 0
  ]
]

loop amt (listlen $checkpoints) [
  addmaptrigger ac_complex (format ckpt%1 (+ $amt 1)) (at $checkpoints $amt) (format "drawcheckpoint %1" (at (concat (+ $amt 1) 0) (= $amt (- (listlen $checkpoints) 1)))) []
]


Create a new paste based on this one


Comments: