Author Topic: A function behaving differently in situations where it shouldn't.  (Read 1545 times)

Okay, so I'm trying to recode one of my add-ons because it's broken with default add-ons. In the process, I decided to use Clockturn's LoopHandler resource. Anyways, my problem is that this function:

--Figured it out--
« Last Edit: February 13, 2013, 11:06:32 AM by Daenth »

For starters, utilize return; rather than nesting a ton of if/else statements within each other. Try running trace to get a better idea what's going on with the packages. Also, you have several echos in there, so what's coming up in the console in each scenario?

For starters, utilize return; rather than nesting a ton of if/else statements within each other. Try running trace to get a better idea what's going on with the packages. Also, you have several echos in there, so what's coming up in the console in each scenario?
Fairly late, but I did a ton of debugging and managed to get down to the bottom of it. For some reason, cancel() doesn't appear to be registering. Using trace and debugging, I find that everything is working perfectly (it's telling me the function to pause the loop was called and it ran correctly) except that cancel() for the .pause() function is not working and it's throwing everything off. Is there any reason why it's doing this? It's working in normal circumstances. I can post the log if needed, but the snippet is fairly lengthy.


Well, I figured it out. I changed serverCmdLight(%pl.client); inside the flEnergyDrain() function to schedule(1,0,serverCmdLight,%pl.client); and it works. I have no idea why it works though.

Well, I figured it out. I changed serverCmdLight(%pl.client); inside the flEnergyDrain() function to schedule(1,0,serverCmdLight,%pl.client); and it works. I have no idea why it works though.
congralutions - you're most of the way to becoming a normal programmer.