Quote:
Originally Posted by Devil_Lord2
PHP Code:
else if (player.account in this.tempStaff){
for (temp.a=0; a < this.tempStaff.size(); a++){
if (player.account == this.tempStaff[a] && player.level == this.tempStaff[a+1]){
for (temp.i=0; i < params[1].size(); i++){
|
Do you realise you have 2 conditions which are exactly the same?
If you were to remove the first line of player.account in this.tempStaff, it would still work.
player.level is an object rather than a string, the correct value to check is 'player.level.name'.
It's a bad practise to loop through non-changing arrays and use .size(); for every cycle, as the function will occur every time rather than once, this can generate a lot of overhead with very large arrays. The array size can be defined as a temporary variable beforehand, which can then be used in the loop condition.
Quote:
Originally Posted by Devil_Lord2
However, my friend is trying to create a baddy using a specific algorithm and he is having problems with maxing out the loop only if he doesn't add a sleep .05 in..
I believe he wants something like an onTimeout calling an onTimeout right after the end of checking... Perhaps that is the same problem? I don't know. I doubt he will post on the forums though..
|
onTimeout(); occuring within function onTimeout(){} without any specification for it would run infinitely until cancelled by the engine/NPC-Server.