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?
December 04, 2008, 04:10:38 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 636 times)
0 Members and 1 Guest are viewing this topic.
DocJones
Freshman
*
Offline Offline

Posts: 15


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: 1089


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: 15


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: 1089


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: 887



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

MSN messenger: chris_smith96 at hotmain dot com
Xfire: chriss96
DocJones
Freshman
*
Offline Offline

Posts: 15


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: 15


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: 1089


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: 15


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: 1089


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
online not working after ...
by Alreadythere
[Today at 03:53:28 PM]

Bot not working after tod...
by Alreadythere
[Today at 01:04:41 PM]

Tokens Calulator
by Temar
[December 03, 2008, 01:09:03 PM]

Bebot does not work with ...
by IKShadow
[December 03, 2008, 08:54:04 AM]

!items database
by Temar
[December 03, 2008, 07:27:59 AM]

massive_pvp_time_table 1
by Sudoka
[December 03, 2008, 06:49:07 AM]

Log playtime from buddys ...
by IKShadow
[December 02, 2008, 06:48:12 AM]

[request] Raid timers
by Elesar1
[December 01, 2008, 04:41:09 PM]

Shared DB online list
by Temar
[December 01, 2008, 01:55:47 AM]

relay colors
by Temar
[December 01, 2008, 01:54:56 AM]
Stats
Members
Total Members: 1246
Latest: Vingus
Stats
Total Posts: 11192
Total Topics: 1508
Online Today: 21
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 7
Guests: 17
Total: 24
vikor
Sudoka
upstart
Glarawyn
Snarfblatt
Vingus

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