netropolis // User Search

netropolis // User Search

1  |  

GNU compiler

Sep 23, 1998, 10:14am
[View Quote] I never used the GNU C compiler, but if it can generate win code, you
should be able write bots using the sdk dll.

To avoid the problem of the incompatible LIB you can use run-time
dynamic linking (without linking the aw.lib to your prog). You're gonna
have to rewrite the header, use function pointers, and load the dll
using LoadLibrary. It's tedious, but you won't have to wait for a
specific version of the lib ;)

I compiled the following code using Borland C++ Builder and it works
fine. You could try compiling it with GNU C. Of course, you are gonna
have write the code to make it do something :)))

HTH,

-Netro.


#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

#define AW_BUILD 5

typedef int (*pAWInit)(int);
typedef int (*pAWCreate)(char*, int, void**);
typedef void (*pAWTerm)(void);
typedef int (*pAWDestroy)(void);
typedef int (*pAWWait)(int);

main (void)
{
int rc;
HINSTANCE hAWLib;
pAWInit AWInit;
pAWCreate AWCreate;
pAWTerm AWTerm;
pAWDestroy AWDestroy;
pAWWait AWWait;

hAWLib = LoadLibrary("aw.dll");

if (hAWLib != NULL) {

AWInit = (pAWInit) GetProcAddress(hAWLib, "aw_init");
AWCreate = (pAWCreate) GetProcAddress(hAWLib, "aw_create");
AWTerm = (pAWTerm) GetProcAddress(hAWLib, "aw_term");
AWDestroy = (pAWDestroy) GetProcAddress(hAWLib, "aw_destroy");
AWWait = (pAWWait) GetProcAddress(hAWLib, "aw_wait");

if (rc = (AWInit)(AW_BUILD)) {
printf ("Unable to initialize API (reason %d)\n", rc);
exit (1);
}

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

(AWWait)(1000);

(AWDestroy)();
(AWTerm)();

FreeLibrary(hAWLib);
}

printf ("seems it worked");
return 0;
}

callbacks

Oct 4, 1998, 10:05am
Basically, a callback is a function pointer which is used to call a
function. Check the following code...

/* pointer to a function */
void (*afunction)(int);

/* callback installer */
void set_callback(void (*acallback)(int)) { afunction = acallback; }

/* callback caller */
void call_callback(int a) { afunction(a); }

/* function to install as a callback */
void mycallback(int a)
{
printf("a=%d\n", a);
}

void main(void)
{
set_callback(mycallback);
call_callback(1);
}

This is a generic example to show how callbacks work, too much work just
to print "a=1" :))

Using the AW SDK, you don't have to implement the "set_callback" and
"call_callback" functions. You have to write the function that will be
installed as callback using "aw_callback_set", the SDK is responsible
for calling it.

Check http://www.activeworlds.com/sdk/asynchro.htm

HTH,

-Netro

Gesture problems

Dec 19, 1998, 2:46am
[View Quote] <snip>

>
>
> That was my very first SDK apps to write (modify) so I used the
> example I found on my HD. I consider to write some more - so I'll use
> the latest wrapper - if I can find it for Cbuilder3 :o)

Andras, contact me, I can send you the .lib that works with BCB 3.

-Netro

Build 12 available

Dec 31, 1998, 6:42pm
Declare ur callback procedure as:

procedure CitizenByName(retcode: Integer); cdecl;

I just tested it, it returns the correct citizen number and rc.

HTH,

-Netro


[View Quote]

some help needed

Mar 8, 1999, 6:57pm
[View Quote] messages.lines.add(Format('blah blah.. reason code: %d', [rc]));

> 2.
> I tried to make my bot say something with
>
> aw_say('[beep]');
>
> it should have said [beep] but it said nothing.
>

is the bot instance created correctly?
is it logged into the universe and logged into any world?
did it announce its position in the world?

-Netro

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