3
Good afternoon, I’m new here and I’m using the Javascript Scratchpad of Mozila Firefox to execute codes Javascript. It will really meet my needs, however the stop condition of the while loop is not working (for also didn’t work). In addition, the variable i
is not having its value increasing, preventing any value beyond the first of the array
be used. I thank you for any reply, thank you.
Follows the code:
window.setInterval(function () {
var inputs = [ 10595, 10243, 11514, 11053, 10449, 10208, 11160, 10970, 10706, 11075, 10400, 10112, 10086, 10503, 11910, 12110, 11537, 9694, 12112, 10793, 11728, 9532, 10389, 12983, 9533, 12424, 10697, 11997, 12121, 11606, 10526, 9729, 10143, 11737, 10025, 10700, 11564, 12623, 9324, 11761, 10008, 11780, 10105, 12230, 12489, 12649, 9083, 11192, 10010, 10984, 12075, 12075, 11026, 12194, 12335, 10035];
var i = 0;
do {
Accountmanager.farm.sendUnits(this, inputs[i], 4202);
i++;
}
while (i < 5)
}, 250);
I understand, the problem was the interval, but I still want before every while cycle, there to be a delay, how to proceed?
– Madson Paulo
Every few seconds you want him to send the data to this Accountmanager of yours?
– Laerte
I need that every x seconds it sends the accoun command... with the value of i incremented. I even tested his code and he only ran 1x the loop :(
– Madson Paulo
What you were doing is that every quarter mile he sent EVERYONE, not one. @Madsonpaulo
– bfavaretto
The code I was using, posted on top, sent every 250ms the command with the value of the array at the position i=0.
– Madson Paulo
No, he tried to send all the values of
i
every 250ms.– bfavaretto
@Madsonpaulo the interval is not a
Thread.sleep
No, you call everyone asynchronously– Maicon Carraro