Thread

aw_wait and aw_state_change (Sdk)

aw_wait and aw_state_change // Sdk

1  |  

jan r andersson

Feb 14, 1999, 7:59am
Hi,

I've read that one shouldn't call 'aw_state_change' more often than 1000ms.
( for each instance )

That gives me troubles then trying to have a bot move smoth and fast enuff
:(

Is the 1000ms interval a 'recommendation' or will something fail if I call
'aw_state_change' more often ?

/Jan

edward sumerfield

Feb 14, 1999, 8:19pm
There is no recommendation to stay at 1000 ms. There are some reasons why you
might want to. For example, changes in your avatar are only propagated to other
browsers by the world server ever second, so it is not worth you making more
than one change to your avatar each second. Whether you implement this using
the aw_wait to time you or use an aw_wait of 10 ms and count up to 100 before
you make another change. It is up to you. Some environments use an aw_wait(0)
and then use other timers to drive when to call it.

You asked if aw_state_change would fail. No it will not but it will do you no
good because the browsers will not see any changes that it tells the world
server about.

You implied that you have an aw_wait for each instance of your bot. This is not
necessary. One program that has called aw_create multiple times to create
multiple instances of a bot only needs one aw_wait call. This one call will
wait for events for any instance. Once an event is generated you must use
aw_instance to find out which robot generated it.

However, this again is not the reason for your problem. Bots are moved by the
browser, not your robot program. All the program does is tell the world server
where the bot is supposed to be. The walking gesture that is applied to the bot
is applied by the browser. This realization results in you having next to no
control over how your robot is seen to move around the work in other peoples
browsers.

There are some rules that will help you generate the best effect.

1. The browser learns of changes in the bot once a second.
2. The browser implements a slow walk for moves that result in going slower
than 1 meter per second.
3. The browser implements a fast walk for moves that result in going faster
then 1 meters per second.

So the ideal logic results in a 1 second loop that keeps updating your robots
position at the speed that you want to go.

So lets say we want to move our bot from 0, 0 to 1000, 0. This is a 10 meter
movement, west. If we want the move to be walked then we must implement a
move_delta of 100, which is one meter, and make the state change every 1
second.

posx = 0;
move_delta = 100;
while (aw_wait(10000)) {

if (bot not at destination) {

posx += move_delta;
aw_int_set ...
aw_state_change ...
}
}

If we want the bot to run to that position then we must change our delta to 200
resulting in a 2 meters per second speed.

Hope this helps.

Edward Sumerfield.

[View Quote] > Hi,
>
> I've read that one shouldn't call 'aw_state_change' more often than 1000ms.
> ( for each instance )
>
> That gives me troubles then trying to have a bot move smoth and fast enuff
> :(
>
> Is the 1000ms interval a 'recommendation' or will something fail if I call
> 'aw_state_change' more often ?
>
> /Jan

walter knupe

Feb 15, 1999, 12:40am
Edward,

Just out of curiosity, where did Jan imply that he has an aw_wait() for each
instance of his bot ? :) What did I miss ? :)

Walter aka Faber


Edward Sumerfield schrieb in Nachricht <36C74BF9.163C2A72 at poboxes.com>...
>You implied that you have an aw_wait for each instance of your bot. This is
not
>necessary. One program that has called aw_create multiple times to create
>multiple instances of a bot only needs one aw_wait call. This one call will
>wait for events for any instance. Once an event is generated you must use
>aw_instance to find out which robot generated it.
>
>
[View Quote]

baggis

Feb 15, 1999, 3:09am
Edvard,

Tnx for not only a few lines reply giving good information :-)

However, I found the recommendation not to call aw_state_change more often
than once per sec at this URL :
http://www.activeworlds.com/sdk/aw_state_change.htm

That is why I asked :-)

Walter,

You understood the aw_wait and instance thing the way I meant it. I do not
have one aw_wait for each instance :-)

/Jan ( In AW 'Baggis' )


[View Quote]

edward sumerfield

Feb 15, 1999, 1:14pm
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I believe I miss read aw_wait for aw_state_change. Doh. At least some of
my answer was still valid. It would be a shame to write so much and it
all turn out to be a waste of time.
[View Quote]

walter knupe

Feb 15, 1999, 5:40pm
This is a multi-part message in MIME format.

------=_NextPart_000_003F_01BE5923.797FD220
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Well, i think your answers are never a waste of time. they read like =
very intersting lectures on something the reader just didn't think about =
in that detail.=20

This is not ment as criticism.. I really think your answers stand out =
positively alot !

Walter aka Faber

Edward Sumerfield schrieb in Nachricht =
<36C839D5.59763C81 at poboxes.com>...
I believe I miss read aw_wait for aw_state_change. Doh. At least =
some of my answer was still valid. It would be a shame to write so much =
and it all turn out to be a waste of time.=20
[View Quote] Edward,=20
Just out of curiosity, where did Jan imply that he has an =
aw_wait() for each=20
instance of his bot ? :) What did I miss ? :)=20

Walter aka Faber=20

Edward Sumerfield schrieb in Nachricht =
<36C74BF9.163C2A72 at poboxes.com>...=20
>You implied that you have an aw_wait for each instance of your =
bot. This is=20
not=20
>necessary. One program that has called aw_create multiple times =
to create=20
>multiple instances of a bot only needs one aw_wait call. This =
one call will=20
>wait for events for any instance. Once an event is generated =
you must use=20
>aw_instance to find out which robot generated it.=20
>=20
>=20
[View Quote]
------=_NextPart_000_003F_01BE5923.797FD220
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.3511.1300"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#b8b8b8>
<DIV><FONT face=3DArial size=3D2>Well, i think your answers are never a =
waste of=20
time. they read like very intersting lectures on something the reader =
just=20
didn't think about in that detail. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>This is not ment as criticism.. I =
really think your=20
answers stand out positively alot !</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Walter aka Faber</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: =
5px">
<DIV>Edward Sumerfield<ESUMERFD at POBOXES.COM> schrieb in Nachricht =
&lt;<A=20
=
href=3D"mailto:36C839D5.59763C81 at poboxes.com">36C839D5.59763C81 at poboxes.c=
om</A>&gt;...</DIV>I=20
believe I miss read aw_wait for aw_state_change. Doh. At least some =
of my=20
answer was still valid. It would be a shame to write so much and it =
all turn=20
out to be a waste of time.=20
[View Quote] <P>Walter aka Faber=20
<P>Edward Sumerfield schrieb in Nachricht=20
&lt;36C74BF9.163C2A72 at poboxes.com&gt;... <BR>&gt;You implied =
that you=20
have an aw_wait for each instance of your bot. This is <BR>not=20
<BR>&gt;necessary. One program that has called aw_create =
multiple times=20
to create <BR>&gt;multiple instances of a bot only needs one =
aw_wait=20
call. This one call will <BR>&gt;wait for events for any =
instance. Once=20
an event is generated you must use <BR>&gt;aw_instance to find =
out which=20
robot generated it. <BR>&gt; <BR>&gt; <BR>&gt;Jan R Andersson =
[View Quote] ------=_NextPart_000_003F_01BE5923.797FD220--

edward sumerfield

Feb 15, 1999, 6:22pm
Walter, you are the best. Thank you.

[View Quote] > Well, i think your answers are never a waste of time. they read like
> very intersting lectures on something the reader just didn't think
> about in that detail. This is not ment as criticism.. I really think
> your answers stand out positively alot ! Walter aka Faber
>
> Edward Sumerfield schrieb in Nachricht
> <36C839D5.59763C81 at poboxes.com>...I believe I miss read
> aw_wait for aw_state_change. Doh. At least some of my answer
> was still valid. It would be a shame to write so much and it
> all turn out to be a waste of time.
>
[View Quote]

jim fleming

Feb 22, 1999, 6:56am
This is a multi-part message in MIME format.

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

I agree....these discussions are great...I wish there was a way
to more easily capture them in a living web site...

Jim Fleming

[View Quote] Edward,=20
Just out of curiosity, where did Jan imply that he has an =
aw_wait() for each=20
instance of his bot ? :) What did I miss ? :)=20

Walter aka Faber=20

Edward Sumerfield schrieb in Nachricht =
<36C74BF9.163C2A72 at poboxes.com>...=20
>You implied that you have an aw_wait for each instance of =
your bot. This is=20
not=20
>necessary. One program that has called aw_create multiple =
times to create=20
>multiple instances of a bot only needs one aw_wait call. =
This one call will=20
>wait for events for any instance. Once an event is =
generated you must use=20
>aw_instance to find out which robot generated it.=20
>=20
>=20
[View Quote]
------=_NextPart_000_004B_01BE5E0E.FA290D20
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 W3 =
HTML//EN"><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#b8b8b8>
<DIV><FONT color=3D#000000 size=3D2>I agree....these discussions are =
great...I wish=20
there was a way</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT size=3D2>to more easily =
capture them=20
in a living web site...</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Jim Fleming</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: =
5px">
[View Quote] aw_wait() for each <BR>instance of his bot ? :)&nbsp; What =
did I=20
miss ? :)=20
<P>Walter aka Faber=20
<P>Edward Sumerfield schrieb in Nachricht=20
&lt;36C74BF9.163C2A72 at poboxes.com&gt;... <BR>&gt;You implied =
that=20
you have an aw_wait for each instance of your bot. This is =
<BR>not=20
<BR>&gt;necessary. One program that has called aw_create =
multiple=20
times to create <BR>&gt;multiple instances of a bot only =
needs one=20
aw_wait call. This one call will <BR>&gt;wait for events for =
any=20
instance. Once an event is generated you must use=20
<BR>&gt;aw_instance to find out which robot generated it. =
<BR>&gt;=20
[View Quote] ------=_NextPart_000_004B_01BE5E0E.FA290D20--

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