Board ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
walter knupe // User Search
walter knupe // User SearchMoving the botsNov 22, 1998, 9:36am
One more thing. i noticed that i am able to have my bot program run 3 bots,
all with the same name. i don't know for avatars, but if 2 avatars have the same name, like my bots, but if they differ in session id's, then i see the real advantage over my approach outlined below. Walter Walter Knupe schrieb in Nachricht <3657f6d1.0 at homer>... >Interesting... > >i was building the bot from a AWBrowser-User point of view. You see if more >than one person approaches you in AW and talks to you, you get all >statements mixed in the chat window. this is, of course, just what happens >to my bot if more than one guy is talking to it. > >For now that does not matter, because the conversations to my bot consist of >simple give-a-command and get-a-direct-response. No conversation context. > >But if i wanted to establish chat context, there's still no need for a >session id. for every conversation you have a bot's instance and an >avavatar's name. So as soon as my c++ bot objects are able to keep >conversation context, they would of course remember to whom, and there you >are. so my AWBrowser-User point of view would work here. The user does not >have "session ids" and therefore the bot does not need them either. > >Walter > > >Edward Sumerfield schrieb in Nachricht <36572A8A.A28DE3A4 at poboxes.com>... the >more >will Moving the botsNov 22, 1998, 9:38am
Nope, not a single time. Bots can even go where avatar's can not (regarding
world boundaries). The only error codes i got were for aw_login, aw_enter and for building Walter aka Faber XelaG schrieb in Nachricht <36592ff5.30806517 at news.activeworlds.com>... >Don't you get an error message in rc = aw_state_change() ? > >On Sat, 21 Nov 1998 17:51:38 +0100, "Walter Knupe" <wak at faber.ping.de> [View Quote] Multiple InstancesNov 25, 1998, 5:06pm
Edward,
Edward Sumerfield schrieb in Nachricht <365C0D30.17FF6C0F at poboxes.com>... >My current implementation in the AWCPP is wrong because I didn't make the >Callback class static. This will be fixed for the AWCPP 0.4 release. Did you manage to accidently pass a non static C++ member function as the call back function and a) the compiler did not complain and b) it worked somehow ? Just curious.... I just remember my early attempts on passing a pointer-to-member as function pointers, which were all blocked by the compiler at first sight. coming from a c background took me a while to figure why it doesn't make sense to even try :) Walter puzzled again...Nov 26, 1998, 7:27pm
Xelag
I remember Roland explaining that the aw.dll does some caching of names in order to allways have it available for aw_string(AW_AVATAR_NAME). The server usually does only give session numbers, and people trying to use aw_string(AW_AVATAR_NAME) anyway caused the SDK change so that the name is . which means your code should function right, a similar one in c++ works for me. if i remember correctly, the server supplies the name only for the "add" event. so if you would get the names there right, you could build your own session<->name mapping for everything else. that might explain that you don't get the names when you don't even have a "add" event. so it might help having an add event, which puts the mapping sessionid<->avatarname into a list, and all the other function only take the session id and resolve it to a name using that list. this should be done internally by aw.dll and its odd that this seems to be disabled somehow when used by Delphi. Did i mention this might have been the time for you to look into c++ ? (just kidding :) ) Walter puzzled again...Nov 27, 1998, 3:01pm
XelaG schrieb in Nachricht <365df383.41411146 at news.activeworlds.com>...
>Thanks, Walter. > >Yes, you did try to recruit me earlier on ;o) > >There's no need for the dll to cache names anyway if it won't work >(that's why I don't use my provider's proxy, it stinks). Well, the dll name cache does work for everyone else, so it is usefull (at least for me :) ) I wonder when the aw.dll decides to purge its name cache. it seems that Delphi triggers that somehow. > >Just curious, but: what about the chat event? Any known restrictions >for multiple instances? I'm starting on that trail soon, don't want to >waste time. Not that i know of. In your place i just would assume that AW_AVATAR_NAME does not work there as well. > >BTW, when you tested this >were you using multiple bot instances? I don't think it's a Delphi >problem, but I can't be sure. The fact is that ONE of the bots seems >to allways have it right with the name in the delete event, but WHICH >is not predictable: it's ususally, but not allways, the one getting >the delete event first, as far as my tests are reliable. Anyway, I'm >tired of this, I've filled this ng with 1% of my tests, and it's still >unclear. For me, a non-feature of the dll that has not been properly >tested or documented for multiple instances. I've seen worse (what >about JBuilder2, paid $$$ for it, crashes all the time?). Yes i did it with multiple bots. I never observed a problem so therefore i didn't test it into that detail as you did. maybe there is some kind of problem, you never know... Bots and FTP?Dec 11, 1998, 3:28pm
Regarding Windows Support...
HTTP or FTP connections inside of windows are best done using the MFC classes designed around wininet.dll. They provide C++ classes like CHttpSession or CFtpSessions. the details for using them are to much to provide here, but watch out for the TEAR example which "tears" a web page from the net, means retrieves a page using CHttpSession to talk to a web server. regarding the logging you would want to log of course locally, and "post" the results to the net at the end of the session. Using HTTP; you Bot would have to perform as if sending a FORM result to the server. i think way to much work just for a file transfer. (not including the neccessary CGI to manage the log). So FTP sounds preferable. But FTP, as far as I know, does not allow to extend a file on the server, which would mean your bot has to download the ENTIRE existing log, write to it, and upload it again. this WILL be time consuming if the log gets big. Walter ps: Edward, you keep amazing me every time when you give a 2 page essay to a one-sentence-question :) Edward Sumerfield schrieb in Nachricht <36696D55.D1741095 at poboxes.com>... Bots and FTP?Dec 11, 1998, 7:45pm
It was ment to be a compliment. Your answers usually include the answers to
2 or 3 questions that would follow, are very interesting to read and give many side-thoughts. I like them alot :) Walter Edward Sumerfield schrieb in Nachricht <36716BCE.7347122C at poboxes.com>... I think I'll take that as a compliment Walter. Thank you. Ejecting...Dec 11, 1998, 3:40pm
Ah ! that gives much sense to many assumptions in the Xelag thread.. thanxs
:) and clearifies some odd name problems in my multiinstance prog i didn't examine yet... Walter Roland Vilett schrieb in Nachricht <36703401.0 at homer>... >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 chess gamesDec 11, 1998, 3:36pm
Sounds great, contact Ima Genius to place it in AWGames !!
for the movements, i suggest the bot would be an "Chess Servant" which has an avatar, and moves the pieces (and resets the board) and stuff personnally. the moves could be by coordinate and by gesture as you proposed, or sth like simple (faber standing on the start field) faber: "move this piece here daniel" or "move my king to" or "move my king side blah to " [Daniel]: "move the King on B 6 to where, Faber" (faber walking to dest field) faber: "here, daniel" so [Daniel] grabs the king and takes it there. my 2 cents. Walter Edward Sumerfield schrieb in Nachricht <366C9E00.2C2704D8 at poboxes.com>... >And a cool idea it was. I have downloaded the GNU Chess already. Give me a month or >two and you never know what might happen. > [View Quote] MonopolyBotDec 11, 1998, 3:44pm
I like that Idea.. have someone in AWGames design a nice board for it and i
could give it a try :) Walter dean schrieb in Nachricht <3670BFE2.70775183 at hotmail.com>... >Hey, when's a monopolybot gonna be made? ;-) > MonopolyBotDec 12, 1998, 10:38am
Those are not needed. Their text, yes, but not scanned in.
Those events would be best served by the bot reading it out loud. Walter dean schrieb in Nachricht <3671E714.9B76E349 at hotmail.com>... >correction, I still have to do the property, chance, and community chest >cards. Wheres the bots?Dec 12, 1998, 10:34am
AWGames starts to show the bots... it seems game bots are the first row of
bots to come, and they will come there :) Walter Josh schrieb in Nachricht <3671C437.3C98CB04 at usa.net>... >Ok all I've been watching this NG for a while and it seems there are >some cool bots out there, but where are the bots? Can't proof you have a >bot till you show us people I would like to see more dev but nope havn't >seen any. > Gesture problemsDec 14, 1998, 4:11pm
You have to reset the gesture to 0 and then back to 5 to have the others
pick it up again. The resetting to 0 is done automatically by the awbrowser after you clicked on a gesture begin Walter Edward Sumerfield schrieb in Nachricht <36748FD4.84162BA5 at poboxes.com>... >The following source is supposed to initiate a gesture every time it hears >some chat message. However, it only does it once after the program starts and >never again. What am I doing wrong? >void avatar_chat() { > int rc; > printf("chatting\n"); > aw_int_set (AW_MY_GESTURE, 5); > if (rc = aw_state_change ()) { > printf ("Unable to change state (reason %d)\n", rc); > exit (1); > } >} > Gesture problemsDec 15, 1998, 3:10pm
Wouldn't the Timer Class have to store or pass down any kind of bot instance
? or should the class A implement it on the side ? My implementation currently has a list of bots. each bot does have all bot properties, including gestures. mainloop checks that list and asks each object to reset it if time's up. my 2 cents...... Walter Edward Sumerfield schrieb in Nachricht <36764E2D.4565835F at poboxes.com>... >There is an OO pattern for a timer that involves two classes > >static class Timer > > static array of objects. > int start(int ticks, TimerIF *); > stop(int timer_id); > check(); > >pure virtual TimerIF > > void popped(); > >So you can write a program like this. > > class A : public TimerIF { > void popped() { > // reset the gesture back to 0. > } > } > void avatar_chat() { > //set gesture to 5. > Timer::start(5, new A()); > } > main() { > aw_event_set(AW_MY_GESTURE, avatar_chat); > while (aw_wait(1000)) { > Timer::check(); > } > } > Mult. listsDec 17, 1998, 7:57pm
See my comments below
Veleno schrieb in Nachricht <3679637A.8484160 at hiwaay.net>... >int list; //declared as global variable >int current_midi; >char *midis[] = {...} >//continue for 3 lists... the exact declaration would help here... >... >main (int argc; char *argv[]) >{ >... >//login coding... > printf("Option for Midi List (1,2 or 3) :\n1: List one\n2: List >2\n3: List 3\n> "); > gets(list); gets returns the line as input. it expects a character pointer, not an integer.. try the following code block { // read a number from stdin char line[256]; // or whatever your max input line lenght might be gets(line); // get input line list = atoi(line); // convert to integer } // now you have the number in the integer variable called <list> > [....] some code skipped.. > if (list == 1) { > sprintf(action, "create sound %s", 1midis[1current_midi++]); > if(!1midis[1current_midi]) what are 1midis and 1current_midi ? as far as i know you can't start a variable with a number. I wouldn't expect the code to compile here same for 2midis and 3midis, etc.. [....] some code skipped.. > //strrchr set left off here due to change in char * on the 3rd >global midi list above > printf("Speaker Music Changed - %s\n", 3midis[3current_midi]); whats the difference here so that you change your procedure ? you can safely pass char * to strrchr by casting it to (const char *) (the compiler should do that implicit since its safe to have a non const variable beeing read by a function expecting it to be const). Walter aw_int_set(AW_MY_Y, 0)?Dec 21, 1998, 10:04pm
I remember having similar difficulties when changing the altitude of a bot
and nothing else... i think i managed by resetting the other current coords as well, but now looking at my current bot code, it works just like that.. so this posting doesn't really say much :) Walter Josh schrieb in Nachricht <367EC9D1.C97793D2 at usa.net>... >it accepts all other alts jsut for some reason it wont move back to 0 > [View Quote] aw_int_set(AW_MY_Y, 0)?Dec 24, 1998, 12:17pm
This explanation fits very nicely to my observations as well...
Walter XelaG schrieb in Nachricht <36821820.70845129 at news.activeworlds.com>... >Just to confirm Josh's view: it's putting the altitude to 0 which is >buggy, whether thats done upwards or downwards is irrelevant. I hadn't >noticed the upward bit before, cause i dont usually send myself or my >bot below sea level ;o) {not quite true, I did a lot in Atlantis >untill I started S-decaying} > >I've reconducted the experiments we did yesterday with Canopus and my >bot, which confirms what Josh said. > >XelaG and his XelaGots > AW_WORLD_RESTRICTED_RADIUSDec 21, 1998, 10:05pm
That restriction was beeing brought into hambot by hamfon and is
observered only there.. no server checking on that... so an sdk bot would check this for itself as well Walter Dthknight schrieb in Nachricht <367ec3d6.0 at homer>... >HamBots are not allowed to speak within the restricted [building] radius, so >I would imagine the same applies to SDK bots. > [View Quote] AW_WORLD_RESTRICTED_RADIUSDec 21, 1998, 10:06pm
Well, if you see avatars at 0,0 they see you... :) the distanse is approx
200m so if you keep an 500x500m square clear centering around GZ, you're on a safe side Walter The Wanderer schrieb in Nachricht <367EDC9D.2366818D at cvwrf.state.ut.us>... >How can that be accurately determined though? A bot can be outside the >radius and still "potentially" be heard within the restricted radius. >Please note, this is only a rhetorical question. > [View Quote] CPU Usage (23+ Kbytes)Dec 20, 1998, 11:16am
This is a multi-part message in MIME format.
------=_NextPart_000_0061_01BE2C23.4E2249A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Looks almost as if the greeterbot example does busy polling with no cpu = release. almost. just a quarter of your horsepower is not beeing used. = could be easily exlpla=EDned on the 4 cpu machine, with each greater.exe = exhausting one cpu, leaving the system with the remaining one, but if = you have only two, and=20 3 bots use each 25% and the Idle Process 25% some bots must have been = releasing the cpu and some point so my guess wouldn't stand. my 2 cents. Andras Sarkozy schrieb in Nachricht = <367CBE9D.E39BECDC at mail.storage.co.hu>... Anyone can explain the high CPU usage of Ed's simple greeting bot??=20 This is a 300MHz DUAL Pentium II machine with 512MBytes of memory:=20 [Nice Pic removed: Important things:] Name CPU System Idle 25% Greeter.exe 25%=20 Greeter.exe 25%=20 Greeter.exe 25%=20 =20 =20 ------=_NextPart_000_0061_01BE2C23.4E2249A0 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.3509.100"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#b8b8b8> <DIV><FONT color=3D#000000 face=3DArial size=3D2>Looks almost as if the = greeterbot=20 example does busy polling with no cpu release. almost. just a quarter of = your=20 horsepower is not beeing used. could be easily exlplaíned on the = 4 cpu=20 machine, with each greater.exe exhausting one cpu, leaving the system = with the=20 remaining one, but if you have only two, and </FONT></DIV> <DIV><FONT face=3DArial size=3D2>3 bots use each 25% and the Idle = Process=20 25% some bots must have been releasing the cpu and some point so = my guess=20 wouldn't stand.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>my 2 cents.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: = 5px"> <DIV>Andras Sarkozy<ANDRAS at MAIL.STORAGE.CO.HU> schrieb in Nachricht = <<A=20 = href=3D"mailto:367CBE9D.E39BECDC at mail.storage.co.hu">367CBE9D.E39BECDC at ma= il.storage.co.hu</A>>...</DIV>Anyone=20 can explain the high CPU usage of Ed's simple greeting bot?? = <BR>This is a=20 300MHz DUAL Pentium II machine with 512MBytes of memory:=20 <P><FONT face=3DArial size=3D2>[Nice Pic removed: Important = things:]</FONT> <P><FONT face=3DArial = size=3D2>Name =20 CPU</FONT></P> <P><FONT face=3DArial size=3D2>System Idle =20 25%<BR>Greeter.exe 25%</FONT> <BR><FONT = face=3DArial=20 size=3D2>Greeter.exe 25%</FONT> <BR><FONT = face=3DArial=20 size=3D2>Greeter.exe 25%</FONT> <BR><BR> =20 </P></BLOCKQUOTE></BODY></HTML> ------=_NextPart_000_0061_01BE2C23.4E2249A0-- CPU Usage (23+ Kbytes)Dec 20, 1998, 6:04pm
This is a multi-part message in MIME format.
------=_NextPart_000_0014_01BE2C5C.6688B040 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Well, for a test, i would increase the 1000 to 2000 and see it the cpu = usage gets cut into half. Walter Andras Sarkozy schrieb in Nachricht = <367D0F81.10792F9E at mail.storage.co.hu>... Strangely enough - when I have only one bot running it uses %25 of = the total power. The program has a loop:=20 for (int i=3D0;i<36000;i++)=20 {=20 (AWWait)(1000); // 1 sec only=20 if (reset_gesture && reset_gesture < GetTickCount ())=20 {=20 /* time to set our gesture back to 0 again */=20 (AWIntSet) (AW_MY_GESTURE, 0);=20 (AWStateChange) ();=20 reset_gesture =3D 0;=20 }=20 }=20 but it has the 1 second AWWait in it which doesn't explains the CPU = load.=20 Any more clue??=20 =20 [View Quote] Looks almost as if the greeterbot example does busy polling = with no cpu release. almost. just a quarter of your horsepower is not = beeing used. could be easily exlpla=EDned on the 4 cpu machine, with = each greater.exe exhausting one cpu, leaving the system with the = remaining one, but if you have only two, and3 bots use each 25% and the = Idle Process 25% some bots must have been releasing the cpu and some = point so my guess wouldn't stand. my 2 cents. =20 Andras Sarkozy schrieb in Nachricht = <367CBE9D.E39BECDC at mail.storage.co.hu>...Anyone can explain the high CPU = usage of Ed's simple greeting bot??=20 This is a 300MHz DUAL Pentium II machine with 512MBytes of = memory:=20 [Nice Pic removed: Important things:]=20 Name CPU=20 System Idle 25%=20 Greeter.exe 25%=20 Greeter.exe 25%=20 Greeter.exe 25%=20 =20 ------=_NextPart_000_0014_01BE2C5C.6688B040 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.3509.100"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#b8b8b8> <DIV><FONT color=3D#000000 face=3DArial size=3D2>Well, for a test, i = would increase=20 the 1000 to 2000 and see it the cpu usage gets cut into = half.</FONT></DIV> <DIV><FONT color=3D#000000 face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Walter</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: = 5px"> <DIV>Andras Sarkozy<ANDRAS at MAIL.STORAGE.CO.HU> schrieb in Nachricht = <<A=20 = href=3D"mailto:367D0F81.10792F9E at mail.storage.co.hu">367D0F81.10792F9E at ma= il.storage.co.hu</A>>...</DIV>Strangely=20 enough - when I have only one bot running it uses %25 of the total = power.=20 The program has a loop: <BR> for (int = i=3D0;i<36000;i++)=20 <BR> { <BR> = (AWWait)(1000); // 1=20 sec only <BR> if = (reset_gesture=20 && reset_gesture < GetTickCount ())=20 <BR> { <BR> /* = time to=20 set our gesture back to 0 again */ = <BR> =20 (AWIntSet) (AW_MY_GESTURE, 0); <BR> =20 (AWStateChange) (); <BR> reset_gesture = =3D 0;=20 <BR> } = <BR> }=20 <P>but it has the 1 second AWWait in it which doesn't explains the = CPU load.=20 <BR>Any more clue?? <BR> =20 [View Quote] <BR>This is a 300MHz DUAL Pentium II machine with = 512MBytes of=20 memory:=20 <P><FONT face=3DArial><FONT size=3D-1>[Nice Pic removed: = Important=20 things:]</FONT></FONT>=20 <P><FONT face=3DArial><FONT=20 size=3D-1>Name =20 CPU</FONT></FONT>=20 <P><FONT face=3DArial><FONT size=3D-1>System = Idle =20 25%</FONT></FONT> <BR><FONT face=3DArial><FONT=20 size=3D-1>Greeter.exe 25%</FONT></FONT> = <BR><FONT=20 face=3DArial><FONT size=3D-1>Greeter.exe =20 25%</FONT></FONT> <BR><FONT face=3DArial><FONT=20 size=3D-1>Greeter.exe 25%</FONT></FONT> = <BR> =20 = <BR></P></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML> ------=_NextPart_000_0014_01BE2C5C.6688B040-- synchronizing problemDec 22, 1998, 9:34pm
Roland,
i trying to implent user-level security into my bot, so i had it ask for the citizen number of a avatar in response to a request. it used aw_citizen_by_name(). the problem is that aw_citizen_by_name does an internal aw_wait() while waiting for the server, which in turn calls my callback functions for any events, and that causes other code in my bot to get executed, and changing state inside... e.g. the state about the person talking to the bot... after that inner request is served, and my callback function returns, it returns back to the callback function, which returns into aw_wait(), which finaly returns the aw_citizen_by_name() call. in that function i do have the information requested, but i am unaware that in the meantime a lot of other eventhandling and state changing took place.... my point is here, that we need callback functions for ALL aw.dll functions which might block on an aw_wait() call. and it would be nice to be able to disable event dispatching for the period of a function call. the current way is similar to windows message dispatching. code invoked in response to a windows message which opens a messagebox invokes internal message dispatching again, and might be re-called while still in the function.. message-based preemptive tasking, that is :) for now i am going to disable userlevel auth, but i think i have to redo my complete event and callback dispatching.. i have to store everything on a FIFO list and work on that from the top level aw_wait() loop only.. which disables all benefit gained by a callback mechanism... Walter Walter Bot avatars...Jan 1, 1999, 8:13pm
I agree to that completely.. take my vote for that as well :)
Walter Elias Israel schrieb in Nachricht <368d1fe8.0 at homer>... > >I used to be involved with the MUD/MUSH text-based worlds that were popular >5-10 years ago and the one thing that came up over and over is that there >are a relatively small number of people who want to build rooms, buildings, >places etc. compared to the number of people who just want to tour around >and express themselves. The *key* item in self-expression is appearance, >both in RL and in VR. Hence the need for custom avs and sequences. > >Please take all of this as a vote, I hope, for custom avatars and more >avatar control in the SDK (and in the browser) sometime very soon. > >Thanks, > >Elias Israel citizen lookup confusionDec 28, 1998, 3:14pm
Roland,
i got into some trouble when trying to look up citizen by name in multi-instance applications. I called citizen_attributes_by_name() without having callbacks installed. Whenever i asked for a nonvalid name, such as a bots name, the answer is correct, BUT whenever i ask for a valid name, i get a response which is not neccessarily related to my request... i get a different aw_string(AW_AVATAR_NAME) and the aw_int(AW_CITIZEN_NUMBER) corresponds to the returned name, not to the name i asked for. i also found out that the current instance returned by aw_instance() seems to be random. its a valid one, but not the one that was set before the inquiry. that might be related to the fact that i have no callbacks installed, and while the lookup waits for the server response it might trigger other events which might cause my code to change the instance. this is therefore just a side observation. and for the bot instance, even when the answer is correct corresponding to the request, the bot instance is usually not the one which issued the inquiry. I am not sure if the citizen_lookup is in any way related to bot instances, if not this observation is pointless. my current workaround is to repeat the inquiry until the requested one gets satisfied. that means that sometimes i have up to 8 citizen_attributes_by_name() calls before getting the right answer. as far as i know XelaG ran into the same problem, and he was using callbacks. he is currently using the same workaround as i am. Could you comment on this ? What am i doing wrong, or could this be a aw.dll "feature" ? :) Walter citizen lookup confusionDec 29, 1998, 10:21pm
What i said was that i did this from a c++ code which has its own instance
around in m_instance: aw_instance_set(m_instance); if (aw_citizen_attributes_by_name("Faber") == 0) { void **new_instance = aw_instance(); // and right here, in a multi-instance-application, the new_instance // was quite often not m_instance anymore, but some other instance // from my application... i could not see a pattern which instance it returned. // important for this although is, that i have no callback for the // aw_citizen_attributes_by_name // which means it could have triggered other handler-functions (e.g. handle_avatar_add()) // for other instance, and in that case i do a lot of aw_instance_set() myself // which would all occur before the programm returns to this point here } I have not testes build 12 yet, but tonight my workaround noted NO retries when looking up people by name, as if the bug would have been corrected in the server.. i am about to d/l build 12 and recheck... Walter Roland Vilett schrieb in Nachricht <3689303c.0 at homer>... >Wait, you are saying that aw_instance() is not correct during callbacks? >That doesn't make any sense. We are running bots right now that depend on >this functionality and they are working fine. > >Or are you saying that it doesn't work during just this one callback? I >looked specifically at the code for the AW_CALLBACK_CITIZEN_ATTRIBUTES case, >it is correctly setting the current instance before triggering the callback, >just as with all other callbacks. I can't see how or why this callback >would behave any differently than the others... > >If someone could provide some C code that demonstrates this problem, that >would help me a lot...thanks! > >-Roland > [View Quote] citizen lookup confusionJan 11, 1999, 6:15pm
If you have a synchronous aw_citizen_attributes_by_name and handle
avatar_add events, take care of the following: Say your bot arrives in an area where there are more than one people already, e.g. 2 or 3.. your bot then gets all avatar_events directly... so you receive the first avata_add... you work on the info you got by calling sync aw_citizen_attributes_by_name . that call blocks until you get the answer.. it blocks means it does internal aw_wait() AND dispatches events. so while you are sitting there in your avatar_add() event function waiting or aw_citizen_attributes_by_name to return, your avatar_add() function gets called a second time, this time with the information of the second avatar. everytime i called aw_citizen_attributes_by_name INSIDE my last call to it, it immediately returned with an error. but even if you DON't call aw_citizen_attributes_by_name inside that second evend, the event arriving alone did change the aw_int(AW_CITIZEN_NUMBER) already... result... use sync or async, but not both at the same time :) Walter aka Faber Canopus schrieb in Nachricht <369A5436.62EBF456 at ix.netcom.com>... > I have found a similar problem when using only 1 bot. In a teller bot >program which makes synchronous calls to aw_citizen_attributes_by_name, followed >by a request for aw_int(AW_CITIZEN_NUMBER), at several points, the number >returned is not always the one for the citizen named in the synchronous call. > > Supposedly a synchronous call "blocks", and the CITIZEN_NUMBER should be the >one for the citizen named in aw_citizen_attributes_by_name. However, I get >reliable responses only when the teller bot is not distracted by avatars >arriving or chatting during the "block" period. (The bot tracks arriving and >departing avatars and it also tracks chat events.) This may be because the bot >maintains a list of all avatars and records all their attributes when they >arrive, including their citizen_number, which requires that EVENT_AVATAR_ADD >include its own "blocking" call to aw_citizen_attributes_by_name. (The calls to >aw_citizen_attributes_by_name during the chat events are needed to find out the >number of a citizen not necessarily present, the one that the client avatar is >transferring money to.) > > XelaG reports that callbacks for aw_citizen_attributes_by_name are more >reliable than synchronous calls. I wonder if this is because the callback allows >you to do your own "blocking" by requesting aw_int(AW_CITIZEN_NAME) inside the >callback handler? > > In this thread, it is reported that the problem can be serious one day and >almost undetectable the next. It would be easy to test whether the problem comes >and goes in parallel with the presence or absence of other avatars (if adding an >avatar includes calling aw_citizen_attributes_by_name or >aw_citizen_attributes_by_number). On days shen the only other avatar in the bank >with the teller bot is my own avatar, there have been no problems (so far!), but >on days when other avatars are arriving and chatting, reliability problems >occur. > > Thanks to Walter Knupe and XelaG for detecting this problem, and also for >suggesting the workaround. > > > [View Quote] citizen lookup confusionJan 12, 1999, 4:21pm
I think my email to you whould answer this question ( and maybe open up alot
of other questions, who knows :) Walter Canopus schrieb in Nachricht <369AF418.1285DFE9 at ix.netcom.com>... >Meaning I would be wise to set a callback handler for >aw_citizen_attributes_by_name, and pose the Citizen Number question there (async >during a regime of asyncs)? > citizen lookup confusionJan 13, 1999, 5:06pm
[View Quote]
>Thanks a lot, Walter, for the enlightening general remarks from yesterday,
and the >helpful clarification today. :0) Until now I had the mistaken impression that the >implicit aw_wait that occurs in a synchronous call allowed only events relevant to >the call: e.g., that aw_query allowed only CELL_BEGIN, CELL_OBJECT, and CELL_END; >and so I thought a synchronous call to aw_citizen_attributes_by_name, with its >implicit aw_wait, would not allow any AVATAR_ADD, AVATAR_DELETE, or CHAT events to >occur during its implicit aw_wait. In fact, it looks like AVATAR_ADD occurs as soon >as aw_citizen_attributes_by_name "blocks", and AVATAR_ADD proceeds to scribble its >own number on the board where I expected the CITIZEN_NUMBER to be, in answer to >aw_citizen_attributes_by_name. Is this effect just limited to citizen_attributes? or >is it dangerous to use other synchronous calls (aw_query, aw_object_add, aw_enter) >that "block" and do an implicit aw_wait? According to my experience, its dangerous for any synchronous call. I felt like the world and universe could have gone down and up again after the function returned. But the information that you specifically requested in sync call and the return code, both should still belong to your inquiry. I say should, because i did have the case where any aw_citizien_attributes_by_name() call returned completely valid, but completely irrelevant information.... you would find it in some thread here, but as a warning to you, this is what happened i did, in sync manner, a aw_citizien_attributes_by_name("Faber"); in a situation with say 10 other people around, say "Person1" to "person10"; so in 2 or 3 out of 10 calls like this i got after the call aw_string(AW_CITIZEN_NAME) = "Person1"; aw_int(AW_CITIZEN_NUMBER) = <citno for person1> or e.g. aw_string(AW_CITIZEN_NAME) = "Person7"; aw_int(AW_CITIZEN_NUMBER) = <citno for person7> which was perfectly valid, but not very interesting since not requested... so i repeated the inquiry until i got aw_string(AW_CITIZEN_NAME) = "Faber"; aw_int(AW_CITIZEN_NUMBER) = <citno for Faber> the interesting point here is, that these reattempts, which i had displayed on my screen, disappeared from one day to the next, that was 2 days before the release of sdk build12. since then, and therefore since using Build12, that did not reoccur, but noone could explain why this odd behaviour disappeared in the first place. this bug-disappearing is not connected to the upgrade from build 11 to 12. so you might have run into an server or sdk bug, and the workaround for that is to repeat your request and verify the returned name. Walter aka Faber Build 12 availableDec 31, 1998, 12:56am
Roland,
this is what i'd say too, so maybee we can help Xelag out here somewhere... xelag, did you try the OBJECT callback yet ? i am sure we can find a way to tell delphi to correctly supplying a function receiving a simple integer... Walter Roland Vilett schrieb in Nachricht <368a96d2.0 at homer>... >Well...technically, the value of AW_CITIZEN_NAME is undefined in the >lookup_by_number failure case. In practice, yes, it is simply unmodified >from its previous call, but I would hesitate to suggest writing code that >depends on this behavior. Instead I would try to focus on why the rc >problem exists - I assume this is a problem with callbacks in your >particular implementation of an interface to the SDK, not with the SDK >itself, correct? > >-Roland Build 12 availableDec 31, 1998, 11:54am
Canopus schrieb in Nachricht <368AFF51.D43EAC47 at ix.netcom.com>...
>What happens when your C programs inspect the rc parameter value in a callback? >Never any problems? This isn't a parameter that is passed by reference, is it? >What could be causing this strange problem? Usually there's no problem with the >rc returned by an aw_int function. This is what i do in my C++ bot Daniel. I have it build, and i have a callback which reads out the error loud (using aw_say()). So any value not equal to 0 gets detected immediately, and so far all rc values passed to my callback_object(int rc); have been correct, accurate and documented. I rather think that the integer you read in your code is not the return code at all, but some other memory spot instead. You supply a delphi function to a dll, which calls it as if it where a c function, right ? Yes, you use c calling convention, but there is obviously still a difference. I guess it would help if the rc code was additionally available as aw_int(AW_RETURN_CODE) ? >On 12/1, XelaG reported a problem with the rc value in callback parameters. At >that time, I tried it out and had a similar problem. Then, I tried some other rc >values which are not stated in the documentation to actually be reason codes. >One of them, the rc value of the aw_query function, behaved in the same strange >way, as I reported. Since Sample 2 specifically avoided getting the rc on >aw_query (and the query callback), I was led to believe that undocumented rc >must also be unreliable rc. But if this is just a problem with the Delphi >connection to certain sdk functions, I'd be grateful to hear that this is not a >problem in the C or C++ programs that are getting rc during callbacks or during >aw_query. aw_query has never reported any error for me. Actually i wouldn't really know how. My Query Callback function has never got an error code in rc. Query is allowed for anybody everywhere so that wouldn't work, right ? Walter |