Thread

[C++ SDK] awsdk1.cpp(171) : error C2065: 'aw_console_messsage' : undeclared identifier (Sdk)

[C++ SDK] awsdk1.cpp(171) : error C2065: 'aw_console_messsage' : undeclared identifier // Sdk

1  |  

tomilius

Aug 9, 2002, 4:09am
It says unideclared identifier! Here's the code:

#define AW_STATIC

#include "aw.h"
#include <stdio.h>
#include <stdlib.h>
#include <string>

void handle_avatar_add (void);
void handle_chat (void);
void leftcopy(char* input,char* output,int pos);
void rightcopy(char* input,char* output,int pos);
void midcopy(char* input,char* output,int start_pos, int stop_pos);
int findstr(char* body,char* search);
void lcase(char* buffer);
void ucase(char* buffer);
void* bot1;
void* bot2;


main (int argc, char *argv[])
{

int rc;

/* check command line */
if (argc < 3) {
printf ("Usage: %s number password\n", argv[0]);
exit (1);
}
/* initialize Active Worlds API */
if (rc = aw_init (AW_BUILD)) {
printf ("Unable to initialize API (reason %d)\n", rc);
exit (1);
}

/* install handler for avatar_add event */
aw_event_set (AW_EVENT_AVATAR_ADD, handle_avatar_add);
aw_event_set (AW_EVENT_CHAT, handle_chat);

/* create bot instance */
if (rc = aw_create (0, 0, &bot1)) {
printf ("Unable to create bot instance 1 (reason %d)\n", rc);
exit (1);
}
if (rc = aw_create (0, 0, &bot2)) {
printf ("Unable to create bot instance 2 (reason %d)\n", rc);
exit (1);
}
printf("Logging bots in..\n");
/* log bot into the universe */
aw_instance_set(bot1);
aw_int_set (AW_LOGIN_OWNER, atoi (argv[1]));
aw_string_set (AW_LOGIN_PRIVILEGE_PASSWORD, argv[2]);
aw_string_set (AW_LOGIN_APPLICATION, "SDK Sample Application #1");
aw_string_set (AW_LOGIN_NAME, "TransferBot1");
if (rc = aw_login ()) {
printf ("Unable to login bot 1 (reason %d)\n", rc);
exit (1);
}

aw_instance_set(bot2);
aw_int_set (AW_LOGIN_OWNER, atoi (argv[1]));
aw_string_set (AW_LOGIN_PRIVILEGE_PASSWORD, argv[2]);
aw_string_set (AW_LOGIN_APPLICATION, "SDK Sample Application #2");
aw_string_set (AW_LOGIN_NAME, "TransferBot2");
if (rc = aw_login ()) {
printf ("Unable to login bot 2 (reason %d)\n", rc);
exit (1);
}
/* log bot into the world called "beta" */
printf("Traveling to worlds..\n");
aw_instance_set(bot1);
if (rc = aw_enter ("tomilius")) {
printf ("Bot 1 Unable to enter world (reason %d)\n", rc);
exit (1);
}

aw_instance_set(bot2);
if (rc = aw_enter ("AWTeen")) {
printf ("Bot 2 Unable to enter world (reason %d)\n", rc);
exit (1);
}
printf("Going to coordinates...\n");
aw_instance_set(bot1);
/* announce our position in the world */
//aw_int_set (AW_MY_X, -8000); /* 8E */
aw_int_set (AW_MY_X,1000);
//aw_int_set (AW_MY_Z, -37000); /* 37S */
aw_int_set (AW_MY_Z,1000);
aw_int_set (AW_MY_YAW, 2250); /* face towards GZ */
if (rc = aw_state_change ()) {
printf ("Bot 1 Unable to change state (reason %d)\n", rc);
exit (1);
}

aw_instance_set(bot2);
/* announce our position in the world */
aw_int_set (AW_MY_X, 2866110); /* 2866.11W */
aw_int_set (AW_MY_Y, -32300); /* -323A */
aw_int_set (AW_MY_Z, 2618900); /* 2618.90N */
aw_int_set (AW_MY_YAW, 2250); /* face towards GZ */
if (rc = aw_state_change ()) {
printf ("Bot 2 Unable to change state (reason %d)\n", rc);
exit (1);
}
printf("Logged in and traveled to coordinates!\n");
printf("Bot 1 has number %d\n",bot1);
printf("Bot 2 has number %d\n",bot2);
/* main event loop */
do
{
aw_instance_set(bot1);
aw_instance_set(bot2);
}
while (!aw_wait (-1))
;

/* close everything down */
aw_destroy ();
aw_term ();
return 0;

}

void handle_avatar_add (void)
{

char message[100];

sprintf (message, "Hello %s.", aw_string (AW_AVATAR_NAME));
aw_whisper(aw_int(AW_AVATAR_SESSION),message);
// log the event to the console
printf ("avatar_add: %s\n", aw_string (AW_AVATAR_NAME));

}

void handle_chat (void)
{
char *chatmessage;
char message[256];
char *name;
/*char message[100];
if (aw_int(AW_CHAT_TYPE) == AW_CHAT_WHISPER )
{
if(!strcmp(aw_string(AW_AVATAR_NAME),"Tomilius"))
{
aw_say(aw_string(AW_CHAT_MESSAGE));
}
else
{
sprintf (message, "I'm sorry %s, Tomilius doesn't want you making me
talk.",aw_string (AW_AVATAR_NAME));
aw_whisper(aw_int (AW_AVATAR_SESSION), message);
}
}*/
if (aw_int(AW_CHAT_TYPE) != AW_CHAT_WHISPER)
{
name = aw_string(AW_AVATAR_NAME);
chatmessage = aw_string(AW_CHAT_MESSAGE);
printf("Got message from %d - %s: %s\n",aw_instance(),name,chatmessage);
if (aw_instance() == bot1)
{
printf("Set instance to %d to send.\n",bot2);
aw_instance_set(bot2);
sprintf(message, "%s: %s",name,chatmessage);
aw_string_set(AW_CONSOLE_MESSAGE,message);
aw_int_set(AW_CONSOLE_BLUE,100);
aw_int_set(AW_CONSOLE_RED,0);
aw_int_set(AW_CONSOLE_GREEN,0);
aw_bool_set(AW_CONSOLE_ITALICS,false);
aw_bool_set(AW_CONSOLE_BOLD,true);
aw_console_messsage (0);
}
else
{
printf("Set instance to %d to send.\n",bot1);
aw_instance_set(bot1);
sprintf(message, "%s: %s", name, chatmessage);
aw_say(message);
}
}
}

// left copy
void leftcopy(char* input,char* output,int pos)
{
int index = 0;
for(int i = 0; i < pos; i++)
{
output[index] = input[i];
index++;
}
output[index] = 0;
}
// right copy
void rightcopy(char* input,char* output,int pos)
{
int index = 0;
int len = strlen(input);
for(int i = pos; i < len; i++)
{
output[index] = input[i];
index++;
}
output[index] = 0;

}
void midcopy(char* input,char* output,int start_pos, int stop_pos)
{
int index = 0;
for(int i = start_pos; i < stop_pos; i++)
{
output[index] = input[i];
index++;
}

output[index] = 0;
}
int findstr(char* body,char* search)
{
int len = strlen(body);
int len2 = strlen(search); // search len

for(int i = 0; i < len; i++)
{
if(body[i] == search[0])
{
bool ichk = true;

for(int z = 0; z < len2; z++)
{
if(body[i+z] == search[z])
{
}
else
{
ichk = false;
}
}

if(ichk == true)
{
return i;
}
}
}

return -1; // failure
}
// lower case
void lcase(char* buffer)
{
int len = strlen(buffer);

for(int i = 0; i < len; i++)
{
buffer[i] = tolower(buffer[i]);
}
}
// upercase
void ucase(char* buffer)
{
int len = strlen(buffer);

for(int i = 0; i < len; i++)
{
buffer[i] = toupper(buffer[i]);
}
}

bowen

Aug 9, 2002, 4:33am
Whoa there bud, think you could just post where the problem is occuring. I
don't mind helping but I can't find it in there. :) Most compilers will
give you the line causing the problem.

--Bowen--

tomilius

Aug 9, 2002, 4:46am
Okay, God Zedle said he needed the whole code or else he couldn't help, but
here's the main section.

if (aw_int(AW_CHAT_TYPE) != AW_CHAT_WHISPER)
{
name = aw_string(AW_AVATAR_NAME);
chatmessage = aw_string(AW_CHAT_MESSAGE);
printf("Got message from %d - %s: %s\n",aw_instance(),name,chatmessage);
if (aw_instance() == bot1)
{
printf("Set instance to %d to send.\n",bot2);
aw_instance_set(bot2);
sprintf(message, "%s: %s",name,chatmessage);
aw_string_set(AW_CONSOLE_MESSAGE,message);
aw_int_set(AW_CONSOLE_BLUE,100);
aw_int_set(AW_CONSOLE_RED,0);
aw_int_set(AW_CONSOLE_GREEN,0);
aw_bool_set(AW_CONSOLE_ITALICS,false);
aw_bool_set(AW_CONSOLE_BOLD,true);
aw_console_messsage (0);
}
else
{
printf("Set instance to %d to send.\n",bot1);
aw_instance_set(bot1);
sprintf(message, "%s: %s", name, chatmessage);
aw_say(message);
}
}

[View Quote]

tomilius

Aug 9, 2002, 5:04am
oh and here's the line:
aw_console_messsage (0);
lol

[View Quote]

ananas

Aug 9, 2002, 5:29am
Sounds much like the wrong version of aw.lib or aw.h.

[View Quote]

mrgrimm

Aug 9, 2002, 5:33am
It's aw_console_message, not aw_console_messsage (extra s).

-Will

[View Quote]

tomilius

Aug 9, 2002, 5:41am
OOOOOOOOOH!! Wow! Nobody has noticed that yet! Thanks, thought it was
something simple :)
[View Quote]

ananas

Aug 9, 2002, 5:51am
I am sure I had my glasses on when I read it, but ...

[View Quote]

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