I know this has been reported before, but I couldn't find it, so I'm going to report it here again. It's definitely something to fix in the NPC-Server.
I have a level NPC that joins to a class, inside of the class I have:
PHP Code:
function onPlayerEnters() {
testFunc();
}
function testFunc() {
for (temp.i=1;temp.i<4;temp.i++){
sendrpgmessage(temp.i);
sleep(1);
}
}
It sends the RPG message to me as:
If I remove the sleep from the for loop, it will return:
Which is correct.
Now, if I do:
PHP Code:
function onPlayerEnters() {
testFunc();
}
function testFunc() {
for (temp.i=1;temp.i<4;temp.i++){
findplayer("Tigairius").sendrpgmessage(temp.i);
sleep(1);
}
}
It returns:
No problem! (Thanks Ziro for helping me figure that out.) Sleep is causing the function to lose scope of the player. I spent hours trying to figure this out.
Time I could have spent progressing further in the script!
It definitely needs to be fixed please!!!