Development > Coding and development discussion

Problem with Orders Module

(1/1)

Glarawyn:
Code on Pastebin

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.

Alreadythere:
Looking over your code, it looks ok.

Only thing - why are you using is_null and not isset? You are using unset after all.

Glarawyn:
Pastebin is out of date now. Current code is isset(), but it gives me the same strange behavior.

MatHack:
Looks ok yeah, did you check if the orders are really empty after calling the clear_orders where it causes problems?

Glarawyn:

--- Quote from: 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?

--- End quote ---

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. ;)

Navigation

[0] Message Index

Go to full version