![]() |
Sleep() drops scope!
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:
HTML Code:
1HTML Code:
1Now, if I do: PHP Code:
HTML Code:
1It definitely needs to be fixed please!!! |
Agreed.
|
this used to piss me off all the time and I could never figure out how to fix it D:
|
Definitely needs to be fixed. I had a system that, since I had no clue about what I was doing wrong, had to not use a loop, which sucked because only a number was changing.
Also, maybe sleep could not be interrupted (or keep going) when using another function? |
The first example seems to work fine for me. I'm using a WNPC. Would that make a difference?
|
Yea I noticed this a long time ago myself. And I don't remember reporting it either; my attitude towards the lack of updates is probably why.
|
Quote:
Quote:
|
The loss of scope when using sleep has been a problem with the script engine since day one, I am not sure how easy it is to fix if it is some kind of delayed scheduling. Does it also occur while using waitfor?
|
Quote:
|
You could use scheduleEvent() alternatively, couldn't you?
|
Quote:
|
Maybe there's a way to store the reference to the player? I don't know exactly how it is done on graal, but something amongst the lines...
PHP Code:
|
Yes you can also do temp.pl = player and then use temp.pl.
Currently triggered events are keeping care of the player scope (scheduleevent, trigger, etc.) but not functions that suspend the script executing (sleep, waitfor). This has always been like that, but might be good to fix it someday. |
I almost find this scary. Sure, there are workarounds, but it's a bit frightening how it loses scope like that.
|
Quote:
|
| All times are GMT +2. The time now is 09:48 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.