CALLBACK FUNCTIONS VERSION v.2.0 -- 6/12/01 Based on an idea found on the Circle Mailing List. Callback functions - Parsing Single Line/Menu Input through STATE()'s --------------************************************------------------------ Changes since Callback v.1.0 -- 6/10/01 + Added entry to connected_types[] in constants.c + Modified the CON_ State to cleanup the callback itself without a separate function. + Realized FREE() is not stock (I use it as a macro to a memory manager version of free) + Moved the line_input() function to utils.c considering it's prototyped in utils.h -- duh! + Now chaining line_input() calls is handled correctly --------------************************************------------------------ NOTE: THIS IS NOT A PATCH-- I didn't put it as a patch for the fact that i don't condone patches (i particularly hate 'em and handpatch myself) ... this allows people to see how the code works..., etc (redundant i know) --------------************************************------------------------ Idea by Jim Persson (jim@LINUX.NU) - he's a sort of newbie :-) Mailer code by Mike Breuer (mbreuer@new.rr.com) Adjustments and modifications by Akuma -- me (doomer18@hotmail.com) --------------************************************------------------------ Well, after hearing a little bit about this on the mailing list, I decided to implement the mailer code provided by Mike Breuer. Needless to say, it did require a little bit of fiddling to get it to work, but I did make it happen. Ok, here's the scoop on this setup. Have you ever wanted to ask a person a question, or two, and keep their input for refernce to other functions? Like having a guildmaster ask someone if they REALLY want to use those extra practice points for a good skill? Or maybe just ask them a simple yes or no question? Well, if you ever did that before, you know how much of a pain in the but it was to add an extra CON state for every single question you wanted to ask. Now, you only need one! :-) To ask the question you simply want to call the function like so: line_input(ch->desc, "Here's a question (A, B, C) : ", parse_callback, NULL); parse_callback is a function that parses the choices. You can even have complete menus if you want (just like Oasis OLC :-). The NULL at the end is used in case you want to chain multiple questions within each other. That requires a bit more understanding of how it's done, though. An example of chaining functions is given. Well, all that's needed is modifications to a few files. See 'callback.txt' for full details. Akuma the Raging Coder