Skip to content

Commit

Permalink
add crosshair codes example
Browse files Browse the repository at this point in the history
  • Loading branch information
LaihoE committed Nov 7, 2023
1 parent 8944126 commit 56cc7f1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/crosshair_codes/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var {parseEvent, parseTicks} = require('@laihoe/demoparser2');


const pathToDemo = "path/to/demo.dem";

let gameEndTick = Math.max(...parseEvent(pathToDemo, "round_end").map(x => x.tick))
let players = parseTicks(pathToDemo, ["crosshair_code"], [gameEndTick])

console.log(players)
9 changes: 9 additions & 0 deletions examples/crosshair_codes/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from demoparser2 import DemoParser
import glob


parser = DemoParser("path/to/demo.dem")

last_tick = parser.parse_event("round_end")["tick"].to_list()[-1]
df = parser.parse_ticks(["crosshair_code"],ticks=[last_tick])
print(df)

0 comments on commit 56cc7f1

Please sign in to comment.