L* R*
HOME FORUM DOWNLOADS
Content
  Links
     Browse SVN
     SVN Commit log
     Documentation (Wiki)
  Developers
     Taskmanager
User
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 12, 2008, 11:32:40 PM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Support > BeBot 0.4 support > Topic: MSN module for BeBot
Pages: [1]   Go Down
« previous next »
Print
Author Topic: MSN module for BeBot  (Read 546 times)
0 Members and 1 Guest are viewing this topic.
DocJones
Freshman
*
Offline Offline

Posts: 10


MSN module for BeBot
« on: June 19, 2008, 06:50:34 AM »

Heyas,

i am currently working on a MSN interconnection for BeBot to allow MSN Messenger chatting into the game. However, i am a little stuck with message handling:
I have a receive function that gets called via cron["1sec"] every second, but within that second, on the inbound buffer i can have more than one message. Unfortunately the messages are not seperated, so i cant handle them properly.
Is there a possibility to start a background thread from within the bot in any kind to allow a better polling of the connection? Or even a *gasp* event driven mechanism (to react only if there are data on the tcp socket)?

Any help appreciated.
/M
Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1061


Re: MSN module for BeBot
« Reply #1 on: June 22, 2008, 03:20:24 AM »

You could hook directly into the callback() function inside Main.php. Or the cron() function inside Bot.php. Both those functions are called whenever the chat class polls for new input from the chat-server.
Logged
DocJones
Freshman
*
Offline Offline

Posts: 10


Re: MSN module for BeBot
« Reply #2 on: June 22, 2008, 01:35:52 PM »

Currently i set up cron every second, but there are often more than one data packet arriving within one second. How does the callback function work?

Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1061


Re: MSN module for BeBot
« Reply #3 on: June 22, 2008, 01:52:26 PM »

callback() is called every time the socket connection to the ao chat server is polled, which is several times each second from my experience.
Logged
Temar
BeBot Developer
Grandmaster
********
Offline Offline

Gender: Male
Posts: 783



WWW
Re: MSN module for BeBot
« Reply #4 on: June 22, 2008, 02:04:14 PM »

are you unable to split what you get up?
Logged
DocJones
Freshman
*
Offline Offline

Posts: 10


Re: MSN module for BeBot
« Reply #5 on: June 23, 2008, 01:10:55 AM »

No, not really. i found the basic msn module on the net and revamping it to fit into the structure. However, i am not that skilled php programmer and the code is quite undocumented. I think i need to get a debug environment to get a better understanding. Any hints on that?

regards
Logged
DocJones
Freshman
*
Offline Offline

Posts: 10


Re: MSN module for BeBot
« Reply #6 on: June 23, 2008, 04:42:51 AM »

Heyas,

on a quick sidenote: my debugging output of a 1sec cron looks like this:
Code:
....
Invbot [2008-06-23 09:29:07]    [MSN]   [CRON]  RX
Invbot [2008-06-23 09:29:07]    [MSN]   [CRON]  TX
Invbot [2008-06-23 09:29:09]    [MSN]   [CRON]  RX
Invbot [2008-06-23 09:29:09]    [MSN]   [CRON]  TX
Invbot [2008-06-23 09:29:11]    [MSN]   [CRON]  RX
Invbot [2008-06-23 09:29:11]    [MSN]   [CRON]  TX
Invbot [2008-06-23 09:29:13]    [MSN]   [CRON]  RX
Invbot [2008-06-23 09:29:13]    [MSN]   [CRON]  TX
Invbot [2008-06-23 09:29:15]    [MSN]   [CRON]  RX
Invbot [2008-06-23 09:29:15]    [MSN]   [CRON]  TX
Invbot [2008-06-23 09:29:17]    [MSN]   [CRON]  RX
Invbot [2008-06-23 09:29:17]    [MSN]   [CRON]  TX
Invbot [2008-06-23 09:29:19]    [MSN]   [CRON]  RX
Invbot [2008-06-23 09:29:19]    [MSN]   [CRON]  TX
Invbot [2008-06-23 09:29:21]    [MSN]   [CRON]  RX
Invbot [2008-06-23 09:29:21]    [MSN]   [CRON]  TX
Invbot [2008-06-23 09:29:23]    [MSN]   [CRON]  RX
Invbot [2008-06-23 09:29:23]    [MSN]   [CRON]  TX
...

Anyone noticed, that the 1sec handler is acutally being called every 2 sec?

regards
/K
Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1061


Re: MSN module for BeBot
« Reply #7 on: June 23, 2008, 03:04:28 PM »

Yes, can look like that. 1sec cron time only guarantees that at least one second is between two executions of the cron job, it doesn't guarantee any minimum interval if some other load is there.
Logged
DocJones
Freshman
*
Offline Offline

Posts: 10


Re: MSN module for BeBot
« Reply #8 on: June 25, 2008, 09:01:42 AM »

ooookkkkeeii,

got it working so far. Only problem is: i want to listen the Msn-class to all "/tell" commands (currently "/tell <botname> !msn <text>" works). I tried to set up $commands["tell"][] = &$msn; to hook upon all tells, but that doesn't work. The bot simply send me a "/tell <botname> !help" back. Any help, please?

regards

Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1061


Re: MSN module for BeBot
« Reply #9 on: June 25, 2008, 09:42:26 AM »

The tells pseudo-channel should be what you are looking for. It hands all incoming tells that aren't commands over to registering modules. There you have to do any access checks yourself.

$commands["tells"][] = &$msn;
Logged
Pages: [1]   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Support > BeBot 0.4 support > Topic: MSN module for BeBot
« previous next »
 
Jump to:  

Recent
Bossloot for 5.2
by Brac
[Today at 04:45:17 PM]

!security Levels
by Nytridr
[Today at 02:00:16 PM]

Ported Modules
by Jiheld
[Today at 09:00:13 AM]

raid/point system suggest...
by Temar
[October 11, 2008, 11:45:40 PM]

!timers suggestions: alts...
by Alreadythere
[October 11, 2008, 03:19:46 PM]

!server does not work
by Alreadythere
[October 11, 2008, 06:54:38 AM]

TWC
by clashbot
[October 10, 2008, 08:52:57 AM]

Using Bebot in AoC Raid c...
by IKShadow
[October 09, 2008, 02:38:50 PM]

!items database
by cthulhu
[October 09, 2008, 08:00:27 AM]

File upload issue
by GBH
[October 08, 2008, 10:33:40 AM]
Stats
Members
Total Members: 988
Latest: Talmahera
Stats
Total Posts: 10808
Total Topics: 1458
Online Today: 15
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 2
Guests: 22
Total: 24
Hades
Zeephonz

Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC
TinyPortal v0.9.8 © Bloc | NewDef design by Bloc
Page created in 0.493 seconds with 28 queries. (Pretty URLs adds 0.139s, 4q)
Loading...