SellingScripts

Untitled

May 24th, 2019
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. let autoCashOut = 1.33;
  2. let variance = 0.1;
  3.  
  4. let totalWagered = 0;
  5. let minWagered = 100;
  6. let bet = 1;
  7. let playerIndex = 0;
  8. let betSize = 0;
  9.  
  10. engine.onUpdate = function(prevState) {
  11. if (engine.gameState !== prevState.gameState) {
  12. switch (engine.gameState) {
  13. case 'STARTING':
  14. onStarting();
  15. break;
  16. case 'IN_PROGRESS':
  17. onStarted();
  18. break;
  19. case 'ENDED':
  20. onEnded();
  21. break;
  22. }
  23. }
  24. };
  25.  
  26. function onStarting() {
  27. autoCashOut = autoCashOut + (Math.floor(((Math.random() * variance) * 100)) / 100);
  28. if (engine.balance >= bet) {
  29. engine.placeBet(bet, autoCashOut).catch(console.error);
  30. }
  31. console.log("Our cashout will be at : " + autoCashOut);
  32. }
  33.  
  34. function onStarted() {
  35. console.log('Game started!');
  36.  
  37. }
  38. // Do some analyse from results and adjust your next strategy
  39. function onEnded() {
  40.  
  41. for (playerIndex = 0; playerIndex < engine.players.length; playerIndex++) {
  42. betSize = engine.players[playerIndex].bet;
  43. totalWagered = totalWagered + betSize;
  44. }
  45. console.log("Total Wagered: " + totalWagered + " mETH");
  46.  
  47. console.log('Game crashed at ' + engine.multiplier);
  48.  
  49. if (totalWagered >= minWagered) {
  50. bet = 1;
  51. totalWagered = 0;
  52. betSize = 0;
  53. } else {
  54. bet = 0;
  55. totalWagered = 0;
  56. betSize = 0;
  57.  
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment