-
Hi, I am wondering if I can find quickscopes by listening for zoom in events and then adding a new listener for the kill event and readding this kill listener until a kill of the player who zoomed is found or a quickscope delay is reached. I try to build a very dynamic system with event selectors that can have conditions on top of your parser, so my code might look a little more confusing than it needs to be. But this is how I currently try to find kills after a zoom event: private checkPostEventCondition(condition: Condition, sourceGameEvent: any, demoFile: DemoFile, scene: Scene, scenes: Scene[]) {
const conditionEventSelector = condition.eventSelector(sourceGameEvent); // initalize the condition with the source game event to pass important params like a steam64Id
const conditionEventName: string = conditionEventSelector.eventName;
const endTick = scene.eventTick + Math.ceil(condition.delay! * demoFile.tickRate) // when to stop looking for the condition: sourceEventTick + delay * tickrate
function checkCondition(conditionGameEvent: any) {
const conditionScene = conditionEventSelector.selectorFunction(conditionEventSelector, conditionGameEvent, demoFile);
if (conditionScene && demoFile.currentTick < endTick) {
scenes.push(scene)
console.debug("scene accepted")
} else if (demoFile.currentTick > endTick) {
console.debug("scene rejected")
} else {
demoFile.gameEvents.once(conditionEventName, checkCondition);
console.debug("re-registering listener")
}
}
// @ts-ignore see comment above
demoFile.gameEvents.once(conditionEventName, checkCondition);
} I read the checkCondition function until the delay is reached or a matching kill is found. Its just that I think I get far to few results, as if I would miss many results. Even a 2s delay only brings a handful of matches. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Never mind, this concept seems to work perfectly now that I configured my zoomInAndKillSelector to listen for the zoom event instead of the kill event initally. So I was not searching for quickscopes but fast double kills🙄 |
Beta Was this translation helpful? Give feedback.
Never mind, this concept seems to work perfectly now that I configured my zoomInAndKillSelector to listen for the zoom event instead of the kill event initally. So I was not searching for quickscopes but fast double kills🙄