Board ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
walter knupe // User Search
walter knupe // User SearchGNU compilerOct 10, 1998, 3:45pm
Almost all versions of MS Visual C++ are able to produce a new import
library for dlls. so the Visual 5 version of it does not have to be used. I woudln't be surprised if GNU C would offer a similar service. the method i am talking about used to be called implib. It takes a dll-File and creates an import library from it. Roland, the sdk i downloaded carried only aw.h, aw.lib and aw.dll. is there a way to tell what version it is or could you provide a version.txt with the archive to give that information ? thanks :) otherwise, the sdk has been working great for me :) Roland Vilett schrieb in Nachricht <3611d99e.0 at homer>... >It looks like the LoadLibrary/GetProcAddress solution is a good one for >people who don't have access to Visual C++. As soon as I have a spare >moment, I'll create a generic file that will provide access to the AW API >transparently using this mechanism, and include it in subsequent >distributions of the SDK so anyone who runs into this problem in the future >will have an easy solution available. My goal will be to create the file so >that the same code will compile without modification whether you use the >aw.lib mechanism or the LoadLibrary() mechanism. > >-Roland > GNU compilerOct 11, 1998, 1:19am
Edward Sumerfield schrieb in Nachricht <361fb09d.0 at homer>...
>Interesting. I do not know what an import file is. Unix background, sorry. > >The name mangling algorithm in GNU is different from VC++ so you can't >combine MS and GNU DLLs. I don't know if an "inport file" would solve this. actually, all DLLs are sort of required to use c function exports in order to avoid the name mangling problem. that means dll exports are usually PASCAL exported functions (the name is not decorated at all) or sometimes CDECL exported functions (name is decorated with a leading underscore). and third option is to export dll functions by ordinal value, which avoids using function names at all. but i am not sure if a proper import library can be regenerated in that case, and with aw.dll i can't find any function names in there. so you either use the code wrappers or have the import library, but name mangling settings shouldn't have anything to do with the issue. > >Anyway we are dealing with a C sdk. Would an import file get us around >having to code wrappers around the DLL load? > >Edward Sumerfield, > [View Quote] GNU compilerOct 11, 1998, 8:07pm
Edward,
Edward Sumerfield schrieb in Nachricht <36212052.0 at homer>... >I must be thinking of libs instead of dlls. So no GNU compiled function can >call a MS compiled C++ library. Does that sound more likley? yes, that is correct for libraries, and for DLLS which require exported c++ mangled names. (rare, but neccessary if you have function overloading or complete classes) >So the implib program is dynamically creating something like a dll wrapper >then? I will take a look through GNUdome and see what I can see. Writing >wrappers is tiersome and mainenance intensive, it would be nice to find an >alternative. Well, implib used to be just that, a tool to create dll wrapper libraries.. but that "knowledge" moved more and more into the linker, so that the import libraries differ from normal libraries in the way that they do not contain real functions anymore, just additional linking information... the linker generates the wrappers then. which did not change the procedure... you have to use implib to create your import library. it's just that these days the MS IDEs do that autmatically when creating a dll, so the "implib.exe" is actually gone by now , it is intregated in the dll building process. which leads to the problem that you can't use current visual c++ installations anymore for automated wrapper lib builing of alien dlls. i must admit that the information i give gets more and more accurate every time i answer, which unfortunately changes that information more and more :) implib.exe is not an option for VisualC5.0, and i think not for Visual C 4.0 as well. it used to be for the older versions. but, since DLLs are so major under windows, i am quite sure gnu C for win32 must have some supporting environment for it. Walter A little help with a programOct 10, 1998, 3:59pm
This is a multi-part message in MIME format.
------=_NextPart_000_017E_01BDF488.7A98B640 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable The windows world is not POSIX :) and therefore the select interface differs too. Under windows, it can = check for SOCKETS only, and windows SOCKETs are not file descriptors. therefore user-defined events which are not sockets can not be checked = for this way. Under windows, events coming in as Windows-Message to a window are much = more likely... Walter esumerfd schrieb in Nachricht <3607CC15.6F2F8AE8 at poboxes.com>... My apologies Roland, I must have seemed too pushy. I am a 12 year = veteran in the computer consulting field and understand totally what you = are going though. We customers can be very annoying at times. Especially = what we think we know what we are talking about. You are doing an = excellent job. Don't let us get to you.=20 You are making the right move in solidifying the release you have = and when I get a darn C compiler I can use I will be right in there with = you trying to use your API.=20 I would like to think that the comments we are making will = contribute to the next version of the API and so I would like to = continue these conversations if you have the time.=20 Let me explain a little more about aw_add_event().=20 Currently your code calls the socket() and connect() functions to = create connections to the universe and world servers. The socket call = returns file descriptors that you are adding to an array of file = descriptors for passing to the select() call. Each time data becomes = available on one of these file descriptors the select statement drops = out and your code checks the file descriptor returned to see if the = event came from the universe connection or the world connection.=20 OK, now we have a requirement to allow user applications to create = their own files, sockets or timers and they have to have a way to use = your select statement to do it.=20 You can create the following function=20 aw_add_event (file descriptor, function pointer) {=20 append file descriptor to end of array.=20 store function pointer into another array indexed by the = file descriptor.=20 }=20 Now change your select function as follows:=20 array =3D { universe, world }=20 while (1) {=20 event =3D select (array)=20 if (event =3D universe) {=20 Read data from universe file descriptor=20 }=20 else if (event =3D=3D world) {=20 Read data from the world file descriptor=20 }=20 else {=20 look up function pointer using file descriptor=20 call users function;=20 }=20 }=20 Now you have a way for the application to add its own file = descriptors to your sdks select loop. Applications can now implement = their own timer based bot functions, dynamically receive weather = information from a weather server and have their bots tell people, read = random quotes from a file. All without impacting the performance of the = application. Also, when bots get more sophisticated they will not be = needlessly chewing up CPU time while polling the event queue, instead, = your thousands of deer grazing in a distant meadow will only use CPU = time when they need to be moving.=20 I have writing a number of there types of applications before and = would be happy to add my experience to future developments. Please don't = hesitate to ask.=20 Edward Sumerfield,=20 Pesky user.=20 [View Quote] Okay look, I'll be the first to admit that the SDK architecture = is not perfect for all possible applications. At this point I don't = want to get into an argument about which features are more important = than others. The SDK is what I could come up with in the time = available. Future considerations like Java support, GNU support, = multi-threading support, etc. are all great ideas and no doubt would = make the SDK even better. But that's what they are: future = considerations. Once again, the goal was to get something, anything, = out there for people to be able to use. As with all aspects of the = Active Worlds architecture, the SDK is going to be a continually = evolving work in progress. As time goes by, it will be improved and = extended along with all other aspects of the platform. The current goal = is to simply stabilize and test the current SDK more or less as is in = order to release it for general use. Then we can start thinking about = the next version. That said, I'm not sure I even understand the = aw_add_event() suggestion...I don't know how you would add in external = application-defined events into the SDK, because the SDK would need to = know how to check for them. How would the programmer tell the SDK to = check for his/her custom event, keeping in mind that the only event loop = that the SDK has is a call to select()? I don't have any hard numbers on = the hardware mix of our customers. Obviously since AW is a = Windows-based platform just about everyone has a Windows machine. But = on the server side lately we've been seeing a lot of interest in Linux, = for example. I'm not even sure yet what platforms most people will be = running their bots on.I'm assuming that, in the long term, SDK apps are = going to more or less parallel world servers in terms of platform of = choice, since most SDK apps will presumably be applications left running = [View Quote] You mentioned in the thread about the GNU compiler that your = preference is to port to Sun/Unix machines before GNU because of your = belief that high performance bots will run on that type of machine. If = performance is important to you then why is it that you are not = addressing this inefficient polling architecture?=20 I would even go as far as saying that a threaded API is much = high priority than having to worry about porting high powered servers.=20 What is the reletive hardware mix of your customers at the = moment? Windows/Unix/Linix? What percentage of each would you say?=20 Edward Sumerfield=20 [View Quote] A multi-threaded solution isn't absolutely necessary = here...if you are=20 developing a Windows console app then you can use the = call _kbhit() to=20 determine if a key has been pressed in the console = window to avoid blocking=20 in a call to getch(). Something like this:=20 /* main event loop */=20 for (;;) {=20 /* check for AW events */=20 if (aw_wait(100))=20 /* fatal error */=20 break;=20 if (_kbhit()) {=20 /* process keystroke here... */=20 }=20 }=20 Check out the Windows SDK docs for more info on = _kbhit()...you may want to=20 adjust the timeout parameter to aw_wait() but 100 = milliseconds means you are=20 checking for keyboard input 10 times per second which = should be adequate=20 response time.=20 -Roland=20 >You don't need windows unless you want to make the = interface pretty. A=20 command=20 >line interface, like the dos prompt, is possible with a = console app and is=20 much=20 >easier to implement if you haven't done much = programming.=20 >=20 >Your problem is the architectural design of the sdk. It = is event driven so=20 while=20 >your program is in aw_wait it is waiting for a message = from the server. It=20 is not=20 >able to wait for a keystroke at the same time.=20 >=20 >An extension needs to be made to the sdk for adding = user events (Roland?),=20 such as=20 >keyboard events. For example, aw_add_event(int, = function); This would cause=20 the aw=20 >sdk to wait on your event as well as its own and call = your function when it=20 is=20 >fired.=20 >=20 >In the mean time you can use polling but it is not = ideal. For example call=20 >aw_wait(10) so it will wait for 10 milliseconds for an = sdk event to occur=20 then=20 >drop back into your program. Then in your console app = you can use the=20 standard C=20 >function gets() which would allow you to enter a string = and press enter.=20 You can=20 >then do what you like based on the command entered.=20 >=20 >The problem is that this is a blocking call. Once you = have called gets it=20 will not=20 >return to your program until you press enter. While it = is waiting for you,=20 your=20 >avatar will not be able to react to events.=20 >=20 >If you want to get into some more serious programing = them you can design a=20 >multi-threaded solution which would be a little more = realistic. Bare in=20 mind that=20 >the aw sdk is not thread safe so do not allow two = different threads to call=20 the=20 >same api.=20 >=20 >The design would involve one thread being dedicated to = calling the aw=20 functions=20 >and a second thread being dedicated to accepting input = from the keyboard.=20 There=20 >would be one common command buffer that both threads = read and a lock to=20 protect=20 >that buffer.=20 >=20 >So your program would start up and kick off a seperate = thread to do all the=20 aw=20 >init, start, enter and wait(10) stuff while the first = thread blocked on the=20 gets()=20 >function. Now the aw thread would be able to continue = running even though=20 the=20 >gets() was blocked because it is running in a seperate = thread.=20 >=20 >In the aw thread, each time the aw_wait drops out it = would check the=20 command lock,=20 >if it is unlocked then it would lock it, check the = command buffer and act=20 on what=20 >ever it found before unlocking the lock.=20 >=20 >In the gets thread, each time the enter key is pressed = the lock is checked,=20 if=20 >unlocked then it must be locked and the new command = copied into the shared=20 command=20 >buffer, before the lock is unlocked again.=20 >=20 >This is a polling solution so is not as cpu efficient = as the sdk change but=20 would=20 >work.=20 >=20 >Good luck everyone.=20 >=20 >Edward Sumerfield, esumerfd at poboxes.com=20 >=20 [View Quote] ------=_NextPart_000_017E_01BDF488.7A98B640 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.3110.7"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT color=3D#000000 size=3D2>The windows world is not POSIX = :)</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT size=3D2>and therefore the select interface differs too. = Under windows,=20 it can check for SOCKETS only, and windows SOCKETs are not file=20 descriptors.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>therefore user-defined events which are not sockets = can not be=20 checked for this way.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>Under windows, events coming in as Windows-Message = to a window=20 are much more likely...</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>Walter</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV> </DIV> <DIV> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: = 5px"> <DIV>esumerfd<ESUMERFD at POBOXES.COM> schrieb in Nachricht <<A=20 = href=3D"mailto:3607CC15.6F2F8AE8 at poboxes.com">3607CC15.6F2F8AE8 at poboxes.c= om</A>>...</DIV>My=20 apologies Roland, I must have seemed too pushy. I am a 12 year = veteran in=20 the computer consulting field and understand totally what you are = going=20 though. We customers can be very annoying at times. Especially what = we think=20 we know what we are talking about. You are doing an excellent job. = Don't let=20 us get to you.=20 <P>You are making the right move in solidifying the release you have = and=20 when I get a darn C compiler I can use I will be right in there with = you=20 trying to use your API.=20 <P>I would like to think that the comments we are making will = contribute to=20 the next version of the API and so I would like to continue these=20 conversations if you have the time.=20 <P>Let me explain a little more about aw_add_event().=20 <P>Currently your code calls the socket() and connect() functions to = create=20 connections to the universe and world servers. The socket call = returns file=20 descriptors that you are adding to an array of file descriptors for = passing=20 to the select() call. Each time data becomes available on one of = these file=20 descriptors the select statement drops out and your code checks the = file=20 descriptor returned to see if the event came from the universe = connection or=20 the world connection.=20 <P>OK, now we have a requirement to allow user applications to = create their=20 own files, sockets or timers and they have to have a way to use your = select=20 statement to do it.=20 <P>You can create the following function=20 <P> aw_add_event (file descriptor, function = pointer) {=20 <P> append file descriptor = to end=20 of array. <BR> store = function=20 pointer into another array indexed by the file descriptor.=20 <BR> }=20 <P>Now change your select function as follows:=20 <P> array =3D { universe, world }=20 <P> while (1) {=20 <P> event =3D select = (array)=20 <BR> if (event =3D = universe) {=20 = <P> = Read=20 data from universe file descriptor=20 <BR> }=20 <BR> else if (event =3D=3D = world) {=20 = <P> = Read=20 data from the world file descriptor=20 <BR> }=20 <BR> else {=20 = <P> = look=20 up function pointer using file descriptor=20 = <BR> = call=20 users function; <BR> }=20 <BR> }=20 <P>Now you have a way for the application to add its own file = descriptors to=20 your sdks select loop. Applications can now implement their own = timer based=20 bot functions, dynamically receive weather information from a = weather server=20 and have their bots tell people, read random quotes from a file. All = without=20 impacting the performance of the application. Also, when bots get = more=20 sophisticated they will not be needlessly chewing up CPU time while = polling=20 the event queue, instead, your thousands of deer grazing in a = distant meadow=20 will only use CPU time when they need to be moving.=20 <P>I have writing a number of there types of applications before and = would=20 be happy to add my experience to future developments. Please don't = hesitate=20 to ask.=20 <P>Edward Sumerfield, <BR>Pesky user.=20 [View Quote] machine. But on the server side lately we've been seeing a = lot of=20 interest in Linux, for example. I'm not even sure yet what = platforms most people will be running their bots = on.</FONT></FONT><FONT=20 size=3D-1>I'm assuming that, in the long term, SDK apps are = going to more=20 or less parallel world servers in terms of platform of choice, = since=20 most SDK apps will presumably be applications left running 24=20 hours/day.</FONT> <FONT=20 size=3D-1>-Roland</FONT> esumerfd<ESUMERFD at POBOXES.COM> = wrote in=20 message <<A=20 = href=3D"mailto:3606D037.57F62323 at poboxes.com">3606D037.57F62323 at poboxes.c= om</A>>...=20 =20 <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; = PADDING-LEFT: 5px">That=20 is true enough Roland. Still a polling architecture but = simpler than=20 writing threaded apps.=20 <P>So, you haven't commented on the idea of adding a=20 aw_add_event(int , function) funtion to the sdk yet?=20 <P>You mentioned in the thread about the GNU compiler that = your=20 preference is to port to Sun/Unix machines before GNU = because of=20 your belief that high performance bots will run on that type = of=20 machine. If performance is important to you then why is it = that you=20 are not addressing this inefficient polling architecture?=20 <P>I would even go as far as saying that a threaded API is = much high=20 priority than having to worry about porting high powered = servers.=20 <P>What is the reletive hardware mix of your customers at = the=20 moment? Windows/Unix/Linix? What percentage of each would = you say?=20 <P>Edward Sumerfield=20 [View Quote] blocking <BR>in a call to getch(). Something like = this:=20 <P>/* main event loop */ <BR>for (;;) { <BR> /* = check for=20 AW events */ <BR> if (aw_wait(100)) = <BR> =20 /* fatal error */ <BR> break; = <BR> if=20 (_kbhit()) { <BR> /* process keystroke = here...=20 */ <BR> } <BR>}=20 <P>Check out the Windows SDK docs for more info on=20 _kbhit()...you may want to <BR>adjust the timeout = parameter to=20 aw_wait() but 100 milliseconds means you are = <BR>checking for=20 keyboard input 10 times per second which should be = adequate=20 <BR>response time.=20 <P>-Roland=20 <P>>You don't need windows unless you want to make = the=20 interface pretty. A <BR>command <BR>>line interface, = like the=20 dos prompt, is possible with a console app and is = <BR>much=20 <BR>>easier to implement if you haven't done much=20 programming. <BR>> <BR>>Your problem is the = architectural=20 design of the sdk. It is event driven so <BR>while = <BR>>your=20 program is in aw_wait it is waiting for a message from = the=20 server. It <BR>is not <BR>>able to wait for a = keystroke at=20 the same time. <BR>> <BR>>An extension needs to be = made to=20 the sdk for adding user events (Roland?), <BR>such as=20 <BR>>keyboard events. For example, aw_add_event(int,=20 function); This would cause <BR>the aw <BR>>sdk to = wait on=20 your event as well as its own and call your function = when it=20 <BR>is <BR>>fired. <BR>> <BR>>In the mean time = you can=20 use polling but it is not ideal. For example call=20 <BR>>aw_wait(10) so it will wait for 10 milliseconds = for an=20 sdk event to occur <BR>then <BR>>drop back into your = program.=20 Then in your console app you can use the <BR>standard C=20 <BR>>function gets() which would allow you to enter a = string=20 and press enter. <BR>You can <BR>>then do what you = like based=20 on the command entered. <BR>> <BR>>The problem is = that=20 this is a blocking call. Once you have called gets it = <BR>will=20 not <BR>>return to your program until you press = enter. While=20 it is waiting for you, <BR>your <BR>>avatar will not = be able=20 to react to events. <BR>> <BR>>If you want to get = into=20 some more serious programing them you can design a=20 <BR>>multi-threaded solution which would be a little = more=20 realistic. Bare in <BR>mind that <BR>>the aw sdk is = not=20 thread safe so do not allow two different threads to = call=20 <BR>the <BR>>same api. <BR>> <BR>>The design = would=20 involve one thread being dedicated to calling the aw=20 <BR>functions <BR>>and a second thread being = dedicated to=20 accepting input from the keyboard. <BR>There = <BR>>would be=20 one common command buffer that both threads read and a = lock to=20 <BR>protect <BR>>that buffer. <BR>> <BR>>So = your=20 program would start up and kick off a seperate thread to = do all=20 the <BR>aw <BR>>init, start, enter and wait(10) stuff = while=20 the first thread blocked on the <BR>gets() = <BR>>function. Now=20 the aw thread would be able to continue running even = though=20 <BR>the <BR>>gets() was blocked because it is running = in a=20 seperate thread. <BR>> <BR>>In the aw thread, each = time=20 the aw_wait drops out it would check the <BR>command = lock,=20 <BR>>if it is unlocked then it would lock it, check = the=20 command buffer and act <BR>on what <BR>>ever it found = before=20 unlocking the lock. <BR>> <BR>>In the gets thread, = each=20 time the enter key is pressed the lock is checked, = <BR>if=20 <BR>>unlocked then it must be locked and the new = command=20 copied into the shared <BR>command <BR>>buffer, = before the=20 lock is unlocked again. <BR>> <BR>>This is a = polling=20 solution so is not as cpu efficient as the sdk change = but=20 <BR>would <BR>>work. <BR>> <BR>>Good luck = everyone.=20 <BR>> <BR>>Edward Sumerfield, esumerfd at poboxes.com = [View Quote] <BR>>> > wizardry at home.com <BR>>> > <A = = href=3D"http://pcwizard.ml.org">http://pcwizard.ml.org</A>=20 <BR>>> > <BR>>> > Jan-willem De Bleser = wrote=20 in message <BR><360300C7.4AD61B6B at mediaone.net>... = <BR>>> > >I have the following program = (derived from=20 sample #1) which is a <BR>>> > >greetbot. It = runs as=20 a console application in dos or windows. Im <BR>trying=20 <BR>>> > >to get it to accept commands at = the=20 console so i can make the bot move <BR>>> > = >and=20 talk at my command. how would i do that? <BR>>> = > >=20 <BR>>> > >the program: <BR>>> >=20 >#include <aw.h> //i added the library = and header=20 to my program <BR>>> > >directories. unless = you have=20 done <BR>>> >=20 = > &nb= sp; &nbs= p; =20 //that, use "aw.h" <BR>>> > = >#include=20 <stdio.h> <BR>>> > >#include = <stdlib.h>=20 <BR>>> > >#include <conio.h> = <BR>>> >=20 > <BR>>> > >void handle_avatar_add = (void);=20 <BR>>> > >void object_add (void); = <BR>>> >=20 >void avatar_delete (void); <BR>>> > = >void=20 input(char command[100]); <BR>>> > > = <BR>>>=20 > >main (int argc, char *argv[]) <BR>>> > = >{=20 <BR>>> > > <BR>>> > > int = rc;=20 <BR>>> > > char junk[1]; <BR>>> = >=20 > <BR>>> > > /* check command line = */=20 <BR>>> > > if (argc < 3) { = <BR>>>=20 > > printf ("Usage: %s = number=20 password\n", argv[0]); <BR>>> >=20 > printf ("Press any key to=20 continue"); <BR>>> > > gets (junk);=20 <BR>>> > > exit (1); = <BR>>>=20 > > } <BR>>> > > <BR>>> = >=20 > /* initialize Active Worlds API */ = <BR>>> >=20 > if (rc =3D aw_init (AW_BUILD)) { <BR>>> = >=20 > printf ("Unable to = initialize API=20 (reason %d)\n", rc); <BR>>> >=20 > printf ("Press any key to=20 continue"); <BR>>> > > gets (junk);=20 <BR>>> > > exit (1); = <BR>>>=20 > > } <BR>>> > > <BR>>> = >=20 > /* install handler for avatar_add and = object_add=20 event */ <BR>>> > > aw_event_set=20 (AW_EVENT_AVATAR_ADD, handle_avatar_add); <BR>>> = >=20 > aw_event_set (AW_EVENT_OBJECT_ADD, = object_add);=20 <BR>>> > > aw_event_set=20 (AW_EVENT_AVATAR_DELETE, avatar_delete); <BR>>> = > >=20 <BR>>> > > /* create bot instance */=20 <BR>>> > > if (rc =3D aw_create (0, 0, = 0)) {=20 <BR>>> > > printf = ("Unable to=20 create bot instance (reason %d)\n", rc); = <BR>>> >=20 > printf ("Press any key to=20 continue"); <BR>>> > > gets (junk);=20 <BR>>> > > exit (1); = <BR>>>=20 > > } <BR>>> > > <BR>>> = >=20 > /* log bot into the universe */ <BR>>> = >=20 > aw_int_set (AW_LOGIN_OWNER, atoi (argv[1]));=20 <BR>>> > > aw_string_set=20 (AW_LOGIN_PRIVILEGE_PASSWORD, argv[2]); <BR>>> = >=20 > aw_string_set (AW_LOGIN_APPLICATION, = "SDK Sample=20 Application #1"); <BR>>> > > =20 aw_string_set (AW_LOGIN_NAME, "Bot of Zasz");=20 <BR>>> > > if (rc =3D aw_login ()) {=20 <BR>>> > > printf = ("Unable to=20 login (reason %d)\n", rc); <BR>>> > > = printf=20 ("Press any key to continue"); <BR>>> = > >=20 gets (junk); <BR>>> > > = exit (1);=20 <BR>>> > > } <BR>>> > >=20 <BR>>> > > /* log bot into the world = called=20 "beta" */ <BR>>> > > if (rc = =3D=20 aw_enter ("Beta", 0)) { <BR>>> >=20 > printf ("Unable to enter = world=20 (reason %d)\n", rc); <BR>>> >=20 > printf ("Press any key to=20 continue"); <BR>>> > > gets (junk);=20 <BR>>> > > exit (1); = <BR>>>=20 > > } <BR>>> > > <BR>>> = >=20 > /* announce our position in the world */ = <BR>>>=20 > > aw_int_set (AW_MY_X, 1000); /* 1W */=20 <BR>>> > > aw_int_set (AW_MY_Z, 1000); = /* 1N=20 */ <BR>>> > > aw_int_set (AW_MY_YAW, = 2250); /*=20 face towards GZ */ <BR>>> > > if (rc = =3D=20 aw_state_change ()) { <BR>>> > = > =20 printf ("Unable to change state (reason = %d)\n", rc);=20 <BR>>> > > printf = ("Press any=20 key to continue"); <BR>>> > > gets = (junk);=20 <BR>>> > > exit (1); = <BR>>>=20 > > } <BR>>> > > <BR>>> = >=20 > /* main event loop */ <BR>>> > = > =20 char req, command[81]; <BR>>> > > = <BR>>> >=20 > while (!aw_wait (-1)) <BR>>> > > = ;=20 <BR>>> > > <BR>>> > > /* = close=20 everything down */ <BR>>> > > = aw_destroy ();=20 <BR>>> > > aw_term (); <BR>>> = >=20 > return 0; <BR>>> > > <BR>>> = >=20 >} <BR>>> > > <BR>>> > >void=20 handle_avatar_add (void) <BR>>> > >{ = <BR>>>=20 > > <BR>>> > > char = message[100];=20 <BR>>> > > <BR>>> > > = sprintf=20 (message, "Hello %s. Welcome to Beta.", = aw_string=20 <BR>>> > >(AW_AVATAR_NAME)); <BR>>> = >=20 > aw_say (message); <BR>>> > = > /* log=20 the event to the console */ <BR>>> > > = printf=20 ("avatar_add: %s\n", aw_string = (AW_AVATAR_NAME));=20 <BR>>> > > <BR>>> > >} = <BR>>> >=20 > <BR>>> > >void object_add (void) = <BR>>>=20 > >{ <BR>>> > > <BR>>> > = > =20 printf ("Someone has added a %s nearby", = aw_string=20 <BR>(AW_OBJECT_MODEL)); <BR>>> > > = <BR>>> >=20 >} <BR>>> > > <BR>>> > >void=20 avatar_delete (void) <BR>>> > >{ = <BR>>> >=20 > <BR>>> > > char message[100];=20 <BR>>> > > <BR>>> > > = sprintf=20 (message, "%s has left the building\n", = aw_string=20 <BR>>> > >(AW_AVATAR_NAME)); <BR>>> = >=20 > aw_say (message); <BR>>> > = > printf=20 ("avatar_delete: %s\n", aw_string = (AW_AVATAR_NAME));=20 <BR>>> > > <BR>>> > >} = <BR>>> >=20 > <BR>>> <BR>>=20 <BR></P></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML= > ------=_NextPart_000_017E_01BDF488.7A98B640-- A little help with a programOct 11, 1998, 1:27am
This is a multi-part message in MIME format.
------=_NextPart_000_002D_01BDF4D7.C72245E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Well, Microsoft has given an example on how to architekt that for quite = some time now.. =20 the listen(), select() and connect() calls have all an asynchronous = equivalent, which expects a window handle to send a message to on completion. =20 the aw.dll would have to use that instead, open a hidden receive window = for the socket function and have the calling programm have a proper windows message loop. this is the usualy way and can be = expected since almost no windows programm can live without that. and the MFC class library does it exactly that way (although the = documentation doesn't mention it :) ). =20 Windows is called Windows because every programm has to use windows, = regardless of if the users needs them or not :) =20 that approach would have the advantage that it would work in any = programm that has a message loop (including other languages), and that = other events would not be handled or passed-through by aw.dll at all. = aw.dll could use windows messages as well to deliver events. =20 Walter Edward Sumerfield schrieb in Nachricht <361fb171.0 at homer>... Interesting. Walkter, I hope you keep contributing to this = newsgroup. You keep teaching me things.=20 =20 So does windows sockets not being file descriptors give us a problem = with this new aw_add_event design? If can we just pass these non FD to = the same function? =20 If the windows select only listens for sockets how would you = architect a program that listens for windows messages and sockets? =20 Edward Sumerfield ------=_NextPart_000_002D_01BDF4D7.C72245E0 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 W3 HTML//EN"><!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#ffffff> <DIV><FONT size=3D2>Well, Microsoft has given an example on how to = architekt that=20 for quite some time now..</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>the listen(), select() and connect() calls have all = an=20 asynchronous equivalent, which expects a window handle to send a message = to</FONT></DIV> <DIV><FONT size=3D2>on completion.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>the aw.dll would have to use that instead, open a = hidden=20 receive window for the socket function and have the calling programm=20 have</FONT></DIV> <DIV><FONT size=3D2>a proper windows message loop. this is the usualy = way and can=20 be expected since almost no windows programm can live without = that.</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2>and the MFC class library does it exactly that way = (although=20 the documentation doesn't mention it :) ).</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>Windows is called Windows because every programm has = to use=20 windows, regardless of if the users needs them or not :)</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>that approach would have the advantage that it would = work in=20 any programm that has a message loop (including other languages), and = that other=20 events would not be handled or passed-through by aw.dll at = all. =20 aw.dll could use windows messages as well to deliver = events.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>Walter</FONT></DIV> <DIV> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: = 5px"> <DIV>Edward Sumerfield<ESUMERFD at NOSPAM.POBOXES.COM> schrieb in = Nachricht=20 <361fb171.0 at homer>...</DIV> <DIV><FONT color=3D#000000 size=3D2>Interesting. Walkter, I hope you = keep=20 contributing to this newsgroup. You keep teaching me things. = </FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>So does windows sockets not = being file=20 descriptors give us a problem with this new aw_add_event design? If = can we=20 just pass these non FD to the same function?</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT size=3D2>If the windows select only listens for sockets = how would=20 you architect a program that listens for windows messages and=20 sockets?</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>Edward = Sumerfield</FONT></DIV></BLOCKQUOTE></BODY></HTML> ------=_NextPart_000_002D_01BDF4D7.C72245E0-- A little help with a programOct 11, 1998, 1:41am
This is a multi-part message in MIME format.
------=_NextPart_000_0060_01BDF4D9.BA636A80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I must add that if you use windows messages, you follow the microsoft = way of polluting standards and be stuck on the windows platform :) to avoid polling i am quite sure you have to choose different paths for = unix and windows. under unix, it would be best to signal events and have handler functions = act on them. the best windows way is explained below :) the bot i wrote uses a aw_wait(10); polling and that works quite well. = its a c++ written bot, running up to 3 bot at once, and each class does = it own state keeping. just do not multithread that since = aw_instance_set() and following aw_say() is not atomic anymore then. :) but i am getting off topic here... Walter Walter Knupe schrieb in Nachricht <3620261e.0 at homer>... Well, Microsoft has given an example on how to architekt that for = quite some time now.. =20 the listen(), select() and connect() calls have all an asynchronous = equivalent, which expects a window handle to send a message to on completion. =20 the aw.dll would have to use that instead, open a hidden receive = window for the socket function and have the calling programm have a proper windows message loop. this is the usualy way and can be = expected since almost no windows programm can live without that. =20 and the MFC class library does it exactly that way (although the = documentation doesn't mention it :) ). =20 Windows is called Windows because every programm has to use windows, = regardless of if the users needs them or not :) =20 that approach would have the advantage that it would work in any = programm that has a message loop (including other languages), and that = other events would not be handled or passed-through by aw.dll at all. = aw.dll could use windows messages as well to deliver events. =20 Walter =20 Edward Sumerfield schrieb in Nachricht <361fb171.0 at homer>... Interesting. Walkter, I hope you keep contributing to this = newsgroup. You keep teaching me things.=20 =20 So does windows sockets not being file descriptors give us a = problem with this new aw_add_event design? If can we just pass these non = FD to the same function? =20 If the windows select only listens for sockets how would you = architect a program that listens for windows messages and sockets? =20 Edward Sumerfield ------=_NextPart_000_0060_01BDF4D9.BA636A80 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 W3 HTML//EN"><!DOCTYPE HTML = PUBLIC "-//W3C//DTD W3 HTML//EN"><!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#ffffff> <DIV><FONT color=3D#000000 size=3D2>I must add that if you use windows = messages, you=20 follow the microsoft way of polluting standards and be stuck on = the</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT><FONT size=3D2>windows = platform=20 :)</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>to avoid polling i am quite sure you have to choose = different=20 paths for unix and windows.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>under unix, it would be best to signal events and = have handler=20 functions act on them.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>the best windows way is explained below = :)</FONT></DIV> <DIV> </DIV> <DIV><FONT color=3D#000000 size=3D2>the bot i wrote uses a aw_wait(10); = polling and=20 that works quite well. its a c++ written bot, running up to 3 bot at = once, and=20 each class does it own state keeping. just do not multithread that since = aw_instance_set() and following aw_say() is not atomic anymore = then.=20 :)</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT><FONT size=3D2>but i am = getting off topic=20 here...</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2>Walter</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: = 5px"> <DIV>Walter Knupe<WAK at FABER.PING.DE> schrieb in Nachricht=20 <3620261e.0 at homer>...</DIV> <DIV><FONT size=3D2>Well, Microsoft has given an example on how to = architekt=20 that for quite some time now..</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>the listen(), select() and connect() calls have = all an=20 asynchronous equivalent, which expects a window handle to send a = message=20 to</FONT></DIV> <DIV><FONT size=3D2>on completion.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>the aw.dll would have to use that instead, open = a hidden=20 receive window for the socket function and have the calling programm = have</FONT></DIV> <DIV><FONT size=3D2>a proper windows message loop. this is the = usualy way and=20 can be expected since almost no windows programm can live without=20 that.</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2>and the MFC class library does it exactly that = way=20 (although the documentation doesn't mention it :) ).</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>Windows is called Windows because every programm = has to=20 use windows, regardless of if the users needs them or not = :)</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>that approach would have the advantage that it = would work=20 in any programm that has a message loop (including other languages), = and=20 that other events would not be handled or passed-through by aw.dll = at=20 all. aw.dll could use windows messages as well to = deliver=20 events.</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>Walter</FONT></DIV> <DIV> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; = PADDING-LEFT: 5px"> <DIV>Edward Sumerfield<ESUMERFD at NOSPAM.POBOXES.COM> schrieb in = Nachricht=20 <361fb171.0 at homer>...</DIV> <DIV><FONT color=3D#000000 size=3D2>Interesting. Walkter, I hope = you keep=20 contributing to this newsgroup. You keep teaching me things.=20 </FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>So does windows sockets not = being file=20 descriptors give us a problem with this new aw_add_event design? = If can=20 we just pass these non FD to the same function?</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT size=3D2>If the windows select only listens for = sockets how=20 would you architect a program that listens for windows messages = and=20 sockets?</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>Edward=20 Sumerfield</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML> ------=_NextPart_000_0060_01BDF4D9.BA636A80-- Bots or Object Agents ?Feb 7, 1999, 9:33am
After reading this thread it seems like, you want have an SDK application
which is easier to operate than hambot, has no scripts, is more powerful than hamfon, allows creating bots by people who don't even see hambots rather simple scripting, and want to do VISUAL programm while even scripting is above their head ? excuse me, but visual programming differs NOT AT ALL in the concepts of textual programming. you still would have to learn a certain programming type (procedural, functional, list-oriented, object-oriented), and finely the "plug-together" of the program flow is independant in concept from the interface. Textual interfaces have the advantage that you can implement them very faster and easier while gaining the same as a visual interface. do you have any idea how much man-power it needs for a decent click-and-point interface to, say, an OO programming approach ? You don't want to wait for that or pay the guy doing it. And you propably wouldn't like to operate it as well. Visual OO modelers for example are NOT easy-to-use and thats not their purpose. Their just provide a sense of abstraction which is not even needed for, e.g., hambot scripts. Any other visual interface, one that is as easy to operate as, say, driving a car, is unfortunately equally powerful. you can go left, right, straight and back. Blinking is only for left and right. Suitable for a CarBot, but NOTHING for a Bot Programming System. and QA is something different as well... its actually not the different profession, that really finds bugs, its the fact that you have different PERSONS, anybody but the author of a program is qualified for QA'ing it. Eep, it wouldn't hurt if you didn't leave your field of profession regarding such statements as below. Walter aka Faber ps: i am not saying Hambot Scripts are ideal. a bot-making system might take a different approach but still would use scripting. It might use visual designing aspects for actuall visual bot needs (etc. walking path's or bot group formations) Eep² schrieb in Nachricht <36BD406F.2726142C at tnlc.com>... >;) Exactly. This is the thinking "outside the box" most programmers just can't "see". Why? Because they don't think visually. Left vs right brain thinking: psychologically proven. This is also why QA exists to break programmers out of their narrow-minded mode. So it really irritates me when companies want programmer QA...it's defeating the entire purposes of testing perspective. Helllllloooooohhh idiot corps(e)! > [View Quote] Bots or Object Agents ?Feb 8, 1999, 4:11pm
This is a multi-part message in MIME format.
------=_NextPart_000_0024_01BE5396.CE6B7060 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Yes, i do get the idea, and i think its perfectly valid. Any decent bot = should offer a suitable interface to its operator.=20 I doubt that was Eep's point, though.=20 Walter aka Faber Dean schrieb in Nachricht <36BE70BE.1DB21B2A at hotmail.com>... I never wanted a visual bot programming application.=20 Suppose I want a weather application? What I would want with this = application would be a way to fill in a form that asks me what the mean = temperature should be, the barometric pressure, the amount of annual = rain fall, the amount of average humidity, etc. etc.=20 If I want a trivia bot, I want to be able to input the questions and = answers, how long to wait between questions, how many questions, and = etc. via GUI.=20 If I want a games bot (perhaps a soccer bot, for instance), I would = like to have a choice of inputting the field length, width and = boundaries which the ball must remain within, the number of players on = each team, etc, etc by GUI=20 These are some basic examples, but I hope you get the idea.=20 =20 ------=_NextPart_000_0024_01BE5396.CE6B7060 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>Yes, i do get the idea, and i think its = perfectly valid.=20 Any decent bot should offer a suitable interface to its operator. = </FONT></DIV> <DIV><FONT face=3DArial></FONT> </DIV> <DIV><FONT face=3DArial>I doubt that was Eep's point, though. = </FONT></DIV> <DIV><FONT face=3DArial></FONT> </DIV> <DIV><FONT face=3DArial>Walter aka Faber</FONT></DIV> <DIV><FONT face=3DArial></FONT> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: = 5px"> <DIV>Dean<CHALLAGAR at HOTMAIL.COM> schrieb in Nachricht <<A=20 = href=3D"mailto:36BE70BE.1DB21B2A at hotmail.com">36BE70BE.1DB21B2A at hotmail.c= om</A>>...</DIV>I=20 never wanted a visual bot programming application.=20 <P>Suppose I want a weather application? What I would = want with=20 this application would be a way to fill in a form that asks me what = the mean=20 temperature should be, the barometric pressure, the amount of annual = rain=20 fall, the amount of average humidity, etc. etc.=20 <P>If I want a trivia bot, I want to be able to input the questions = and=20 answers, how long to wait between questions, how many questions, and = etc.=20 via GUI.=20 <P>If I want a games bot (perhaps a soccer bot, for instance), I = would like=20 to have a choice of inputting the field length, width and boundaries = which=20 the ball must remain within, the number of players on each team, = etc, etc by=20 GUI=20 <P>These are some basic examples, but I hope you get the idea. = <BR> =20 </P></BLOCKQUOTE></BODY></HTML> ------=_NextPart_000_0024_01BE5396.CE6B7060-- unresolved external symbolsOct 10, 1998, 4:29pm
all external references having "__imp__" in front are references to an
import library. i am quite sure the output is generated if you forget to link with aw.lib Walter Jan-willem De Bleser schrieb in Nachricht <361AC1F0.436F2673 at mediaone.net>... >has anyone actually found out what causes this error? >Linking... >roadbuilder.obj : error LNK2001: unresolved external symbol >__imp__aw_term >roadbuilder.obj : error LNK2001: unresolved external symbol >__imp__aw_destroy [.. above lines repeat sort of 9 times.. ] Debug/roadbuilder.exe : fatal error LNK1120: 11 unresolved externals unresolved external symbolsOct 11, 1998, 1:29am
Jan,
its not enough to have the aw.lib in some directory, you also have to change the project settings to actually link it to your programm. but VC4.0 might not like the library format. so if the programm settings really do try to link to it the linker would complain about using a corrupt library. Walter Jan-willem De Bleser schrieb in Nachricht <361FCC20.C1D22258 at mediaone.net>... >i use vc4.0. i have aw.lib in the lin directory. it has worked with other >bots. it doesnt work with this one or the sample one > [View Quote] unresolved external symbolsOct 11, 1998, 4:19pm
Well,
in VC5 for example you go to Project Settings, select the linker tab, and enter "aw.lib" in the "additional libraries" field. If you forget that, you get the linker errors below. Could it be that you compiled other sample bots or programms using different settings ? or using a makefile ? Walter Jan-willem De Bleser schrieb in Nachricht <3620C42B.7AEFB4EE at mediaone.net>... [View Quote] other aw.lib unresolved external symbolsOct 11, 1998, 8:37pm
Jw,
your code compiles, links and runs fine here, and displays a login error as you expected. i can't see a problem in the source. you would have to give as much information as possible about what you tried, what you entered and so on. walter Jw schrieb in Nachricht <36212CF1.3DCE681F at mediaone.net>... >i trust nobody will steal it and release a roadbuilder of their own bfore me. > [View Quote] Eliza Bot SampleFeb 10, 1999, 3:34pm
well, its time for a "me too" note here :)
Byte / Morrie.... please give me a hint as well for where to get to the eliza source code thanx :) Byte Me schrieb in Nachricht <36C19442.9A9CE07C at usa.net>... >LOL I just had an interesting conversation with the bot, where can I get the >source?? > [View Quote] Bot problem :)Oct 11, 1998, 1:32am
include the aw_say command in the true-block
void handle_avatar_change (void) { int rc; char message[100]; if (rc = aw_int(AW_AVATAR_GESTURE)) { sprintf(message, "Missle launched!"); aw_say (message); } } Byte Me schrieb in Nachricht <361FECE2.5C97 at hotmail.com>... >Ok I'm working on a bot and I have htis entered to reply to a gesture > >void handle_avatar_change (void) >{ > int rc; > char message[100]; > if (rc = aw_int(AW_AVATAR_GESTURE)) sprintf(message, "Missle >launched!"); > aw_say (message); >} > >it replies to all my gestures but I don't want it to respond to the walk >gesture (gesture 0) but it replies to it with a little square or the >words Miss >anyone know how to solve this prob? Cloud bot answeredFeb 15, 1999, 5:36pm
Yes, it is. the cell data limit is a set limit in bytes and has a technical
reason and therefore applies to everyone :) Walter aka faber Edward Sumerfield schrieb in Nachricht <36C8390B.1685B663 at poboxes.com>... >I am not sure if an object created by the all powerful world owner is counted >against a citizens cell limit. That may be an issue. You could not have weather >over a very built up area because the cell limit would be exceeded. This is >where your avatar idea would be better. Backdrop change sample #1Oct 15, 1998, 7:45pm
Edward,
Edward Sumerfield schrieb in Nachricht <3625eb8a.0 at homer>... >Its a cool thing you are going after. I wish you the best of luck. > >A thought about design simplicity. You could make a generic GUI app that >runs bots. It doesn't have to have any AWSDK in it, just a place to >configure the start bot command and a button to start it. You could have a >list box with a list of bot programs then just select a bot and click start. Interesting, i saw this on Linux with all the cd writer software. It seems like one linux theres one party which writes the good software but with lots of complicated command line arguments, complicated enough so that theres another party which writes pretty KDE guis which collect the args out of editfields and do a system() on it. and the throw a hell of a command output at you if something goes wrong :) > >I think my point is that if you keep the AWSDK out of your windows program >you are not going to hit any of the architecture problems that are are >looking at now. For example, all bots linked into your GUI are going to have >to be asynchronous bots, all callbacks installed. Any bot that blocks on the >aw_wait is going to prevent all your GUI from working. Right down to the >standard window resize, move, close functions. They will not work if the one >thread in the program is blocked in a bot. well, i agree, but aw_wait(10) on a timer worked very well for me. I have my gui, although i command my bot mostly by talking to it in aw :) and for the call backs, all i do is look up the bot using the instance and delegate all actions to the bot obect. all you have to do to supply c++ is you have to route your events. just keep it single threaded. thats a real disadvantage. > >Another consideration is the portability of your resulting code. I know >there are world servers running on windows but there are also a number of >unix servers. If you write your program in windows they will not work on >unix. There are a number of cross platform GUI libraries available that >would solve this problem but you will not be able to use the nice VC++ >wizards. Portability is no issue since the sdk is only available on win32. and believe me, we have been trying and using cross plattform libraries, and i would recommend against it. you run into a lot of limitations using those, and you end up having bad GUIs on all plattforms you support. if you have to support multiple platforms, design for it and seperate GUI from everything else, but do so only if somebody pays you for it :) Walter dialog based bot.... questions & errorsOct 15, 1998, 7:31pm
Hey PC,
I am answering your question right below :) PC Wizard schrieb in Nachricht <3625622b.0 at homer>... >You start it up and a "menu" comes up.. then you press the Bot button and >another dialog box comes up. In that dialog box are 4 edit boxes for the >botsname, citizen#, citizen pp, and the start world. After those are entered >you his the "Start Bot" button. My problem is that I don't know how to >"assign" (don't know the correct word for it) the botname, starting world, >and citpp to a name besides IDC_BOTNAME_EDIT etc.. the cit# what I did was >go to ClassWizard (I'm using VC++) then Member Variables, then assigned a >member variable called m_citpp with the type: int. But what type (or what >do I do) for the other 3? I need something to replace the argv parts of the >login (using Sample #1 for start of coding). I can't use CString (I found >out the hard way cause I didn't know how to do some of this stuff) , when I >use any of the other types listed when I click "Add variable" under member >variables I get an error saying it can't convert it to char *. how would I >do this then? (I'm novice at C/C++ .. :)) Well, the answer to all of this is simple, use CString. Thats what i did. There is only one problem: CString can be used as any "const char *" because its a C++ class which has an overloaded casting operator. BUT the aw_string_set are c style functions, and c style programmers do not care about the "const" attribute. this prevents a c++ compiler from letting you use CString as the argument for aw_string_set. Roland might change his include file (and his dll source as well) to use "const char *" whenever he does not need to change the supplied string. you need a work around which casts the CString to (const char *), and then to (char *). (assuming, and thats the bad part of it, that aw_string does _not_ change the supplied string) that would look like CString m_loginname = "Daniel"; aw_string_set((char *)(const char *)m_loginname)); and since that looks very ugly, you hide it using a define. #define AWSTR(param) (char *) (const char *) param Heres the part from my bot code which sets the login parameters, directly from the member variables created in class wizard. aw_int_set (AW_LOGIN_OWNER, m_citizennr); // Faber citizen number aw_string_set (AW_LOGIN_PRIVILEGE_PASSWORD, AWSTR(m_privilegepw)); aw_string_set (AW_LOGIN_APPLICATION, AWSTR("Faber Bot App")); aw_string_set (AW_LOGIN_NAME, AWSTR(m_name)); If you do this in the message handler for a button on the dialog, remember to call UpdateData(TRUE) first to make sure the class members are in sync with the dialog controls. >Also if possible is there a way to have it print the log (like the printf >lines) to another edit box? (IDC_LOG_EDIT) and put errors into popup message >boxes, since it's not a console app.... Sure, create an edit box control on your dialog window, assign a member variable to it of type CEdit (note its a control association, not a data transfer) and name it m_status, and add a function (using ClassView, or do it your own) like follows: void CDanielDlg::Print(const char * message) { CString outmessage; outmessage.Format("%s\r\n", message); // note the \r which is important in edit fields m_status.ReplaceSel(outmessage); // add text to current cursor position int start, end; m_status.GetSel(start, end); // get selection position m_status.SetSel(end, end); // remove the selection and set cursor at end of it } (taken from the Daniel bot, if you ever ran into it :) i usually carry it around when i am in aw ) you can call it with constant strings, not const strings or CStrings, whatever you prefer :) If its not enough to have errors logged in there, use the MessageBox system call for it. Inside a window class using MFC the function prototype is MessageBox(const char *message, const char *title="Error", int style=MB_OK) so try MessageBox("Could not log in to AW universe"); for simple boxes or if (IDYES == MessageBox("error occured, continue?","Please select", MB_YESNO)) // continue here else // do not continue hope it helped :) Walter > >thanx to anyone who replies :) > >PC Wizard (ICQ-537376) >wizardry at home.com >http://pcwizard.ml.org > > dialog based bot.... questions & errorsOct 15, 1998, 7:37pm
Edward,
Edward Sumerfield schrieb in Nachricht <36256c9b.0 at homer>... >May I offer some high level advice. Leave windows alone. > > It may be pretty, > it may be cool, > but drat that darn thing, > it'll make you feel like a fool. nah..... i think its cool whatever you are used to... > >I've been programming for 13 years and I still have problems when I get into >that area. Of coarse most of my experience has been in a Unix C environment >but I feel confident in saying that you are entering a very complicated >area. Nope, its about as difficult as having a real good argc argv parser (including options with arguments separatet by quotation marks and reversing and stuff :) ) GUI used to be very complicated (win16 API), but MFC helped alot. > >The problem is that the app wizard you ran is nice and gives you a quick, >basic framework that looks good but now you really have to understand what >it is doing to be able to make it do what you want. thats actually true. it makes you feel you could work with VC as you can with VB, but thats not the case. but thats something you soon discover :) > >Maybe Walter can give you some advice, he seems to be the Windows guru >around here. oh well, i did and i hope it helped :) > >Use argc, argv to start with. Check out the scanf function for user input. >So you might write a program like this. > >main() { > int number; > char name[32], priv[32]; > > printf("Enter user #, Robot name, priv passwd : "); > scanf("%d %s %s", &number, name, priv); > > etc. >} > >Learn the standard C functions. If you are just starting out learning to >program then you should begin with an object oriented language like Java or >C++. I recommend Java because everything you need is free and it clearly >demonstrates OO design principles. This is really unix background :) Windows things are a different world. 16bit-windows never had a reall command line or at least no documented argc argv (dos had, but windows didn't). > >Edward Sumerfield dialog based bot.... questions & errorsOct 16, 1998, 3:27pm
The attribute "const" is in c is almost code flavour only. the c compiler
does not really care. in c++ it has become very strict. you can't change what is const and you can't use something that is const as something that is not const, unless you cast to it (so that you know whats going on). and you can depend on the fact that people wont change what you supply as const. so i'd say that you actually change your (char *) parameters in your aw.dll and aw.h to (const char *). recompile it to see if the c compiler complains. (if you use c++ in there i am quite sure it will, since your code is adapted to "char *" and not "const char *.) if it does NOT complain, you are on the safe side and your interface description is more safe and more accurate for c++, and in that case DEFINETELY change aw.h in the next sdk build :) Walter Roland Vilett schrieb in Nachricht <36267d7a.0 at homer>... > > >I don't believe any strings passed to the API are modified anywhere in the >SDK. The SDK always makes its own copies of everything. Are you saying I >should change all "char *" in the function prototypes to "const char*"? I >can do this easily, if it will help. I have to admit that this is one area >where my knowledge is a bit hazy... > dialog based bot.... questions & errorsOct 16, 1998, 3:29pm
if you declare a function as void, it MUST not return a value under c++ ( c,
again, doesn't really enforce this). so remove the return line, (or at least the value to it, change it to return; ) for the linker errors, make sure to adapt your project settings to inlude "aw.lib" as additional libraries in the linkers tab (both for release and debug version). Walter PC Wizard schrieb in Nachricht <3626B401.939B0CB8 at home.com>... >BIG Thanks! That made my day! (maybe my week :)) But VC++ doesn't like >the return 0; line at the end: >D:\DevStudio\MyProjects\AWTeenBot\AWTeenBotDlg.cpp(246) : error C2562: >'OnStartbotButton' : 'void' function returning a value > >I commented it out (just to see what it owuld do then) and it gave me >this: >AWTeenBotDlg.obj : error LNK2001: unresolved external symbol >__imp__aw_term >AWTeenBotDlg.obj : error LNK2001: unresolved external symbol >__imp__aw_destroy >AWTeenBotDlg.obj : error LNK2001: unresolved external symbol >__imp__aw_wait >AWTeenBotDlg.obj : error LNK2001: unresolved external symbol >__imp__aw_state_change >AWTeenBotDlg.obj : error LNK2001: unresolved external symbol >__imp__aw_enter >AWTeenBotDlg.obj : error LNK2001: unresolved external symbol >__imp__aw_login >AWTeenBotDlg.obj : error LNK2001: unresolved external symbol >__imp__aw_string_set >AWTeenBotDlg.obj : error LNK2001: unresolved external symbol >__imp__aw_int_set >AWTeenBotDlg.obj : error LNK2001: unresolved external symbol >__imp__aw_create >AWTeenBotDlg.obj : error LNK2001: unresolved external symbol >__imp__aw_init > > >PC Wizard (ICQ-537376) >wizardry at home.com >http://pcwizard.ml.org > [View Quote] dialog based bot.... questions & errorsOct 16, 1998, 3:31pm
you forgot to add the function to the class declaration in the corresponding
header file. this is what your class wizard does for you usually, unless you are adding a function yourself. open "AWTeenBotDlg.h" and look for the CAWTeenBotDlg class declaration.. in there you find several function and variables definition already, add a line saying void Print(const char *message); to it. Walter PC Wizard schrieb in Nachricht <3626DEB0.B9CAAEA8 at home.com>... >I get this error on the code you geve me to get the log to print to the >edit box: > >D:\DevStudio\MyProjects\AWTeenBot\AWTeenBotDlg.cpp(189) : error C2509: >'Print' : member function not declared in 'CAWTeenBotDlg' > >This is the code I have in there: >void CAWTeenBotDlg::Print(const char * message) >{ > CString outmessage; > outmessage.Format("%s\r\n", message); // note the \r which is >important in edit fields > m_status.ReplaceSel(outmessage); // add text to current cursor >position > int start, end; > m_status.GetSel(start, end); // get selection position > m_status.SetSel(end, end); // remove the selection and set cursor >at end of it >} > >PC Wizard (ICQ-537376) >wizardry at home.com >http://pcwizard.ml.org > dialog based bot.... questions & errorsOct 16, 1998, 9:01pm
Well,
it would help alot if you'd sent me the code. use my private email address wak at faber.ping.de and include all files matching (*.cpp; *.h, *.c; *.dsp; *.dsw; *.clw) i'll post my results here so that everyone sees it :) Walter dialog based bot.... questions & errorsOct 17, 1998, 12:46pm
PCWizard,
i have examined your code and fixed a couple of things in it. first of all, your bot programm could not log in because you didn't call UpdateData(TRUE) as i mentioned in my post, which caused your member variables to be empty and your bot trying to login using "" as the name, resulting in "name to short" error reason code. you could not see the error message because you didn't use the Print function that was supplied by me, you still used printf(). your programm exited immediately because you called exit() after error output, which is something you don't do on windows.you return from the function instead. i fixed all this, and it runs just fine now. I startet it and it send itself to awteens world. i could not enter there using AW browser (access denied) so i sent my own bot after yours, and i could verify that awteensbot actually appeared there. additionally i fixed the following things: - I changed your log output edit field to include the "multiline parameter" - the aw_init and aw_term / aw_destroy moved into the application class because thats where they belong unless you run multiple bots (in thats case aw_destroy is need for each bot) - i added the code lines to save your dialog contents into an ini file. the windows api creates and maintains an "awteenbot.ini" file now in the windows directory - i gave an example for parameter checking when using CString - i included "aw.lib" for debug compilation and, most important - i removed the aw_wait(-1) from your bot startup function. instead I added a timer which is called by windows every second, and in the timer handler it calles aw_wait(10). that results into your GUI and your bot beeing responsive. all my changes are marked with "WAK" regards, wak Walter Knupe schrieb in Nachricht <3627d0e3.0 at homer>... >Well, > >it would help alot if you'd sent me the code. > >use my private email address wak at faber.ping.de and include > >all files matching (*.cpp; *.h, *.c; *.dsp; *.dsw; *.clw) > >i'll post my results here so that everyone sees it :) > >Walter > > I > > > SDK apps tied to other programs ?Oct 15, 1998, 7:50pm
The main use for voice recognition software is that you use it to type. type
in word processors, in excel sheets and in whatever. that means almost every software of this kind is able to input characters as keystrokes into other applications. since you can write a GUI bot for use to talk and listen inside aw, you can easily have TrueVoice or ViaVoice or whatever they'calles talk through a bot AND, of course talk in the AW browser itself. no need for transfer using a text file. Jw schrieb in Nachricht <36265EDC.BF1656EB at mediaone.net>... >if you had a program that took your voice, stored it as text in a file, then >sdk could open it. you simply have to use the C command to open the file in >ASCII mode. tell it to open, maybe, every 30sec, and if there is new text, >say it in aw. but that would only work in the bot, not actually >activeworlds. A bit of help :)Oct 16, 1998, 9:04pm
Keep an eye on the windows api functions
GetPrivateProfileString GetPrivateProfileInt WritePrivateProfileString for own .ini files the best you can get :) e.g. WritePrivateProfileString("section","tag","value","myfile.ini"); creates or changes an "myfile.ini" that reads [section] tag=value and GetPrivateProfileString would be able to read that into a buffer or CString Walter Number of logins per ownerOct 17, 1998, 10:17am
Which instance determins the number of bots one can run ?
My bot allways failes to spawn more than 2 more bots, 3 in total, and it fails at the aw_login, which means that is a universe limit. is that correct ? i am sure its good that the number of bots is limited, but e.g. for the beta world, it would be nice if the limit was much more, since it would allow for more bot testing :) imagine 10 bots controlled by one programm, you could have a dance performance or sth similar :) 3 bots don't even match spice girls (well, by now they do since spice girls are down to 3 :) ) Walter User countsOct 18, 1998, 7:57pm
Which means that SDK bots do not count.
Hambots do count. and you almost ever run into one :) Its quite funny to stay at Beta GZ.. every 5 mins some hambots appear, mumble something, chase each other and dissappear. no owners in sight :) Walter Byte Me schrieb in Nachricht <362A6058.2C4E at hotmail.com>... >Only 2.1 servers don't count bots :) [View Quote] Bot logging...Oct 22, 1998, 7:14pm
Don't use fopen everytime you write a log line unless you use fclose() in
the same function to close the file again. its more efficient to keep the log filehandle variable at global scope FILE *logfile; main() { logfile = fopen ("mylog.txt", "a"); // "w" overwrites "a" appends to existing log if (!logfile) { printf("warning: can't open logfile for writing. no log is written in this session\n"); } aw_init aw_create aw_login aw_enter set position set chat callback. while aw_wait { } aw_destroy if (logfile) fclose(logfile); close(); } chat callback { get chat message if (logfile) { fprintf(logfile, "Saw chat '%s'.\n", chat message); } } Jw schrieb in Nachricht <362F15A0.AD930AA5 at mediaone.net>... >there is a problem with your code: scope. the file variable can only be used in >the main program in your example. here are the changes: >main { > aw_init > aw_create > aw_login > aw_enter > set position > > set chat callback. > > while aw_wait { > } > > aw_destroy > close(); >} > >chat callback { > > fopen(); //you have to do this in every function you want to be able >to save > get chat message > fprintf(log, "Saw chat '%s'.\n", chat message); >} > > [View Quote] Bot logging...Oct 23, 1998, 1:53pm
Jw schrieb in Nachricht <362FD130.33BE812C at mediaone.net>...
>Walter, i owe you an apology. i did not notice the decleration of the variable outside the >main. if you do it the way you did, then it works. That's ok :) Walter confused...Oct 23, 1998, 5:49pm
The loop breaks if the aw_state_change returns a value not equal to 0, which
means when you run into an error while setting the new avatar position. I think bots move as other people do, they just need fewer repositioning steps which usually means that one repositioning is sufficient. the aw browser translates a sudden repositioning into a smooth move, (or a fast one if you move far in a short time). so the decision if you walk or glide is actually made in each users browser, therefore you can't really influence it (and you don't want to break down a move into several small steps because of that anyway :) ) Roland, if my observations are wrong, please correct them :) Walter Dataman schrieb in Nachricht <3630DBBC.AD0B298D at synergycorp.com>... >I'm trying to get an avatar Model bot to walk smoothly and so far I'm >feeling rather moronic, maybe I just worked too late last night playin >bone...anyway, when I just tell it to reposition 10 yards away it walks >a few steps then GLIDES. When I use a for loop and wait in between baby >steps it gets jerky. > >I did see this in the API docs and my poor little peanut brain is >reeling: > >/* spin on a dime (45 degrees/second) */ >for (yaw = 0; !aw_wait (1000); yaw += 450) { > aw_int_set (AW_MY_YAW, yaw); > if (aw_state_change ()) > break; > } > >While I am not really a structured programming freak, the break confuses >me :) What's the condition that causes the loop to end? > |