Difference between revisions of "User:DavidJCobb/Stack dumping"
m
→Process a task OnHit, and wait for X seconds during or after the task: wording
imported>DavidJCobb |
imported>DavidJCobb |
||
Line 44: | Line 44: | ||
This simple example blocks concurrent calls, and replaces a Utility.Wait(X) call with a RegisterForSingleUpdate(X) call. If we used Utility.Wait(X), we'd suspend our stack for X seconds; by using RegisterForSingleUpdate and OnUpdate, we get rid of the stack entirely during those X seconds, and create a new stack to continue processing after the delay. | This simple example blocks concurrent calls, and replaces a Utility.Wait(X) call with a RegisterForSingleUpdate(X) call. If we used Utility.Wait(X), we'd suspend our stack for X seconds; by using RegisterForSingleUpdate and OnUpdate, we get rid of the stack entirely during those X seconds, and create a new stack to continue processing after the delay. | ||
Even if we didn't prevent concurrency using <code>pbBusy</code>, we'd still get rid of all OnHit stacks at the start of the wait, and create just one OnUpdate stack at the end of the wait; however, with every hit, the wait time would be reset to X seconds. | Even if we didn't prevent concurrency using <code>pbBusy</code>, we'd still get rid of all OnHit stacks at the start of the wait, and create just one OnUpdate stack at the end of the wait; however, with every hit, the wait time would be reset to X seconds. Whether or not we block concurrent calls, hits that occur during the wait time will be ignored. | ||
<source lang="Papyrus"> | <source lang="Papyrus"> |