lucio pascarelli // User Search

lucio pascarelli // User Search

1  |  

wWinMain@16 error with Visual C++ 6.0

Nov 1, 1998, 6:34pm
I get the following error with Visual C++ .. I have disabled MFC and placed
the /Tc option to generate plain C, but I cannot find a solution to the
following. Sorry, but I am trying to get into C.

Lucio

--------------------Configuration: ActiveBot - Win32
Debug--------------------
Linking...
LIBCD.lib(wwincrt0.obj) : error LNK2001: unresolved external symbol
_wWinMain at 16
Debug/ActiveBot.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

ActiveBot.exe - 2 error(s), 0 warning(s)

wWinMain@16 error with Visual C++ 6.0

Nov 1, 1998, 11:43pm
Thanks to both... I got it working :)

Lucio

Problems with AW_QUERY

Nov 17, 1998, 7:56pm
I am working on an SDK app that should keep an SQL database in sync with the
World Database. The reason for this is to help in the maintenance of my
world Virtualy for which I already periodically propdump and load onto SQL
server. In the long term however I want to create a building assistant bot.

The program below works fine for the first number of aw_query calls.
However, after a some 100 calls the aw_query starts to send the same objects
back, apparently ignoring the the sequence numbers.

The code is based on the Sample #2 apps on the SDK Docs. I have added some
command line parameters. The last parameter toggles between a debug output
(showing the sector and sequence numbers exchange) and a propdump format.

I have reviewed the code and compared it to the sample (which used to work
also on Virtualy) but have run out of neurons to find the bug. My C skills
are quite new.

Thanks.

Lucio


// sqlbot.cpp : Defines the entry point for the console application.
//

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

#define ONE_HOUR (60 * 60 * 1000)

#define DBNTWIN32
#include <stdio.h>
#include <windows.h>
#include <sqlfront.h>
#include <sqldb.h>

void handle_cell_begin (void);
void handle_cell_object (void);
void handle_cell_end (void);
void handle_query (int rc);

int err_handler(PDBPROCESS, INT, INT, INT, LPCSTR, LPCSTR);
BOOL gbOpen = FALSE;

int owner;
int sequence[3][3];
int speaker_x;
int speaker_y;
int speaker_z;
int speaker_yaw;
int speaker_number;
int cell_x;
int cell_z;
int coord_x;
int coord_z;
int sect_x;
int sect_z;

int flDebug;

typedef struct strOBJECT_T
{
int AW_CELL_X;
int AW_CELL_Z;
int AW_OBJECT_NUMBER;
int AW_OBJECT_OWNER;
int AW_OBJECT_BUILD_TIMESTAMP;
int AW_OBJECT_X;
int AW_OBJECT_Y;
int AW_OBJECT_Z;
int AW_OBJECT_YAW;
int AW_OBJECT_MODEL_LEN;
int AW_OBJECT_DESCRIPTION_LEN;
int AW_OBJECT_ACTION_LEN;
char AW_OBJECT_MODEL[255];
char AW_OBJECT_DESCRIPTION[255];
char AW_OBJECT_ACTION[255];

} strOBJECT, *pstrOBJECT;

int DBInsertObject(char* user, char* pwd, char* server, pstrOBJECT obj);

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

int rc;

/* check command line */
if (argc < 7) {
printf ("Usage: %s number password world NS WE DebugFlag\n", argv[0]);
exit (1);
}

flDebug = atoi(argv[6]);

/* initialize Active Worlds API */
if (rc = aw_init (AW_BUILD)) {
printf ("Unable to initialize API (reason %d)\n", rc);
exit (1);
}

/* install cell update event handlers */
aw_event_set (AW_EVENT_CELL_BEGIN, handle_cell_begin);
aw_event_set (AW_EVENT_CELL_OBJECT, handle_cell_object);
aw_event_set (AW_EVENT_CELL_END, handle_cell_end);

/* install query callback */
aw_callback_set (AW_CALLBACK_QUERY, handle_query);

/* create bot instance */
if (rc = aw_create (0, 0, 0)) {
printf ("Unable to create bot instance (reason %d)\n", rc);
exit (1);
}

/* log bot into the universe */
owner = atoi (argv[1]);
aw_int_set (AW_LOGIN_OWNER, owner);

aw_string_set (AW_LOGIN_PRIVILEGE_PASSWORD, argv[2]);
aw_string_set (AW_LOGIN_APPLICATION, "SQL Bot Test");
aw_string_set (AW_LOGIN_NAME, "SQL Bot Test");
if (rc = aw_login ()) {
printf ("Unable to login (reason %d)\n", rc);
exit (1);
}

/* log bot into the world */
if (rc = aw_enter (argv[3], 0)) {
printf ("Unable to enter world (reason %d)\n", rc);
exit (1);
}


/* issue first property query */

coord_x = atoi(argv[4]);
coord_z = atoi(argv[5]);

sect_x = aw_sector_from_cell(coord_x);
sect_z = aw_sector_from_cell(coord_z);

if (flDebug)
printf ("Starting query at: %d, %d \n", coord_x, coord_z);

aw_query (sect_x, sect_z, sequence);

/* keep it running long enough !!! */
while (!(rc = aw_wait (ONE_HOUR)));

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

}

void handle_cell_begin (void)
{
int x, z; // used as indices for the sequence array

cell_x = aw_int(AW_CELL_X);
cell_z = aw_int(AW_CELL_Z);

if (flDebug)
printf ("Starting Cell: %d, %d \n", cell_x, cell_z);

x = aw_sector_from_cell(cell_x) - sect_x;
z = aw_sector_from_cell(cell_z) - sect_z;

if (flDebug)
printf (" Sec: %d, %d \n", x, z);

/* sanity check: make sure sector coordinates are within range */
if (x < -1 || x > 1 || z < -1 || z > 1 )
{
if (flDebug)
printf ("Sector out of Range !!!");
return;
}

sequence[x+1][z+1] = aw_int(AW_CELL_SEQUENCE);

if (flDebug)
{
printf (" Seq: %d, %d, %d\n",
sequence[2][2],sequence[1][2],sequence[0][2]);
printf (" %d, %d, %d\n",
sequence[2][1],sequence[1][1],sequence[0][1]);
printf (" %d, %d, %d\n",
sequence[2][0],sequence[1][0],sequence[0][0]);
}
}

void handle_cell_end (void)
{
cell_x = aw_int(AW_CELL_X);
cell_z = aw_int(AW_CELL_Z);

if (flDebug)
printf (" End: %d, %d \n\n", cell_x, cell_z);

}

void handle_cell_object (void)
{

pstrOBJECT pObj;

pObj = (pstrOBJECT) malloc(sizeof(strOBJECT));

pObj->AW_CELL_X = aw_int(AW_CELL_X);
pObj->AW_CELL_Z = aw_int(AW_CELL_Z);
pObj->AW_OBJECT_NUMBER = aw_int (AW_OBJECT_NUMBER);
pObj->AW_OBJECT_OWNER = aw_int (AW_OBJECT_OWNER);
pObj->AW_OBJECT_BUILD_TIMESTAMP = aw_int (AW_OBJECT_BUILD_TIMESTAMP);
pObj->AW_OBJECT_X = aw_int (AW_OBJECT_X);
pObj->AW_OBJECT_Y = aw_int (AW_OBJECT_Y);
pObj->AW_OBJECT_Z = aw_int (AW_OBJECT_Z);
pObj->AW_OBJECT_YAW = aw_int (AW_OBJECT_YAW);
pObj->AW_OBJECT_MODEL_LEN = strlen(aw_string (AW_OBJECT_MODEL));
pObj->AW_OBJECT_DESCRIPTION_LEN = strlen(aw_string
(AW_OBJECT_DESCRIPTION));
pObj->AW_OBJECT_ACTION_LEN = strlen(aw_string (AW_OBJECT_ACTION));
wsprintf(pObj->AW_OBJECT_MODEL, "%s", aw_string (AW_OBJECT_MODEL));
wsprintf(pObj->AW_OBJECT_DESCRIPTION, "%s", aw_string
(AW_OBJECT_DESCRIPTION));
wsprintf(pObj->AW_OBJECT_ACTION, "%s", aw_string (AW_OBJECT_ACTION));

/* DBInsertObject("sa", "", "server", pObj);*/

if (!flDebug)
{
printf("%d %d %d %d %d %d %d %d %d %s%s%s\n",
pObj->AW_OBJECT_OWNER,
pObj->AW_OBJECT_BUILD_TIMESTAMP,
pObj->AW_OBJECT_X,
pObj->AW_OBJECT_Y,
pObj->AW_OBJECT_Z,
pObj->AW_OBJECT_YAW,
pObj->AW_OBJECT_MODEL_LEN,
pObj->AW_OBJECT_DESCRIPTION_LEN,
pObj->AW_OBJECT_ACTION_LEN,
pObj->AW_OBJECT_MODEL,
pObj->AW_OBJECT_DESCRIPTION,
pObj->AW_OBJECT_ACTION);
}

free(pObj);

}

void handle_query (int rc)
{

if (!aw_bool (AW_QUERY_COMPLETE))
{
aw_query (sect_x, sect_z, sequence);
if (flDebug)
{
printf ("Resend Query: %d %d\n", sect_x, sect_z);
printf (" Seq: %d, %d, %d\n",
sequence[2][2],sequence[1][2],sequence[0][2]);
printf (" %d, %d, %d\n",
sequence[2][1],sequence[1][1],sequence[0][1]);
printf (" %d, %d, %d\n\n",
sequence[2][0],sequence[1][0],sequence[0][0]);
}
}
else
printf ("Query Complete.\n");

}

Problems with AW_QUERY

Nov 18, 1998, 5:44pm
Thanks. It worked.

Lucio

Aw SDK for VB..Its almost here!

Nov 30, 1998, 8:37pm
Willing to test it on AW_Query right away :)

I have to interface the SDK with the MFC DAO for JetEngine access to SQL
databases... and it is quite difficult in plain C ... one alternative is to
go to C++ ... but I don't have much experience with it.

I first like to test you VB sdk :)

Thanks

Lucio

Format of TimeStamp field

Dec 1, 1998, 6:52pm
Can anybody help decode the field into a standard date/time format ?

LP

Format of TimeStamp field

Dec 1, 1998, 7:26pm
This is a multi-part message in MIME format.

------=_NextPart_000_002F_01BE1D79.B430D4E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

sorry, I was unclear.

I am referring to the AW_OBJECT_BUILD_TIMESTAMP attribute returned by =
the AW_QUERY. It is a long integer which I am trying to decode into a =
Time field for a database :)

Luco
[View Quote] struct tm=20
{=20
int tm_sec;=20
int tm_min;=20
int tm_hour;=20
int tm_mday;=20
int tm_mon;=20
int tm_year;=20
int tm_wday;=20
int tm_yday;=20
int tm_isdst;=20
};=20

Edward Sumerfield.=20

[View Quote] Can anybody help decode the field into a standard date/time =
format ?=20
LP


------=_NextPart_000_002F_01BE1D79.B430D4E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 =
Transitional//EN">
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>sorry, I was unclear.</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>I am referring to the =
AW_OBJECT_BUILD_TIMESTAMP=20
attribute returned by the AW_QUERY. It is a long integer which I am =
trying to=20
decode into a Time field for a database :)</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Luco</FONT></DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: =
5px">
[View Quote] =
href=3D"mailto:36645A37.2C3C65B0 at poboxes.com">36645A37.2C3C65B0 at poboxes.c=
om</A>&gt;...</DIV>What=20
timestamp field?=20
<P>If you are referring to the standard C time_t which is actually =
just an=20
int then take a look at the localtime function. It returns you the =
following=20
structure.=20
<P>struct tm <BR>{ <BR>&nbsp; int tm_sec; <BR>&nbsp; int tm_min; =
<BR>&nbsp;=20
int tm_hour; <BR>&nbsp; int tm_mday; <BR>&nbsp; int tm_mon; =
<BR>&nbsp; int=20
tm_year; <BR>&nbsp; int tm_wday; <BR>&nbsp; int tm_yday; <BR>&nbsp; =
int=20
tm_isdst; <BR>};=20
<P>Edward Sumerfield.=20
[View Quote] ------=_NextPart_000_002F_01BE1D79.B430D4E0--

Format of TimeStamp field

Dec 1, 1998, 7:36pm
Thanks :)
[View Quote] Lucio Pascarelli <lucio at pascarelli.com> wrote in article
<36646015.0 at homer>...
sorry, I was unclear.

I am referring to the AW_OBJECT_BUILD_TIMESTAMP attribute returned by the
AW_QUERY. It is a long integer which I am trying to decode into a Time
field for a database :)

Luco
[View Quote] struct tm


int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
};

Edward Sumerfield.

[View Quote] Can anybody help decode the field into a standard date/time format
?
LP


----------

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