Jump to content

Is There a Function to Check Previous Round Result?


Tom12345
 Share

Recommended Posts

Hello everyone, as a newcomer to scripting for the crash game, I'm seeking information on whether there's a function to check the outcome of the previous round. To clarify, I intend to monitor the result of the preceding round, where I didn't place a bet. for example, If the outcome is less than 2x, then the script should place a bet in the next round. 

Edited by Tom12345
add more information
Link to comment
Share on other sites

The easiest way to do this is to use game.history, that property is an array of the last 20 games and their results.  Here is an simple example you can throw right into the crash script are and play with. Note that if you want only the previous game is will always be at index 0 of history. so game.history[0].crash is the value you want but noticed it is actually 100x larger than what is displayed but with no decimal.  I trust you should be able to take it from here.

 

var config = {
  baseBet: { label: "base bet", value: 0.1, type: "number" },
  payout: { label: "payout", value: 10, type: "number" },
  stopLossPercentage: { label: "Percentage of bankroll to lose before stop.", value: 75, type: "number"}
};

function main() {

  var target = config.payout.value * 100;
  var currentBet = config.baseBet.value;
  
  game.onBet = function () {
  
	var balance = currency.amount;
	var minBet = currency.minAmount;
	var maxBet = currency.maxAmount;
  
		for(i=19; i >= 0; i--)
		{
			let crashValue = game.history[i].crash;

			log.info(crashValue);
		}
	  
	  if(true)
	  {
		// short circuiting this so that it doesn't actually bet put adding the bet and result handling for an example.
		return;
	  }
	  
		game.bet(config.bet.value, config.payout.value).then(function(payout) 
		{
			if(payout > 1) 
			{
				log.success("We won, payout " + payout + "X!");
			} 
			else 
			{
				log.error("We lost, payout " + payout + "X!");
			}
		});
  }

}

 

Link to comment
Share on other sites

23 hours ago, Skele said:

The easiest way to do this is to use game.history, that property is an array of the last 20 games and their results.  Here is an simple example you can throw right into the crash script are and play with. Note that if you want only the previous game is will always be at index 0 of history. so game.history[0].crash is the value you want but noticed it is actually 100x larger than what is displayed but with no decimal.  I trust you should be able to take it from here.

 

var config = {
  baseBet: { label: "base bet", value: 0.1, type: "number" },
  payout: { label: "payout", value: 10, type: "number" },
  stopLossPercentage: { label: "Percentage of bankroll to lose before stop.", value: 75, type: "number"}
};

function main() {

  var target = config.payout.value * 100;
  var currentBet = config.baseBet.value;
  
  game.onBet = function () {
  
	var balance = currency.amount;
	var minBet = currency.minAmount;
	var maxBet = currency.maxAmount;
  
		for(i=19; i >= 0; i--)
		{
			let crashValue = game.history[i].crash;

			log.info(crashValue);
		}
	  
	  if(true)
	  {
		// short circuiting this so that it doesn't actually bet put adding the bet and result handling for an example.
		return;
	  }
	  
		game.bet(config.bet.value, config.payout.value).then(function(payout) 
		{
			if(payout > 1) 
			{
				log.success("We won, payout " + payout + "X!");
			} 
			else 
			{
				log.error("We lost, payout " + payout + "X!");
			}
		});
  }

}

 

Hey Skele, it worked for me, thanks a lot!

Just one more question: is there a reference where I can find all the existing variables that I can use in my script? For example, how can I retrieve the available amount?

Link to comment
Share on other sites

3 hours ago, Tom12345 said:

Hey Skele, it worked for me, thanks a lot!

Just one more question: is there a reference where I can find all the existing variables that I can use in my script? For example, how can I retrieve the available amount?

 

hm,.zhčlbz

logo.png

Link to comment
Share on other sites

Nope your reference is going to be writing out properties to their log function if you want to keep it in their sandbox environment. The only documentation. Is the few paragraphs in the scripting menu. 

Link to comment
Share on other sites

You need to be a member in order to leave a comment

Sign up for a new account in our community. It's easy!

Register a new account

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...