1
var quantidade = "200";
setInterval(function(){
var tempo = document.getElementById("banner").textContent;
var match = tempo.match(/[^\d](\d+)/);
var nr = match && match[1];
if(nr === "5"){
var red = document.getElementById("red").textContent;
var green = document.getElementById("green").textContent;
var black = document.getElementById("black").textContent;
if(red>black){
var corfinal = "black";
$("#enviarpreto").click();
}else{
var corfinal = "red";
$("#enviarvermelho").click();
}
}
if(tempo[5] === "d"){
var red2 = document.getElementById("red").textContent;
var green2 = document.getElementById("green").textContent;
var black2 = document.getElementById("black").textContent;
var meured = document.getElementById("meured").textContent;
var meublack = document.getElementById("meublack").textContent;
if(meured < 0){
quantidade = quantidade*2;
}else if(meupreto < 0){
quantidade = quantidade*2
}else{
quantidade = 200;
}
document.getElementById('betAmount').value = quantidade;
}
}, 1000);
What I intend to do is that when the time condition[5] === d happens, it will multiply if those values are negative. But I just want you to multiply it once. But we have a problem as it is in setinterval, it is constantly multiplying, because the time[5], is for 4 seconds.
How can I so that it only makes me 1x?
Thank you.
A hint, indenting the code helps to find any errors in it. It won’t necessarily make you find the mistake, but it will reduce the effort needed to get there.
– Oralista de Sistemas
Thanks for the tip Renan!
– Gonçalo