BeBot - An Anarchy Online and Age Of Conan chat automaton
Development => Coding and development discussion => Topic started by: Glarawyn on April 25, 2006, 08:01:28 pm
-
Code on Pastebin (http://pastebin.com/681299)
Module Usage:
Set orders:
/tell bot !orders blah blah blah
/g bot !orders blah blah blah
Clear orders:
/tell bot !orders
/g bot !orders
When orders are set, a cron job is setup. When orders are cleared, the cron job is unset. I'm still fuzzy on how exactly this works, I just borrowed the method from RaidTime.php and crossed my fingers, and it worked. :)
There are three ways to clear orders: via tell, via pgroup, and cron.
Tell, pgroup, and cron all call the same clear_orders function when orders are cleared.
The problem:
Orders are cleared and do not get sent out when a user joins the private group when orders are cleared with a tell or via pgroup, but when orders are cleared via cron users still get an orders tell when joining the bot.
-
Looking over your code, it looks ok.
Only thing - why are you using is_null and not isset? You are using unset after all.
-
Pastebin is out of date now. Current code is isset(), but it gives me the same strange behavior.
-
Looks ok yeah, did you check if the orders are really empty after calling the clear_orders where it causes problems?
-
Looks ok yeah, did you check if the orders are really empty after calling the clear_orders where it causes problems?
Yup, it was all very funky. I solved it by dropping the idea I got from RaidTime.php and just checking to see if the order set time was greater than 1. It might waste a few more CPU cycles that nobody is going to notice being wasted anyway, but it works reliably. ;)