On Tue, 2010-09-07 at 21:00 +0300, Vlad Dragu wrote: > I continued to work on the missions. > I switched to triggers and serializations to implement the > wait_for_action system > Because we can have more than one “wait for action” active at one > point (see mission_start_2 in pseudo code), I implemented an action > queue. > With the action queue, I needed a way to remove actions from the queue > so I added the function call in the code for individual missions > (clear_action is the function name, it has the same parameters as the > wait for action call)
Wow, cool! Congratz for implementing all this, and so quickly. For the action queue improvement, it looks like a very good idea. Is it a queue per mission, or a global queue per user? > I made a modification to the go_to_site function. Because I have a > page change and a re-initialization of the mission object, it was a > problem to know which “say” function would be next after the page > reload. So, I choose to split the function mission_start_2 into 2 > functions, one that ends with the call to go_to_site and the other > with the rest of the function calls. And I added a second parameter to > the go_to_site function that specifies what function should be called > upon a successful page change. Basically, I made go_to_site function > similar with a wait_for_action(‘GO_TO_SITE’, ‘’) function call, the > difference being that for go_to_site the mission engine itself is the > one that executes the action and triggers the function. I see - smart, and very good imho. > I started to create a test file for the missions code. You can find it > in the root of hackit, it’s called test_missions.php. I’m adding > submit buttons to it that will replicate the triggers from the final > version. Yup - I'll have a look at it. > You mention that the actions should be binary constants. Can you give > me more details about this? Maybe a link to read about it? Sure - it's just a way to make it easy to pass a virtually infinite amount of options in an efficient way (this used to be memory&CPU optimization, this is more to avoid verbosity nowadays). Here is a quick article explaining the principle: http://planetozh.com/blog/2006/05/php-bitwise-operators-example-of-use/ > Thanks and sorry for the technical post J :D Xavier. _______________________________________________ Hackit Bar mailing list - [email protected] Wiki: http://community.hackit.cx/ List: http://community.hackit.cx/ml/ Forum: http://community.hackit.cx/forum/ Ideas: http://community.hackit.cx/ideas/ IRC: irc://irc.freenode.net/#politis
