Thread

Questions (Sdk)

Questions // Sdk

1  |  

byte me

Oct 9, 1998, 10:07pm
Ok got some questions...

1. can I make my bot respond to a gesture?
if so can I get an example code in c

2. can I make my bot move in a foward in the direction a persons avatar
is facing when they do something?
if so can I get an example code in c

3. can I make my bot do something when an avatar gets close?
if so can I get an example code in c

jan-willem de bleser

Oct 9, 1998, 10:31pm
This is a multi-part message in MIME format.
--------------A17022E4E65C648440AF2D81
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit



[View Quote] > Ok got some questions...
>
> 1. can I make my bot respond to a gesture?
> if so can I get an example code in c

not sure

>
>
> 2. can I make my bot move in a foward in the direction a persons avatar
> is facing when they do something?
> if so can I get an example code in c

can you clarify

>
>
> 3. can I make my bot do something when an avatar gets close?
> if so can I get an example code in c

yes. by using the add_avatar event. there is documentation at
www.activeworlds.com/sdk

--------------A17022E4E65C648440AF2D81
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Jan-willem De Bleser
Content-Disposition: attachment; filename="vcard.vcf"

begin: vcard
fn: Jan-willem De Bleser
n: De Bleser;Jan-willem
org: High school
email;internet: debleser at mediaone.net
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard


--------------A17022E4E65C648440AF2D81--

chris langton

Oct 10, 1998, 11:54am
Here are two *simple* event handlers for when an avatar does something in
the presence of your
bot: one for when an avatar changes state (e.g., does a gesture, moves...),
and the other for when an avatar emits a chat-line.

These are very simple - the point is that these event handlers are where
the execution comes when
something happens - and while you are in the handler, the varous attribute
variables will hold the
appropriate data (like the CHAT_STRING, or the GESTURE that caused the
events in the code
below)

You could do something specific in avatar-change to determine which
direction the av has
moved (by comparing its position to a previous position, for instance) or
to determine if
it is close (compare its X,Z position with your bot's.....) all of these
are done by accessing the
appropriate attribute variables within the event handler (e.g., AW_AVATAR_X
and AW_AVATAR_Z) - you could respond to the avatar's type (Butch, Lori,
whatever), by
checking the attribute AW_AVATAR_TYPE, so that, for instance, you could
greet it by its
AV name - you could greet it by its owner's citizen name by checking
AW_AVATAR_NAME..

__________________________________

/* An avatar has changed its state (moved, done a gesture, etc....) */
/* Just speak its gesture */
/* all of the AV's state attributes are valid here */

void handle_avatar_change (void)
{

char message[100];

sprintf (message, "Your gesture is: %i", aw_int (AW_AVATAR_GESTURE));
aw_say (message);
}


/* An avatar has said something */
/* just say it back */

void handle_chat (void)
{

char message[100];

sprintf (message, "You said: %s", aw_string (AW_CHAT_MESSAGE));
aw_say (message);

}

_________________________________________________________

And, of course, you have to register these event handlers in your main()
program:

aw_event_set (AW_EVENT_AVATAR_CHANGE, handle_avatar_change);
aw_event_set (AW_EVENT_CHAT, handle_chat);

(By the way - the avatar change handler will get called twice when an AV
executes a gesture,
because the AW system sends a "do gesture 0" after every gesture command,
so whenever you wave or do the Maca, for instance, the system issues a do
gesture 0 command immediately after,
you can see this happen with the above code....)

hope these help...


Chris Langton

aka
MockingBird

__________________________________________


[View Quote] > Ok got some questions...
>
> 1. can I make my bot respond to a gesture?
> if so can I get an example code in c
>
> 2. can I make my bot move in a foward in the direction a persons avatar
> is facing when they do something?
> if so can I get an example code in c
>
> 3. can I make my bot do something when an avatar gets close?
> if so can I get an example code in c

byte me

Oct 10, 1998, 1:39pm
What about having a bot spawning in the position the person is and than
move foward and than after that doing a certain thing when someone is
within its range of detection?

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