Board ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
roland vilett // User Search
roland vilett // User SearchRelease version of sdk ?Nov 17, 1998, 12:23am
The SDK will be released (i.e. as a non-beta) concurrently with version 2.1
of Active Worlds. I can't say when exactly this will be (because I don't know) but it is on the order of a couple of months from now. There are currently no plans to charge for usage of the SDK. I can't guarantee that this won't change at some time in the future (not my decision) but again, for the foreseeable future, usage of the SDK will be available to Active Worlds citizens free of charge. -Roland [View Quote] SDK for linuxNov 17, 1998, 12:19am
A UNIX version of the SDK is in the plans, but it won't be until after
version 2.1 of AW is released. In other words, several months from now at the earliest. By the way, there is no requirement that your SDK programs and your world server be running on the same machine or even under the same OS. You can leave your world server running on your Linux server and run your SDK programs from a PC. -Roland [View Quote] Problems with AW_QUERYNov 17, 1998, 9:03pm
Yes, the problem is probably that the x and z are reversed in the line that
updates the sequence array. The first index should be offset from z, the second from x. -Roland [View Quote] Finding a Bot's OwnerNov 17, 1998, 9:04pm
At this time, It is not possible to determine another bot's owner through
the SDK. -Roland [View Quote] Finding a Bot's OwnerNov 18, 1998, 5:14am
Yes if the first character of the avatar's name is a "[" (left bracket) then
the avatar is an SDK application. -Roland [View Quote] Reason code 200? - add objectNov 18, 1998, 8:10pm
and
> >Ahhh - so when I change the object I have to obtain a new object number via >AW_OBJECT_NUMBER? that would explain it..... Yes, this is correct. Take a close look at the second SDK sample application. You'll see at the bottom of the routine change_midi() the program saves the new value of AW_OBJECT_NUMBER after calling aw_object_change(). I still don't understand how you were running into the rc 200 problem...that was fixed many builds ago. Were you just on an old build of the SDK? -Roland Moving the botsNov 21, 1998, 3:33am
This is a multi-part message in MIME format.
------=_NextPart_000_004D_01BE14CD.5A1F3B40 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Just a little programmer nit-pick, but you can save yourself a little = trouble by dropping the absolute value conversions for the deltas since = you are about to square them, which will cancel out any negative values. = In other words, delta_x * delta_x has the same value regardless of whether delta_x is positive or = negative. -Roland [View Quote] I implemented this using Pythagarous in the code in the AWCPP - = Avatar.C, distanceFrom() method. Here is an excerpt=20 // Convert all positions to their absolute values. No negatives.=20 if (delta_x < 0) delta_x =3D -delta_x;=20 if (delta_y < 0) delta_y =3D -delta_y;=20 if (delta_z < 0) delta_z =3D -delta_z;=20 // Work out the horizontal hypotenuse using Pythagarous theorem.=20 //=20 // hypotenuse squared =3D opposite squared + adjacent squared;=20 float hor_h =3D sqrt(((delta_x * delta_x) + (delta_z * delta_z))); = // The vertical hypotenuse is the the actual distance between the=20 // the avatars.=20 float distance_from_avatar =3D sqrt(((hor_h * hor_h) + (delta_y * = delta_y)));=20 ------=_NextPart_000_004D_01BE14CD.5A1F3B40 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.2106.6"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT color=3D#000000 size=3D2>Just a little programmer nit-pick, = but you can=20 save yourself a little trouble by dropping the absolute value = conversions for=20 the deltas since you are about to square them, which will cancel out any = negative values. In other words,</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT size=3D2>delta_x * delta_x</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>has the same value regardless of whether delta_x is = positive=20 or negative.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>-Roland</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: = 5px"> [View Quote] = href=3D"mailto:365643F7.6F11AF95 at poboxes.com">365643F7.6F11AF95 at poboxes.c= om</A>>...</DIV>You=20 are asking for a couple of different concepts.=20 <P><B>1. avatar distance from robot.</B>=20 <P>I implemented this using Pythagarous in the code in the AWCPP - = Avatar.C,=20 distanceFrom() method. Here is an excerpt=20 <P> // Convert all positions to their absolute values. No = negatives.=20 <P> if (delta_x < 0) delta_x =3D -delta_x; <BR> if = (delta_y=20 < 0) delta_y =3D -delta_y; <BR> if (delta_z < 0) delta_z = =3D=20 -delta_z;=20 <P> // Work out the horizontal hypotenuse using Pythagarous = theorem.=20 <BR> // <BR> // hypotenuse squared =3D opposite squared = + adjacent=20 squared;=20 <P> float hor_h =3D sqrt(((delta_x * delta_x) + (delta_z * = delta_z)));=20 <P> // The vertical hypotenuse is the the actual distance = between the=20 <BR> // the avatars.=20 <P> float <B>distance_from_avatar</B> =3D sqrt(((hor_h * = hor_h) +=20 (delta_y * delta_y)));=20 <P> </P></BLOCKQUOTE></BODY></HTML> ------=_NextPart_000_004D_01BE14CD.5A1F3B40-- Moving the botsNov 23, 1998, 8:30pm
That is correct...extra calls to aw_state_change() are not rejected, they
just aren't propagated out to other users at more than one update per second. -Roland [View Quote] Moving the botsNov 24, 1998, 4:51pm
This is a multi-part message in MIME format.
------=_NextPart_000_000A_01BE1798.5C2D67E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Yes that is correct. -Roland [View Quote] Edward Sumerfield.=20 [View Quote] That is correct...extra calls to aw_state_change() are not = rejected, they=20 just aren't propagated out to other users at more than one = update per=20 second.=20 -Roland=20 [View Quote] ------=_NextPart_000_000A_01BE1798.5C2D67E0 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.2106.6"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT color=3D#000000 size=3D2>Yes that is correct.</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT size=3D2>-Roland</FONT></DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: = 5px"> [View Quote] = href=3D"mailto:365AB56E.6BF99EB9 at poboxes.com">365AB56E.6BF99EB9 at poboxes.c= om</A>>...</DIV>So=20 the movements are not ignored, but recorded for your robot, its just = that=20 other users will only see the new positions once every second?=20 <P>Edward Sumerfield.=20 [View Quote] ------=_NextPart_000_000A_01BE1798.5C2D67E0-- supresing bot name [imabot] displayNov 23, 1998, 10:21pm
Bot names are only exposed to you if you are a world caretaker or if you
have eject rights in that world. Other people will not see the names unless the bots speak.. -Roland [View Quote] How can I execute "aworld.exe" in other program?Nov 23, 1998, 10:24pm
If the browser is stopping at the welcome screen then it is not finding a
citizen name and password in the aworld.ini file with which to log in automatically. Make sure you are invoking aworld.exe in the proper directory. -Roland >But, system() call is run only DOS mode. >I want to run Windows mode. And I success execute "aworld.exe". >But, just I can only see Welcome dialog box, can't see Active World's >secene. > >Edward Sumerfield ÀÌ(°¡) <36594983.9D4F0636 at poboxes.com> >ÀÛ¼ºÇÏ¿´½À´Ï´Ù... >program what > > How can I execute "aworld.exe" in other program?Nov 24, 1998, 3:20am
Okay, well something else must be going wrong with the process-launching
mechanism you are using, which must be confusing the AW browser at startup. It's really not possible for me to say what without investigating the problem in detail. I'm sorry but all I can suggest is that you keep trying different things... The upgrade.exe utility invokes the AW browser automatically after completing an upgrade by calling WinExec() and this works fine. The exact code is: WinExec (execute, SW_SHOWNORMAL); where 'execute' is a string containing the path to aworld.exe, typically something like "c:\active worlds\aworld.exe". I should mention that the Windows API docs say that WinExec() has been replaced with CreateProcess() and that all Windows apps should use CreateProcess() instead. However, in typical Microsoft fashion, they took a straightforward and simple to use system call and replaced it with a hopelessly complicated system call with a hundred billion new options. Your problem is probably somewhere in one of the endless potential options to CreateProcess(). Maybe you could try WinExec() instead. -Roland [View Quote] Build 10 now availableNov 24, 1998, 6:44am
Hi everyone,
I have just uploaded Build 10 of the SDK. This build fixes another memory leak (hopefully that will be the last of those!) and also fixes a bug where the callback AW_CALLBACK_OBJECT_RESULT sent back the wrong return code value if an asynchronous building operation failed. Please upgrade at your earliest convenience. -Roland Multiple InstancesNov 25, 1998, 1:06am
Yes that's correct, you can only have a single function installed per
event/callback globally, so aw_event_set() and aw_callback_set() don't operate on a particular instance. I'll try to make that more clear in the docs.... -Roland [View Quote] Re: Roland, ya gotta check this out! (Was: Re: CPU)Nov 25, 1998, 1:10am
You're asking the programmer about something that is a matter of corporate
relations...you should be talking to COF management about this, not me... -Roland [View Quote] Problem with AW_EVENT_EJECT ?Dec 2, 1998, 7:24pm
Whoops, this is a case of inaccurate docs again. The AW_EVENT_EJECT event
is obsolete, it has been replaced with AW_EVENT_WORLD_DISCONNECT, a more generic event called whenever the connection to the world server has been severed, for any reason. I'll update the SDK docs now. -Roland [View Quote] Ejecting...Dec 10, 1998, 1:40am
A slight clarification: only AW_AVATAR_NAME and AW_AVATAR_SESSION are
available during the AW_EVENT_AVATAR_DELETE event. Sorry the docs were incomplete on this matter, I will update them shortly. -Roland [View Quote] Ejecting...Dec 10, 1998, 6:51pm
Ah! You are correct. The current implementation of providing
AW_AVATAR_NAME during the AW_EVENT_AVATAR_DELETE event is broken in the multi-bot-instance case. I will have a fix for this as soon as possible... Thanks, Roland [View Quote] chess gamesDec 11, 1998, 5:28pm
Just to get my 2 cents in here, my personal preference would be for a chess
bot that let's *you* move the pieces instead of moving them for you. Then there's no business of learning the language of the chess bot, you can just walk right up and start playing. I think this is easier than it may sound. You simply make the chess pieces tourist owned so that anyone can move them. The chess bot then simply tracks and validates any building activity that occurs on the chess board. If an illegal move is made, the bot moves it back. If someone moves out of turn, the bot moves it back. If someone deletes a piece, the bot replaces it. If a moved piece is not quite centered on its new square, the bot can center it. The bot can also speak a running commentary on the game, even calling out check and checkmate situations automatically, and resetting the board back to its original state for a new game. Further ideas include a bot that remembers players' performance across games and posts rankings. The bot could conduct tournaments and other group events. The ultimate bot, of course, would also play chess against you itself when you can't find an opponent. That's my vote. Kudos to the first person who can implement it. :) -Roland [View Quote] chess gamesDec 11, 1998, 6:32pm
This is a multi-part message in MIME format.
------=_NextPart_000_000D_01BE2502.4C573AE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Dang...that is one small detail I forgot about. Bots cannot login as = tourists. However, if they have eminent domain, they can change = existing objects (which they have just built) to tourist ownership, in = worlds that do not have a registry. This is a bit more clumsy, but it = would work. =20 I guess I was envisioning this whole application being set up in a world = custom-built just for chess playing. It would be difficult to implement = this in AlphaWorld as I described it. If someone out there was serious enough about actually making this = happen, it's conceivable that I might be able to convince COF to donate = a small world specifically for the purpose of creating a chess world. -Roland [View Quote] This is why you haven't seen any deer wondering about. I am still = building the infrastructure. Doh.=20 The ultimate bot, of course, would also play chess against you = itself when=20 you can't find an opponent. In fact this was my first thought. I hadn't though about allowing = two people to play against each other. The GNU chess program is open = source of coarse and looks like it could easily be plugged into an AW VR = front end. It is already architected with the chess engine and front end = separate.=20 That's my vote. Kudos to the first person who can implement it. = :)=20 -Roland=20 [View Quote] ------=_NextPart_000_000D_01BE2502.4C573AE0 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.2106.6"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT color=3D#000000 size=3D2>Dang...that is one small detail I = forgot=20 about. Bots cannot login as tourists. However, if they have = eminent=20 domain, they can change existing objects (which they have just built) to = tourist=20 ownership, in worlds that do not have a registry. This is a bit = more=20 clumsy, but it would work. </FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>I guess I was envisioning this whole = application=20 being set up in a world custom-built just for chess playing. It = would be=20 difficult to implement this in AlphaWorld as I described = it.</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT size=3D2>If someone out there was serious enough about = actually making=20 this happen, it's conceivable that I might be able to convince COF = to=20 donate a small world specifically for the purpose of creating a chess=20 world.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>-Roland</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: = 5px"> [View Quote] = href=3D"mailto:3671781B.AECB3F10 at poboxes.com">3671781B.AECB3F10 at poboxes.c= om</A>>...</DIV>Roland=20 [View Quote] players' performance across games <BR>and posts rankings. = The bot=20 could conduct tournaments and other group = <BR>events.</BLOCKQUOTE>I tend to=20 be an infrastructure chap so I would probably look at building a = Game=20 framework that would support player registration, point tracking and = display=20 and stuff like that. So I see that as a first step.=20 <P>This is why you haven't seen any deer wondering about. I am still = building the infrastructure. Doh.=20 <BLOCKQUOTE TYPE =3D CITE>The ultimate bot, of course, would also = play=20 chess against you itself when <BR>you can't find an = opponent.</BLOCKQUOTE>In=20 fact this was my first thought. I hadn't though about allowing two = people to=20 play against each other. The GNU chess program is open source of = coarse and=20 looks like it could easily be plugged into an AW VR front end. It is = already=20 architected with the chess engine and front end separate.=20 <BLOCKQUOTE TYPE =3D CITE>That's my vote. Kudos to the first = person=20 who can implement it. :)=20 <P>-Roland=20 [View Quote] ------=_NextPart_000_000D_01BE2502.4C573AE0-- Forced Avatar ChoiceDec 10, 1998, 1:51am
This is not currently possible. It would require at least two additions to
the AW architecture: 1. The concept of a "click event" that is posted to the server when a user clicks on an object, and then in turn relayed to other client(s) that might be interested to know that an object was just clicked on. While not available yet, this feature is clearly of significant utility and will be included in a future version of the SDK and world servers, probably in the next version after 2.1. 2. The ability of an SDK app to remotely change your avatar for you. It's not immediately clear whether this is a good or idea or not. Obviously controls would have to be in place to regulate who can change whose avatar for them. This may or may not be added at some future point. It occurs to me that the concept of "click here to change your avatar" might better be implemented entirely locally in the client using the "action" command syntax, like with an "avatar" command. Something like "activate avatar 3" to change your avatar to the third avatar on this list...interesting idea, I will consider that. -Roland [View Quote] Forced Avatar ChoiceDec 10, 1998, 6:47pm
>Second remark: when you make an activate command that make an object
>"visible off" , you see the object disapearing, but the other people don't >see the even, you should update the code also in the new version as a option >in the world setting, that's my suggestion :) This is far more complex than you may realize. Propagating the "visible off" state to all other clients nearby requires substantial modifications to both the browser and the server. This is exactly the sort of problem that is better solved using the SDK. Instead of using the "visible off" action, you use an SDK application that is monitoring the scene. When something occurs that should make an object disappear to everyone, the SDK app simply deletes the object. Then everyone sees it vanish immediately. The SDK app can always add it back again later. However, since there is currently no click event in the SDK (see recent posts on the topic) it's not currently possible to emulate a global "activate visible off" action via the SDK. But other events, such as an avatar's proximity to an object, could cause that object to disappear/reappear using the current SDK. -Roland MonopolyBotDec 11, 1998, 5:38pm
I too would like to see a Monopoly implementation. Too cool!
I question whether the amount of textures required would cause "rendering difficulties"...how many squares are there on a Monopoly board? 50 or so? At one texture per square, that's not any more textures than you would encounter in a typical complex AW environment these days. Remember, signs are textures as well, just generated on the fly instead of downloaded from the object path. 50 signs or 50 textures, they both take the same amount of RAM and CPU to render. An interesting question is how to handle money...would you actually make Monopoly Money objects that you pass around and pile up on your side of the board, or would you settle for a simpler implementation where perhaps the bot just displays your current net worth on a sign next to the board? -Roland [View Quote] MonopolyBotDec 14, 1998, 7:29pm
In my experience, there is virtually no chance that asking Hasbro for
permission will generate a "sure, go right ahead" response, no matter what promises of free publicity, etc. are made. You will get one of three responses: 1. no response at all 2. A "thanks for your interest, but Hasbro has a strict policy regarding the use of the Monopoly name and artwork...blah blah blah" response. In other words, "no." 3. A "we are interested" response, but which will ultimately require the signing of substantial legal documents giving all rights and control to Hasbro before they gave the go ahead. It would be one thing if there was a commercial entity (such as COF, if we had the time) that could handle the other side, but I don't see any way that Hasbro could deal in this respect with a loosely knit group of volunteers... If it were me, I would probably just go ahead and start doing it anyway...and assume Hasbro won't even notice. If they do notice and complain, you just shut it down, and start replacing it with non-Monopoly artwork and remove all references to Monopoly-specific stuff from the game. If you are lucky, they won't notice until the game is finished and running and people are using it and having a great time. This is the best possible outcome - because if it the implementation is complete and compelling, then Hasbro can see the finished product and then be much more easy to convince that it is in their interest to promote rather than suppress the project...assuming of course that it doesn't somehow compete with other online Monopoly implementations that Hasbro might already be involved with. -Roland [View Quote] Collision DetectionDec 14, 1998, 7:14pm
In worlds with a registry, the server does know the width and depth of each
object, at least if the information in the registry is correct. Although height information is present in the registry.txt file itself, it is not processed by the world server so it's not currently available. In worlds without a registry, no object dimension information is available, so it couldn't be provided through the SDK. Making this information available via the SDK is an interesting idea...although I wouldn't want to make it part of the AW_EVENT_CELL_OBJECT event since this is the same event the browser users to query property and it has no use for that extra information, so it would be a waste of bandwidth for browser users. The AW browser uses the geometry information from the .rwx file itself in order to determine the exact size and shape of an object for the purpose of collision detection. Realistically, the only way an SDK application could do this in general purpose fashion would be to do the same thing as the browser: download the .rwx files itself and load them into RenderWare and then use the RenderWare API to determine the exact size and shape. However a bot custom-built for a particular world with a known set of objects could always just have its own preset private list of bounding box dimensions for all objects in the world. This would be a far simpler solution, although much more limited. A complete overhaul of the AW registry system has been planned for a while now, and I really hope it will be something we can do in the next version after 2.1...this overhaul would definitely include a new set of SDK methods that would allow an SDK application to interact with the object registry information in some detail. -Roland [View Quote] Whispering. . .Dec 14, 1998, 6:34pm
Whispering requires both a 2.1 world server (in order to relay the whisper
message), and also a 2.1 browser if the sender and/or recipient are human users as opposed to bots. 2.0 browsers do not know how to display a whispered message, so currently if your bot whispers to you, even in a 2.1 world, you will not see the message. All COF worlds, beta included, are now running a prototype of the 2.1 world server, so you should be able to write code now that has bots whispering directly to each other in either beta world or AlphaWorld (I believe most other COF worlds are currently set to not allow bots in). -Roland [View Quote] Need help to build a AW UniverseDec 14, 1998, 6:28pm
Xela,
Ima was referring to the universe server, not the world server. SDK applications can function inside 2.0 world servers as you say, because SDK apps just look like normal users to 2.0 servers. One exception is the aw_whisper() call, which will work only in 2.1 worlds, since 2.0 worlds don't know how to implement whisper. I don't understand what you are saying about some 2.0 worlds not accepting SDK apps. SDK apps work in all 2.0 worlds, unless the access permissions of a particular world have been set to block out the owner of the bot. That's all the logic there is to it. Whether a world was built from scratch or upgraded from 1.3 has nothing to do with it. The same does not go for universe servers. There were very substantial changes made to the universe server to support the SDK. None of these changes are present in the 2.0 universe servers, so SDK apps will not work there. The SDK will work in all universes once the 2.1 universe server is released. -Roland [View Quote] Need help to build a AW UniverseDec 14, 1998, 6:38pm
Hi,
The SDK newsgroup was not an appropriate place for this post. Please direct any further posts on this topic to either the awcommunity or worldbuilders newsgroup. Thanks, Roland [View Quote] Need help to build a AW UniverseDec 16, 1998, 6:13am
Hi Xela,
The reason you are getting RC_NOT_WELCOME from some worlds is that those worlds are running the 2.1 world server. All COF worlds are running 2.1, as well has all worlds hosted by TCSN. I believe the Amigos worlds are hosted by TCSN. 2.1 worlds can disallow bots, and in fact by default they disallow all bots until set otherwise. If you need to get bots into a world hosted by TCSN, have the world owner contact Bill Hoover(bill at activeworlds.com) and ask him to enable bots in that world. From the outside, it's not easy to tell the difference between a 2.0 world server and a 2.1 world server, at least without a 2.1 browser. However, if you are getting RC_NOT_WELCOME back from the SDK in a world that you yourself can enter without difficulty, then it is definitely a 2.1 world server set to not allow in any bots. -Roland [View Quote] Gesture problemsDec 14, 1998, 6:19pm
This is a multi-part message in MIME format.
------=_NextPart_000_0019_01BE275C.0A2F5060 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable No, this won't work. In order for the gesture to be reset, the other = browsers have to see the change. Remember that multiple calls to = aw_state_change() are not propagated out to other clients more than once = per second. Your code will simply change your state in the server, and = then immediately change it back to the way it was before. To everyone = else in the area, you will appear to have maintained gesture #5 all = along. The correct way to do this is to add code to your bot to always change = the gesture back to 0 again a few seconds after it was changed to 5. = The easiest way to do this is to note the current time when you set the = gesture to 5 (the Windows system call GetTickCount() returns a handy = time value in milliseconds), and then in your main event loop = periodically check this saved value against the current time. You will = need to modify your current call to aw_wait() since your program now = needs to take action in addition to simply responding to events. The relevant code changes could look something like this: #define FIVE_SECONDS 5000 unsigned long reset_gesture; void avatar_chat() { int rc; printf("chatting\n"); aw_int_set (AW_MY_GESTURE, 5); if (rc =3D aw_state_change ()) { printf ("Unable to change state (reason %d)\n", rc); exit (1); } reset_gesture =3D GetTickCount() + FIVE_SECONDS; } /* replace aw_wait(-1) with this: */ while (!aw_wait (1000)) if (reset_gesture && reset_gesture < GetTickCount ()) { /* time to set our gesture back to 0 again */ aw_int_set (AW_MY_GESTURE, 0); aw_state_change (); reset_gesture =3D 0; } [View Quote] It will work every time?=20 [View Quote] You have to reset the gesture to 0 and then back to 5 to have = the others=20 pick it up again. The resetting to 0 is done automatically by = the awbrowser=20 after you clicked on a gesture begin=20 Walter=20 Edward Sumerfield schrieb in Nachricht = <36748FD4.84162BA5 at poboxes.com>...=20 >The following source is supposed to initiate a gesture every = time it hears=20 >some chat message. However, it only does it once after the = program starts=20 and=20 >never again. What am I doing wrong?=20 >void avatar_chat() {=20 > int rc;=20 > printf("chatting\n");=20 > aw_int_set (AW_MY_GESTURE, 5);=20 > if (rc =3D aw_state_change ()) {=20 > printf ("Unable to change state (reason %d)\n", rc);=20 > exit (1);=20 > }=20 >}=20 > ------=_NextPart_000_0019_01BE275C.0A2F5060 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.2106.6"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT color=3D#000000 size=3D2>No, this won't work. In order = for the=20 gesture to be reset, the other browsers have to see the change. = Remember=20 that multiple calls to aw_state_change() are not propagated out to other = clients=20 more than once per second. Your code will simply change your state = in the=20 server, and then immediately change it back to the way it was = before. To=20 everyone else in the area, you will appear to have maintained gesture #5 = all=20 along.</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT size=3D2>The correct way to do this is to add code to your = bot to=20 always change the gesture back to 0 again a few seconds after it was = changed to=20 5. The easiest way to do this is to note the current time when you = set the=20 gesture to 5 (the Windows system call GetTickCount() returns a handy = time value=20 in milliseconds), and then in your main event loop periodically check = this saved=20 value against the current time. You will need to modify your = current call=20 to aw_wait() since your program now needs to take action in addition to = simply=20 responding to events.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>The relevant code changes could look = something=20 like this:</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>#define = FIVE_SECONDS =20 5000</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT size=3D2>unsigned long reset_gesture;</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV>void avatar_chat() {<BR> int rc;<BR> =20 printf("chatting\n");<BR> aw_int_set (AW_MY_GESTURE,=20 5);<BR> if (rc =3D aw_state_change ()) {<BR> = printf=20 ("Unable to change state (reason %d)\n", = rc);<BR> =20 exit (1);<BR> }</DIV> <DIV> reset_gesture =3D GetTickCount() + FIVE_SECONDS;</DIV> <DIV>}<BR></DIV> <DIV> </DIV> <DIV><FONT color=3D#000000 size=3D2>/* replace aw_wait(-1) with this:=20 */</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT size=3D2>while (!aw_wait (1000))</FONT></DIV> <DIV><FONT size=3D2> if (reset_gesture && reset_gesture = <=20 GetTickCount ()) {</FONT></DIV> <DIV><FONT size=3D2> /* time to set our gesture back to 0 = again=20 */</FONT></DIV> <DIV><FONT size=3D2> aw_int_set (AW_MY_GESTURE, = 0);</FONT></DIV> <DIV><FONT size=3D2> aw_state_change ();</FONT></DIV> <DIV><FONT size=3D2> reset_gesture =3D 0;</FONT></DIV> <DIV><FONT size=3D2> }</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV> </DIV> [View Quote] ------=_NextPart_000_0019_01BE275C.0A2F5060-- |