ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
Constructing Bots (Sdk)
Constructing Bots // SdkfungusJan 23, 1999, 2:13pm
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html> <body text="#000000" bgcolor="#C0C0C0" link="#993366" vlink="#CC66CC" alink="#990000"> <i> okay, okay.... now I have BC++ compiling properly you have to contend with a few questions about programming too!</i><i></i> <p><i>How would you recommend I construct the body of a chat-analysing piece of code?</i><i></i> <p><i>should I use something like strcmp( ) and a whole load of if loops to sort through the responses, or is there a version of switch( ) that will parse long chunks or characters?</i><i></i> <p><i>Again, apologies for my microscopic (but hopefully growning) understanding of C</i> </body> </html> edward sumerfieldJan 25, 1999, 3:31am
--------------A3F96EC68620126CD08CD47D
Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Its hard to say without knowing what you want to achieve with you bot but I can say a few things. No there is no fancy switch statement. C only supports switch on integral values. Take a look at the function strstr() which searches one string for another one so you might have char message[256]; char *where_is; strcpy(message, "Hello this is a message"); where_is = strstr("is", message); if (where_is) { printf("Found string '%s'.\n", where_is); } What do you want to do with you chat analyser? [View Quote] > okay, okay.... now I have BC++ compiling properly you have to contend > with a few questions about programming too! > > How would you recommend I construct the body of a chat-analysing piece of > code? > > should I use something like strcmp( ) and a whole load of if loops to sort > through the responses, or is there a version of switch( ) that will parse > long chunks or characters? > > Again, apologies for my microscopic (but hopefully growning) understanding > of C --------------A3F96EC68620126CD08CD47D Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <body text="#000000" bgcolor="#C0C0C0" link="#993366" vlink="#CC66CC" alink="#990000"> Its hard to say without knowing what you want to achieve with you bot but I can say a few things. <p>No there is no fancy switch statement. C only supports switch on integral values. <p>Take a look at the function strstr() which searches one string for another one so you might have <p> char message[256]; <br> char *where_is; <br> strcpy(message, "Hello this is a message"); <br> where_is = strstr("is", message); <br> if (where_is) { <p> printf("Found string '%s'.\n", where_is); <br> } <p>What do you want to do with you chat analyser? [View Quote] </body> </html> --------------A3F96EC68620126CD08CD47D-- |