collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: How to go about this?  (Read 4904 times)

0 Members and 1 Guest are viewing this topic.

Offline Organizer

  • BeBot Apprentice
  • ***
  • Posts: 135
  • Karma: +0/-0
How to go about this?
« 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!


Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: How to go about this?
« Reply #1 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;
}

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 181
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal