ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
Yet another hard to follow SDK Documentation FLAW . . . (Sdk)
Yet another hard to follow SDK Documentation FLAW . . . // Sdkandon13Jul 27, 1999, 7:55am
Here's the flaw . . .
void handle_chat (void) { int rc; int address; char msg[256]; /* provide IP addresses in response to spoken requests */ if (!strcmp (aw_string (AW_CHAT_MESSAGE), "What is my address?")) if (rc = aw_address (AW_CHAT_SESSION)) aw_say ("Sorry, I cannot determine your IP address"); else { address = aw_int (AW_AVATAR_ADDRESS); sprintf (msg, "Your IP address is %s", inet_ntoa (*(struct in_addr*)&address); aw_say (msg); } } FIRST OFF, you fail to mention ANYWHERE that : inet_ntoa is a member of winsock2.h and that you need to import ws2_32.lib into the project for it to work. . . SECOND, I find someone asking the bot for their own IP address to be rather a stupid use for the function . . . Here's my REVISED version : ) For this to work you must: a.) #include "winsock2.h" & b.) Import ws2_32.lib into the Project . . . char msg[256]; int address; int session_id = aw_int (AW_CLICKED_SESSION); aw_address(session_id); address = aw_int (AW_AVATAR_ADDRESS); sprintf ((char*)reply,"Whois results for %s", aw_string (AW_CLICKED_NAME)); aw_say ((char*)reply); sprintf (msg, "IP address: %s", inet_ntoa (*(struct in_addr*)&address)); aw_say (msg); .. . . As you can tell, this was created as a way to find out the IP address of a person simply by clicking on them : ) -Andon Coleman |