BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Age of Conan Archive => BeBot Hyborian support => Topic started by: Organizer on November 08, 2008, 09:07:22 am

Title: How to go about this?
Post by: Organizer on November 08, 2008, 09:07:22 am
I'd like to edit the Bot core to wait for a specific response from a member if this has been when triggered. E.g. if triggered and turned on it will instead of treating the tell from the user as a command, it will interrupt and simply forward on the message received to the function of one of my custom modules.

If was thinking to make the trigger a check if a global variable have been set or not. Any idea what file and code would be required to make that happen? If I'm at all make sense in explaining this, hehe... thanks!

Title: Re: How to go about this?
Post by: Glarawyn on November 10, 2008, 07:01:23 pm
My understanding is you want to track state of something. My thought is you would want to either store the state in an array if it is acceptable to loose state if the bot is restarted, or store state in the database if it is not acceptable to loose state on bot restart.

Then when a user sends the command to the bot, the command handler would have to check the saved state and take the correct action based on state. 

Something like:
Code: (php) [Select]
switch ($this -> state['Player'])
{
   case 1:
        $this -> state['Player'] = 2;
   break;
   case 2:
        $this -> state['Player'] = 3;
   break;
   case 3;
        unset($this -> state['Player'] = 2);
   break;
   default:
       // Code for step 1 of process...
       // Blah blah blah.
       $this -> state['Player'] = 1;
   break;
}
SimplePortal 2.3.7 © 2008-2024, SimplePortal