Thread

GNU functions... (Sdk)

GNU functions... // Sdk

1  |  

annette

Oct 6, 1998, 10:53pm
Ok, Well... I got the GNU Cygnus to work compiling the bot. But I can't
get it to use the message array, or the strcmp to handle the different
avatar names and chat lines. How do I get it to do those things with the
GNU?

jeanphi

Oct 6, 1998, 10:59pm
Hi,

What is GNU ?

Did you manage to get people's sentence analysed by the bot ?
I can't manage to use the AW_EVENT_CHAT event, did you manage ? How ?

It would be nice that COF add the AW browser frames Dll to the SDK, like
this, we could integrate the 3D and Lists without loosin,g the focus.

jeanphi

edward sumerfield

Oct 7, 1998, 12:37am
You must include some code in these kind of questions but let me give it a
shot.

Your using standard C, the fact that you are using the GNU compiler is
irrelevant.

The strcmp function is a standard C function that compares two strings. The
usual problem people make with this function is that it returs zero meaning
that the strings are equal. So the code

if (!strcmp("A", "A")) {

printf("They are equal.\n");
}

works just fine.

If you are getting a compile error make sure that you are including the
<stdlib.h> include file.

When you say, get it to use the message array, what do you mean.

A message array in C would comprise a two dimensional array of characters.
For example,

char message[32][10];

represents 10 strings of 31 bytes long. 31 because there must always be
space for a NULL (byte 0) terminator at the end of the string.

So you can trap the AW_EVENT_CHAT event and store each AW_CHAT_MESSAGE
string in the array until you fill it up.

Edward Sumerfield

[View Quote]

veleno

Oct 7, 1998, 12:52am
well... an example of my code is:
#define bot_name "bot"
....
void handle_chat (void)
{
if (!strcmp aw_string (AW_CHAT_MESSAGE), bot_name) {
aw_say("Don't say my name");
printf ("%s said my name", aw_string (AW_AVATAR_NAME));
}
}

aw_event_set (AW_EVENT_CHAT, handle_chat);

compiler returns:
warning: passing arg 1 of 'strcmp' from incompatible pointer type
too few arguments to function 'strcmp'
called object is not a function

[View Quote] > You must include some code in these kind of questions but let me give it a
> shot.
>
> Your using standard C, the fact that you are using the GNU compiler is
> irrelevant.
>
> The strcmp function is a standard C function that compares two strings. The
> usual problem people make with this function is that it returs zero meaning
> that the strings are equal. So the code
>
> if (!strcmp("A", "A")) {
>
> printf("They are equal.\n");
> }
>
> works just fine.
>
> If you are getting a compile error make sure that you are including the
> <stdlib.h> include file.
>
> When you say, get it to use the message array, what do you mean.
>
> A message array in C would comprise a two dimensional array of characters.
> For example,
>
> char message[32][10];
>
> represents 10 strings of 31 bytes long. 31 because there must always be
> space for a NULL (byte 0) terminator at the end of the string.
>
> So you can trap the AW_EVENT_CHAT event and store each AW_CHAT_MESSAGE
> string in the array until you fill it up.
>
> Edward Sumerfield
>
[View Quote]

edward sumerfield

Oct 7, 1998, 2:44am
Add parenthisis around the arguments to strcmp.

if (!strcmp(aw_string(AW_CHAT_MESSAGE), bot_name)) {

All function calling in C is in the form funcname(Arg1, arg2, ...)

Edward Sumerfield.

[View Quote] >

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2022. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn