ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
Bot has hearing impairments =( (Sdk)
Bot has hearing impairments =( // Sdkabbot pabisokoJan 2, 1999, 3:17pm
Im developing a bot that jsut sits in a world and talks to the other
people in the world(user manually makes it talk) and for some reason my bot isnt picking up chat messages, heres hwo the bot is made(Using VIsual C++, wif MFC btw) void CChattyBotDlg::OnLogIn() { // TODO: Add your control notification handler code here GetDlgItem(IDC_CHAT_TO_BE_SAID)->ShowWindow(SW_SHOW); GetDlgItem(IDC_CHAT_BUFFER)->ShowWindow(SW_SHOW); GetDlgItem(IDC_PP)->ShowWindow(SW_HIDE); GetDlgItem(IDC_CIT_NUM)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STATIC)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STATIC2)->ShowWindow(SW_HIDE); GetDlgItem(IDC_LOG_IN)->ShowWindow(SW_HIDE); GetDlgItem(IDC_SAY)->ShowWindow(SW_SHOW); UpdateData(TRUE); int rc = 12345; char rcString[100]; /* initialize Active Worlds API */ if (rc = aw_init (AW_BUILD)) { ::MessageBox( NULL, itoa(rc, rcString, 10), "Unable to initialize API (reason)", MB_OK); // printf ("Unable to initialize API (reason %d)\n", rc); exit (1); } /* install handlers for events here */ if (rc = aw_event_set (AW_EVENT_CHAT, handle_avatar_say)) { ::MessageBox( NULL, itoa(rc, rcString, 10), "Unable to aw_event_set (reason)", MB_OK); exit (1); } /* create bot instance */ if (rc = aw_create (0, 0, 0)) { ::MessageBox( NULL, itoa(rc, rcString, 10), "Unable to create bot instance (reason)", MB_OK); //printf ("Unable to create bot instance (reason %d)\n", rc); exit (1); } /* log bot into the universe */ aw_int_set (AW_LOGIN_OWNER, m_CIT_NUM); aw_string_set (AW_LOGIN_PRIVILEGE_PASSWORD, m_PP); aw_string_set (AW_LOGIN_APPLICATION, "Abbot Pabisoko's TurtleBot 1.0 BETA"); aw_string_set (AW_LOGIN_NAME, "TurtleBot"); if (rc = aw_login ()) { ::MessageBox( NULL, itoa(rc, rcString, 10), "Unable to log in (reason)", MB_OK); //printf ("Unable to login (reason %d)\n", rc); exit (1); } /* log bot into the world called "beta", but check to see if edit box is empty first */ if (m_WORLD=="") { ::MessageBox( NULL, "You must enter something into the World box", "Error", MB_OK); } if (rc = aw_enter (m_WORLD, 0)) { ::MessageBox( NULL, itoa(rc, rcString, 10), "Unable to enter world (reason)", MB_OK); //printf ("Unable to enter world (reason %d)\n", rc); exit (1); } /* announce our position in the world */ aw_int_set (AW_MY_X, m_WE*1000); /* W/E */ aw_int_set (AW_MY_Z, m_NS*1000); /* N/S */ aw_int_set (AW_MY_YAW, m_ROT*10); /* Rotation */ aw_int_set (AW_MY_Y, m_ALT*100); /* Altitude */ aw_int_set (AW_MY_TYPE, m_AVATAR); /* Use the Cy Avatar */ if (rc = aw_state_change ()) { ::MessageBox( NULL, itoa(rc, rcString, 10), "Unable to change state (reason)", MB_OK); //printf ("Unable to change state (reason %d)\n", rc); exit (1); } } abbot pabisokoJan 2, 1999, 3:41pm
Almost forgot to mention, after I stop doing things with the bot for a
while, it freezes up, then when I try to move the bot or make it say something I get an error 10053 or 10054 wich arent lsited in the reason codes in the documentation [View Quote] roland vilettJan 2, 1999, 8:53pm
Any error in the 100xx range is coming directly from WinSock and indicates
some form of low-level socket communication problem. It is often extremely difficult to diagnose the source of Winsock errors. Some of the winsock errors are documented in the Windows help files, but first you have to look up your error number in winsock.h to find out what error it is. One thing to keep in mind that even if you "stop doing things with the bot for a while" you must continue to call aw_wait() periodically or else the SDK <-> server communication link will time out. Again, this may not be entirely clear in the SDK docs, but aw_wait() really is the central heartbeat of the whole SDK and must be called regularly in your program's main loop. Note that API methods in synchronous mode (i.e. no callbacks installed) call aw_wait() implicitly, so if you are making regular synchronous calls to the API then you don't need to call aw_wait() yourself. -Roland [View Quote] walter knupeJan 2, 1999, 10:42pm
Not calling aw_wait() is probably also responsible for your chat messages
not coming through. Winsock error 10053 is WSA_CONNABORTET and 10054 is WSA_CONNRESET, so both are a result of a timed out aw.dll<->server connection Walter Roland Vilett schrieb in Nachricht <368ea2f7.0 at homer>... >Any error in the 100xx range is coming directly from WinSock and indicates >some form of low-level socket communication problem. It is often extremely >difficult to diagnose the source of Winsock errors. Some of the winsock >errors are documented in the Windows help files, but first you have to look >up your error number in winsock.h to find out what error it is. > >One thing to keep in mind that even if you "stop doing things with the bot >for a while" you must continue to call aw_wait() periodically or else the >SDK <-> server communication link will time out. Again, this may not be >entirely clear in the SDK docs, but aw_wait() really is the central >heartbeat of the whole SDK and must be called regularly in your program's >main loop. Note that API methods in synchronous mode (i.e. no callbacks >installed) call aw_wait() implicitly, so if you are making regular >synchronous calls to the API then you don't need to call aw_wait() yourself. > >-Roland > [View Quote] abbot pabisokoJan 3, 1999, 12:01am
walter knupeJan 3, 1999, 12:13am
use a WM_TIMER that fires every second and call aw_wait(10); in there..
works perfectly for me Walter Abbot Pabisoko schrieb in Nachricht <368ecfda.0 at homer>... >hmm..aw_wait freezes up the program..maybee if I put it on a timer..hmmm... > roland vilettJan 3, 1999, 12:38am
It's also perfectly valid to call aw_wait(0); that causes the SDK to simply
process any outstanding inbound messages for all instances, send any necessary heartbeats, and return. Passing in 10 makes it also do an additional select for 10 milliseconds, which isn't really necessary since you are already calling it from a WM_TIMER loop. -Roland [View Quote] walter knupeJan 4, 1999, 1:35pm
Thats great.
What is the best WM_TIMER interval then ? is one second between aw_wait(0); best or would you recommend a different value ? Walter Roland Vilett schrieb in Nachricht <368ed7b7.0 at homer>... >It's also perfectly valid to call aw_wait(0); that causes the SDK to simply >process any outstanding inbound messages for all instances, send any >necessary heartbeats, and return. Passing in 10 makes it also do an >additional select for 10 milliseconds, which isn't really necessary since >you are already calling it from a WM_TIMER loop. > >-Roland > [View Quote] roland vilettJan 5, 1999, 5:08am
It depends on what you are trying to do. A one second time interval means
it may take your bot up to one second to respond to events. This may be find for a chat bot, but for something like a soccer ball it would be bad. -Roland [View Quote] fastFeb 5, 1999, 3:38am
--------------AC635C7D47E345541AFBBE64
Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sounds Like Abbot's working on a ChatBot clone:) FastWalker2 --------------AC635C7D47E345541AFBBE64 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <HTML> <FONT FACE="Century Gothic">Sounds Like Abbot's working on a ChatBot clone:)</FONT><FONT FACE="Century Gothic"></FONT> <P><FONT FACE="Century Gothic">FastWalker2</FONT></HTML> --------------AC635C7D47E345541AFBBE64-- |