Last active
October 29, 2020 21:21
-
-
Save dsetzer/d4b758d4130f3e2fc6c0788f2b94fa5f to your computer and use it in GitHub Desktop.
Utility script for use in bustabit script simulator which outputs the number of games played within a specified duration as well as the average game count.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = { | |
duration: { type: 'number', label: 'Duration (ms)', value: (1000 * 60 * 60)} // default = 1 hour | |
}; | |
// https://dsetzer.github.io/bustabit-script-simulator/ | |
let games = 0, counts = config.duration.value, avgCounts = []; | |
engine.on('GAME_ENDED', ()=>{ | |
games++; | |
if(userInfo.duration > counts){ | |
counts = userInfo.duration + config.duration.value; | |
avgCounts.push(games); | |
log(`Games Counted: ${games}, Average: ${avgCounts.reduce((a,b)=>(a+b))/avgCounts.length}`); | |
games = 0; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment