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

Title: Problem with Orders Module
Post 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.
Title: Re: Problem with Orders Module
Post by: Alreadythere on April 25, 2006, 08:45:21 pm
Looking over your code, it looks ok.

Only thing - why are you using is_null and not isset? You are using unset after all.
Title: Re: Problem with Orders Module
Post by: Glarawyn on April 25, 2006, 10:35:42 pm
Pastebin is out of date now. Current code is isset(), but it gives me the same strange behavior.
Title: Re: Problem with Orders Module
Post by: MatHack on April 26, 2006, 10:34:33 am
Looks ok yeah, did you check if the orders are really empty after calling the clear_orders where it causes problems?
Title: Re: Problem with Orders Module
Post by: Glarawyn on April 26, 2006, 10:17:43 pm
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. ;)
SimplePortal 2.3.7 © 2008-2024, SimplePortal