Board ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
grimble // User Search
grimble // User SearchWishlist Bot CommandsFeb 26, 2002, 10:31pm
Not sure how fast you want it then. Its going to be as fast as "shooting"
the guy - the bot has to do it whatever. [View Quote] Wishlist Bot CommandsFeb 27, 2002, 12:54am
Maybe I am not understanding what you mean. I mean have sequences 0 to 5
(for example) as weapon select on ALL player avatars in the world. I am assuming you're having custom avatars from what you said earlier (although I may be reading between the lines too much). Grims [View Quote] Wishlist Bot CommandsFeb 27, 2002, 7:12am
Good point ... and if you call them "1st", "2nd", etc. or whatever, in the
avatars.dat, with the numbers at the beginning of the name, I guess you can use Alt+1, Alt+2, etc. to select the weapons. [View Quote] he-alllppppppp! (help) please :)Mar 6, 2002, 12:50am
Not crappy ... just different. You can have a control array in VB and
load/unload instances of the control dynamically, which is synonymous with accepting the instance pointer from the aw_create method in C. Grims [View Quote] how do i convert time to VRT?Mar 22, 2002, 6:28pm
Although the local timezone is clearly important since that's the time you
have available, windows gives you a mechanism to find out what you need to know. VRT is GMT - 2 (the middle of the Atlantic somewhere), which you can get from Windows very easily using the GetTimeZoneInformation windows API call. The SDK only gets one notification of the current VRT ... in the AW_EVENT_UNIVERSE_ATTRIBUTES event. Because of this, you have to maintain the VRT value yourself. each time you want to update the display. There are three stages to handling VRT ... (1) When you receive the AW_EVENT_UNIVERSE_ATTRIBUTES event (after a successful login), calculate and store the difference between the value in supplied in the AW_UNIVERSE_TIME attribute and the local time on the client machine at that point. Note that the VRT value is the number of seconds since midnight on 1st Jan 1970 and so you need bear this in mind. You can get a relative date/time by using VB's DateAdd function: datetimeVRT = DateAdd("s", awSDK.AwUniverseTime, "1 Jan 1970 00:00:00") HOWEVER, this will be based on midnight 1st Jan 1970 IN YOUR TIMEZONE and will result in a date/time close to the current date/time IN YOUR TIMEZONE. (2) Immediately after performing (1) ... i.e. still in the event handler ... calculate the difference between the current date/time on your machine and the value caluclated in (1). This will be the difference between the relative VRT and your local time and should be a number of seconds. offsetVRT = DateDiff("s", datetimeVRT, Now()) the value in offsetVRT will need to be available later. (3) Each time you want to display the current VRT you will need to apply two offsets to your local date/time ... the minor difference between the two clocks (offsetVRT above) and the GMT - 2 adjustment. The first is simple using VB's DateAdd function again, but the GMT value is where the Windows API call comes in. I'm not going to go into it here, but I've attached a small project that shows VRT on a form after logging in. The module modTimeZoneSupport is taken from code I found in a vbCity forum, but basically the GetUTCTime function will return GMT. Then you just need to apply a -2 hour time difference with DateAdd (yet again) and Robert's your father's brother ... VRT. Don't expect to match the AW Browser VRT display ... it won't happen through design, purely by coincidence. Hope this helps. Grims. Grims. [View Quote] begin 666 VRT Demo.zip M4$L#!!0````(`-B<=BQ9K[%CHP<``'8;```7````5E)4($1E;6\O9G)M5E)4 M1&5M;RYF<FWM6&UOXD at 2_AXI_Z'%2IM$"JQ)(,GL*BN9E\QP1P!A$R9S6J$& M-^"-Z49V$Y)9[7^_JC:VV\:8VYT]W7U8:V"(Z[WJZ:JRG]I#J]/OD7K%,$Y/ M^M-?V4R2>U+ZK?IP?5NKW5R7[VH/M7*UVJJ73>/#;=DPZD;#K)EW#\;#[]]5 M*\9W1NDG4C+'5NN?_>;G6 at 6^2J<G#;9P.7EJ5!Z$OR)S?_4TM%ML)<CI"2&D M2=?2%9Q$USU\2LA9+85TSV5<?F+N8BDC>M7X4->(73:7B?"-H9%LL=;T7M=T ML;'KR&5,J]W<A8)=E[^ F#L[X) UHQY+_$D[I(B)XK1F2U)?CM8#$; at J9.42 M(6=CESMB&Y 6F].-)Q5OG+2F6*TH=QH;*4%D/;4DA*18R('D(4<IXFAS.O68 MD^(PX'/V0+V 15Q:.#'7]6T](B<)ULB&841TFTX[W&%O.CT63DJ0$&\262U9 M,3E.9YL[Z6S8[HKY1*Y\P%"<A0Z7S'^E7EI%8B+/_=J5YGZ!AWL>[-<#BGJL M(, 25^2_D.O"2*I7?S+773IE'O&FWH/+/,=VI<>*XX2:Q%$J+0-?K)DOW\F# MX$F.X.K1%2/:I<0?+6)1'A"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M^;T!``"^` at ``% ```%925"!$96UO+U925$1E;6\N=F)P99)-;YM $(;O2/P' M"RYM):.U33[:B ,!TZ+4Q at K4;BM?%C,DF^X'6A;'293_WEUP8[7EL'KG&<W. MS+L43PT$\P/85B(D"VK)UK=%#$QX6MK6+=0 at at >\ at ^+#]_((0FB)_AL9:'(_H MCQH^__S5G7K(16[T:;M)EW&VR;?YC[R8+[:MJ at 2%J:=HZ69?YZ.P4X)A102W MK:Q\ at )T*7B;)[,+WSV?C2S_QQY-)?#8.T<<+W>$,78=^>)F at Y-6=F Y7HW"3 MQS=9]-WW]&%;"U%U% (FJH(P^"DXY%W3"*FN1O\SK\2M;:4[P?N]G=/BCFWE M"DO5-?_02#"&>36;!HZ.EIA!X)RR7X VD> *#BJ-`P<-!8W>KZ2 at 1X.!+?"# MD&N0P41KP at >-C-%[TFHKCJ'Q)N4["0RX.K(<Y![D<?Z$4& at --4T([6TLS%MJ ME#6*,/+\%TOP7LB5OHQT;"7%.\7>#]45K D\QE!V=RFOA8%+$5*"6\+O3'0M M.EZUT3WL?O67ZQEJ*A[?0$)7 at G!UBN-T_19\X]*40Y6L^A6,L;T9?0XK!28Y M&* PX8,N[B7 at : at 7R^%L at X]MAV;%2HWK(ML;!WU!+`P04````" #9G'8LY UX M%U ```! at ````% ```%925"!$96UO+U925$1E;6\N=F)W2RO*#0L*<4G-S5>P M53 QT0%C,W-#'05C(R,=!1T%$ G"9B:60#$#`QT%9UZNW/R4D,S<U*C\O-3 at MTH*"_*(2H&XS,QT(MC0&J at 29$\7+!0!02P,$% ```` at `RI!V+(J[3S8^! `` MV P``!\```!64E0 at 1&5M;R]M;V14:6UE6F]N95-U<'!O<G0N8F%SK59=3^,Z M$'U'XC^,JM5M<M4ME'U9K82N2BAW*]$6T0):7BHG<5HOB1W9#MGRZW?LU#2! M\"%V^]"/R?&9F3/CZ0RUEBPL-(7KD^649!2.H9.)>,$R>BLXG1=Y+J3N[._- M<LT$A]&O/&41T_M[^WM=F$FV8IRD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*$2D_AYZZL3YIEG&#[XT^+ZL$_WP]]6*PIM]&W M\F'\YS31VP//#G^& at 4U]E"KZ*HD-JPM<`,>$>J $Q()W-91"R at V04!1XL;3E M0IG&R>N2 at 2%WDMDUF$ NF.U<E(_ %6=F&=M"^J^)9TN;YNKAQC5]RQ5[=EEJ M75(9/WENY_3<:H*4/OP+1UNQNG!D6U8=1+:>CW<B$OFFRJ(9-EX+3(;3$D*K MHT&W+:/5,FZ][/8B=-Z#SP-GP%![6$KNX1=_"\6W;<O6I&BT?;VQ\%S;Q/H- M4$L#! H``````$)_=BP````````````````)````5E)4($1E;6\O4$L!`A0` M% ```` at `V)QV+%FOL6.C!P``=AL``!<``````````0` at `+:!`````%925"!$ M96UO+V9R;5925$1E;6\N9G)M4$L!`A0`% ```` at `V9QV+),&//F]`0``O at (` M`!0``````````0` at `+:!V <``%925"!$96UO+U925$1E;6\N=F)P4$L!`A0` M% ```` at `V9QV+.0->!=0````8 ```!0``````````0` at `+:!QPD``%925"!$ M96UO+U925$1E;6\N=F)W4$L!`A0`% ```` at `RI!V+(J[3S8^! ``V P``!\` M`````````0` at `+:!20H``%925"!$96UO+VUO9%1I;65:;VYE4W5P<&]R="YB M87-02P$"% `*``````!"?W8L````````````````"0```````````! `_T'$ B# at ``5E)4($1E;6\O4$L%! at `````%``4`30$``.L.```````` ` end AW Facing DirectionApr 26, 2002, 9:15pm
The bot method is the only fool-proof and accurate way to do it, as Baron
describes. I'm guessing that your trying to do this as a kind of "sister-app" for the browser, although I'm a bit confused where "from 4 miles away" comes into it if you're not intending on using a bot. Another problem of the title bar method is that oneone tap of the F11 key and your source of information is gone. I can see why you'd rather not use a bot, since the darned thing needs to be visible in the world to receive the AW_AVATAR_* events and that's just nasty. One central bot or group of interlinked bots with TCP capabilities and a small client that queries the it/them for a specific citizen's location would be the neatest way to achieve it, but obviously more involved. Good luck. Grims [View Quote] AW Facing DirectionMay 3, 2002, 7:23pm
Like I said, I think there is only one way to do it successfully ... which
is nasty. Not judging. [View Quote] Brant's paintball bot is full of errorsMay 5, 2002, 8:40pm
Unusual behavior of AW SDK in classesMay 20, 2002, 1:56pm
Its the same problem as you get if you want to wrap the Winsock control ...
there is no object exposed under the control for you to instantiate - so the control HAS to be owned by a valid container (a form). There are two ways to handle it. The first (and quickest in terms of development) definitely works but is a bit nasty, and that's to have a form with just an SDK control on it (plus a timer if you like - to keep the bot class self contained). The class then has two member variables to handle it - one for the form and one (WithEvents) for the control. In the class_initialize, instantiate a new form against the form member variable and then set the control member variable to the control on the form. This example may look like the MSDN code. Consider a form called frmBotControl, as described above, with the SDK control on it (called awSDK). Private mControlForm as frmBotControl Private WithEvents mAWSDK as AwSdkOcx4 Private Sub Class_Initialize() Set mControlForm = New frmBotControl Set mAWSDK = mControlForm.awSDK End Sub Private Sub Class_Terminate() mAWSDK.AwTerm() Set mAWSDK = Nothing Unload mControlForm Set mControlForm = Nothing End Sub Using the above, you should be able to instantiate a single bot (unless I've forgotten something), totally self-contained, communicating using the mAWSDK member variable and receiving all the events through it. It can run out-of-process too. The other way is to build a broker class that does basically the same thing but loads/unloads its own SDK controls on its own form to hand out to other classes requesting it. Essentially, you would start the broker and the initialisation code of the bot class would request a control from the broker and the terminate code would tell it to discard it. The broker method is "Nicer" but I've always used the first way, with an intention of putting the broker in place later. The problem is I've never got around to it, and I have a feeling it may not let you unless you make the form in the broker public (ick!) .... and maybe not even then. If you're not going to start a whole bunch of bot classes, then there's no real impact on having a form/control in the bot class itself. Hope that helps, otherwise let me know and I'll knock up an example for you to use as a template to save some time and keep your follicles in your scalp where they belong. Grims. [View Quote] Re: bot classesMay 21, 2002, 8:29am
Is this a reply to Brant's question? If so, I think you're wrong - its not
simpler to make a bot class in C++ (which I assume you meant). The main issue is that you cannot provide a reference to a class member function as a callback function, so the whole callback process must be supported by a separate mechanism. This mechanism has to accept the event, determine the object that the event was intended for using the instance sdk instance parameter and deliver it accordingly. Also, all instances of VB classes are created as COM objects and therefore a COM DLL can be created very easily to distribute the classes as a bot framework with very little additional work as well as run out-of-process very easily. Grims [View Quote] > i meant write the bot classes in C :) Re: bot classesMay 21, 2002, 10:01am
I'm not trying to convince you. Your comment was that it was simpler to
create bot classing C++, which is not correct. The simplest of the two options is clearly using VB. Its true that VB has no implementation of polymorphism and subclassing, but that is a totally different subject and not relevent here. You'll have to forgive me for not understanding what "I cant imagine running 2 different callbacks in the same setting for 1 AW Event, in any language." might mean. If you have more than one bot running within the same application, the application must use some mechanism to route the events to the correct bot class. The SDK cannot do it because you cannot connect the callback to a member function of the class, so it has to be outside the class. Since you can have more than one instance of the bot, some form of registration with a central "active bot instances" list is required, so that the events for a particular instance can be routed to the class representing that instance. An example would be a simple bot that tracks avatar movements. This could be instantiated twice int he same application, one for each of two worlds. Same events are registered with the SDK for both bots, but you wouldn't want the messages intended for the bot in world #1 being delivered to the bot tracking world #2. As for DLLs, since we're talking about encapsulating SDK function in a class, the DLL in question would need to expose that class in a suitable way. VB can create COM based DLLs and applications for in-process and out-of-process objects ... more easily and quicker than the same task in C++. [View Quote] Very Puzzling FunctionMay 24, 2002, 4:20pm
I think the way I would approach it (even in C++) would be to prebuild (and
maintain) a 40x40 cell array to cover the query area, and then, under each cell (using the largest possible bounding box for each model), hold a list of references to the models that MAY overlap it. That would obviously cut down the checks to the objects that could feasibly be in the cell. Very Puzzling FunctionMay 24, 2002, 5:40pm
Please don't turn this into another "C++ is better than VB" thread. If you
steer clear of huge amounts of classes there's no issue real with VBs performance in something like this. I really don't see where the overhead comes in. If you structure and reference the stores appropriately, there's no great overhead on managing the array in terms on memory or speed. Compiled VB code "number crunches" at comparable speeds to compiled C++. The key to improving performance of anything is to move as much of the process as possible out of repetitive tasks. Object placement is not the time to go navigating a list of any reasonable size. Storage vs Performance is always a balance and slightly larger memory usage is of no consequence when it comes to avoiding a 2 second parse of a collection. [View Quote] Very Puzzling FunctionMay 26, 2002, 10:15am
Just to close this daft and uninformed "VB is slow/crap" trash, I've now
implemented exactly what Brant described which has been tested with a 3x3 survey zone at three reasonably well populated locations including AlphaWorld GZ. Below are summaries of the zones ("Models" is the number of unique models used, "Objects" are the number of actual objects in the zone and "References" is the total number of references to the objects - i.e. the number of potential overlaps calculated using the origin of the object and the maximum distance of a vertex from the its origin). Area 1 - Models: 159, Objects: 3367, References: 27693 Area 2 - Models: 232, Objects: 3920, References: 31447 AlphaWorld GZ - Models: 316, Objects: 5792, References: 47476 If anyone can point me to an active building area where I can kick this in for a few hours for some final testing, that would be welcome. The maintenance of the cache performs acceptably ... showing a ZERO execution time on all adds and deletes, while fully maintaining the objects and their references in the zone and discarding all unwanted data/memory on the fly. Using a max radius of 1000 (1 cell) for each object - from Brant's code it looks like he already has this information for each object so there was no need to replicate the scan of the model file - an encroachment check on AW GZ is reduced to 63 objects which is negligable and will also show a zero execution time. For info, a zero exec time calculated using the VB Timer function represents significantly less that 1/100th of a second (if it was just under 1/100th of a second, some calls would show a 0.01s exec time but they're all 0.00). I'm not going to share the code here, because it was put together for Brant's use, and I'll leave it up to him whether he wants to post it in the newsgroup. his project is, after all, "sekrit". As a final note for all, writing performing VB applications is all about using the right technologies and methods for each task. All VB objects (including forms, controls and in-code objects such as collections, as well as those instantiated from classes) are COM objects with the associated overheads. COM is intended for interfacing, such as the objects exposed by MS Office applications for use in VBA and not suitable for excessive internal use. Every time you access an object in VB it must pass through all the marshalling inplace to enable the object to be exposed outside the application/component (although there is less of this for private classes, it is still there). A few internal classes in an application is fine, such as one for a world session table which allows all the session table related function/data to be encapsulated. However, private data should be maintained the "old-fashioned" way with user defined types, dynamic arrays and appropriate management routines (ultimately not that different to writing a class). Even if you intend to expose an instance of the internal data as a class (such as an avatar in the session table example), the chances are it would perform substantially better if a new object is created on-the-fly from the internal stores when it is requested. To demonstrate the difference, if classes and collections were used in the code for Brant then memory is gobbled up quick as you like, and we've seen from Brant's original post what the performance implications are. Using structures and managed dynamic arrays, you get the performance I've indicated above and minimal impact on memory usage. It all depends on a balance between the number of accesses vs the internal overheads you face in managing collections of objects. I'll say again, compiled VB code performs comparably with compiled C++ code - THIS IS A FACT no matter what your prejudices. If you directly convert VB code, as-written, to C++ (creating ATL classes for the each of the coded and supplied classes used in VB) then that application would perfrom roughly the same as the VB equivalent. Any programmer worth their salt uses the language that best suits them, including the level of expertise they have available on a given language and its suitability to the task. Anyone that makes general claims that one language is "better" than another or disparages a specific language off the cuff is a fool. Although VB is a BASIC derivative in terms of syntax, anyone that sees that fact as significant is sorely illinformed. [View Quote] Very Puzzling FunctionMay 26, 2002, 11:30am
34 Year old with 16 years experience in the development of cross-platform,
enterprise and large-scale financial systems in a number of languages and environments. Currently a self-employed software consultant working for international companies. Bite me! [View Quote] Very Puzzling FunctionMay 27, 2002, 4:11pm
*sigh* ... gotta say, didn't expect you to join the ranks of people who
can't keep a serious perspective on a development newsgroup. As I said only two sentences further on ... "For info, a zero exec time calculated using the VB Timer function represents significantly less that 1/100th of a second (if it was just under 1/100th of a second, some calls would show a 0.01s exec time but they're all 0.00)." Make an effort will ya! Why is it that people would rather say anything than have nothing to say at all? Grims [View Quote] Very Puzzling FunctionMay 28, 2002, 12:23am
[View Quote]
Sorry ... I have very little sense of humour with this NG at the moment.
> You were making the claim that your code can do the impossible only later to > add "oh yeah... that's only because the timer I'm using isn't accurate > enough". ;o) Do you really think I would write a post that size and making the points I did and not have it say exactly what I wanted, how I wanted it to? It was a qualification to ensure the point was clear ... ironically to avoid comments like "Bullsh*t, zero exec time". I'll leave you all for a while I think, and pass on anything I have to add to any threads by e-mail. Grims Very Puzzling FunctionJun 3, 2002, 2:39pm
With AWObj being an object (or rather a reference to an object), the method
itself is a function call. Worst of all though is the impact of referencing objects in VB. All references to an object cause a temporary copy of the entire object to be made on the stack, the method is then called and finally the copy is discarded. This takes time and is done for EVERY reference. This is why the With statement exists, where VB will create one copy on the object and reference it throughout the block. For example, the following two snippets of code do the same thing functionally, but under the covers they work very differenly as you will see from the comments. Version #1 var1 = AWObj.X 'Copy to stack, execute X method, discard stack copy var2 = AWObj.X 'Copy to stack, execute X method, discard stack copy var3 = AWObj.X 'Copy to stack, execute X method, discard stack copy var4 = AWObj.X 'Copy to stack, execute X method, discard stack copy Version #2 With AWObj 'Copy to stack var1 = .X 'Execute X method var2 = .X 'Execute X method var3 = .X 'Execute X method var4 = .X 'Execute X method End With 'Discard stack copy Therefore using something like objX = AWObj.X and then using objX for the conditions would benefit the performance considerably, since objX is a direct reference to the stack. As for the XCounter and ZCounter loops, datedman's point is very valid. Unless these values alter the environment somehow, either by being referenced in the loop or controlling a counter or something similar, all that is happening is that exactly the same values are being referenced. In this particular code, the loop is just a loop, nothing else. If the subject of the loop does nothing, then the loop is redundant. All the conditions will evaluate to the same result in every pass of the loop since all the values that ARE referenced (AWObj.X, TempX, CellX, AWObj.Z, TempZ and CellZ) never change. Grims. [View Quote] Very Puzzling FunctionJun 5, 2002, 2:15am
Very Puzzling FunctionJun 5, 2002, 9:51am
How so???? Apologies to Brant for keep referring to the code he posted, but
.... "One thing I can suggest is that you use > instead of >= since I don't know if VB figures that out for itself and I suspect it does not." ** This may be true ... I read this as using ((x < y) or (x = y)) in place of (x <= y). I don't know, but datedman certainly wasn't suggesting changing the code so it didn't fit the logic. If this did perform better, the optimizer in the native code compiler would almost certainly pick it up. "Another thing I see happening is that you're comparing to awobj.x several times and it's possible that VB will be faster if you assign this to a variable." ** Correct ... BIGTIME "Also, you could put more parentheses in some expressions to make things more clear to VB for instance in" ** Again, whether adding parentheses is something that will improve performance I don't know, but it would make sense if it did, by explicity defining the expression and the order in which they are to be evaulated. Probably only a small scale and in native code, the order would be described by the optimizer. It may well help the performance of P-Code compiles though. "You also have several places where you're subtracting tempx from awobj.x, assign to a variable." ** Correct - obviously inefficient "either I am missing something drastic or "Xcounter" and "Zcounter" are never used within the loops." ** Correct - they're not "why thehell would you set up step loops using xcounter and zcounter and then never reference them within the loops?" ** Correct - perfectly valid point that meant a mass of pointless code execution as it was posted How "right" do you need him to be before you stop judging? These aren't opinions ... they're mostly facts, and not exactly obscure ones at that. The vast majority of programming isn't about syntax and therefore its not about language knowledge. You don't have to start totally clueless when you learn a new language because the basic contructs and methods are the same. Datedman doesn't need VB experience to make suggestions, in fact some of what he suggested actually has a much bigger impact in VB than he may have realised when he posted. KAH's reply was cocky, bordering on condescending and rude (in my opinion). Some of what he said was wrong and other parts were just opinions of his own. I think he deserved a slap, and he got (a gentle) one. Now stop looking for a fight and add something helpful. Grimble [View Quote] Very Puzzling FunctionJun 5, 2002, 3:19pm
No KAH, you're missing the point mate. Its not abotu which method to use to
do that loop, its the effect of the loop of the execution. If nothing changes between between each pass of the loop, then the loop is redundant. Consider the following loop, which is a simplified equivalent to what is in the posted code: y = 1 matched = False For x = 1 To 100 If y = 20 Then matched = True Exit For End If Next x This loop (whether implemented as a For ... Next or a Do ... Loop) will ALWAYS, without fail, execute 100 times and "matched" will ALWAYS end up as False because in each pass of the loop, y = 1. The only thing that is changing between each pass is the value of x which is not referenced within the loop. The same is true of the original code, where the only values that change in the loop are XCounter and ZCounter which are not referenced so every condition within the loop will evaluate to the same as it does in every other pass. To be more specific, the value of (AWObj.X >= CellX), (AWObj.X <= CellX), (AWObj.Z >= CellZ) and (AWObj.Z <= CellZ) do not change. If theconditions fail on the first pass, they will fail on every pass. If you still don't get it, then I guess you never will. [View Quote] yab (yet another bot)May 26, 2002, 10:54am
yab (yet another bot)May 26, 2002, 11:12am
Then you suffer the consequences. A bot had better be pretty exceptional and
different to warrant 16MB download and, more importantly the installation of that shuff. [View Quote] yab (yet another bot)May 31, 2002, 7:49am
I had to reset my OE cache to get chop at this (which had to be done)
because I couldn't decipher who said what in strike's post. I don't have any comments on your bot, its the rant ... c'mon!! Nothing nasty ... just information. If you (chazrad) don't read this then fine, but you're getting stuff wrong and people are reading it. Not on really. > Or are you that incompetent to think that VB is an entity by itself and > that the compiled exe contains all code necessary to run it? Steady on tiger! Just for the record, unless you've only seen a Standard Edition of VB, there is are two main compilation options. P-Code is the old pre-VB5 method where the "compiler" optimises the code at the highest level and then converts that into a pseudo instruction set which is then interpretted at run-time by the supplied libraries. These days, in the Pro and Enterprise Editions, there is Native compilation for all code-based functions including memory access and maths functions. The run-time libraries are still required for app startup/shutdown, form and control handling and a number of the language functions. However, the vast majority of the code is compiled into the executable as machine instructions and the run-time calls are just execution branch/returns. > > Or that that the VB distributables contain all the code to run your app? Not quite sure what the focus of "distributable" is here. Naturally, being a M$ product, VB is based on the MFC libraries, which are distributed as part of an installation package. VB is a development platform for Windows ... so it clearly needs windows. What is missing? > > Or that VB doesn't incur an enormous overhead because of it's lack of > typing? > > Imagine the code necessary to check every time in a loop if the variable > you give it is a char, word, double word and so on. KAH's already stated this but VB is heavily typed ... just as much as any language. The only difference is that the default data type for a variable or a function return value if its not explicitly specified is the evil VARIANT, which can hold most types of VB data (not user defined types though I think) and it naturally carries with it a data type indicator. For programmers that are either lazy or haven't had the experience from other languages where typing is mandatory and developed the good habits required for programming any language effectively, there will be a lot of variants from non-declared variables and yes you'll get overheads. When you code appropriately, there is none. This is always the one of the first things VB-bashers throw up ... no data typing ... and its wrong. VB is a very typed language with one "catch-all" exception. At the end of the day, its up to the programmer to understand the tool and its pitfalls. You can force declaration of all variables with one simple setting, so there is not excuse for not declaring all variables and as a specific type. > > To have switch cases with open arrays instead of fixed words, try to > write a parser that will arrange that for you maybe then you will > realize the enormous price you pay for the userfriendlyness of basic. There are equivalents in VB to managing char arrays (assuming that's what you mean ... I struggled a bit) in C. No they're not as efficient, requiring a function call to the run-time libraries (which will no doubt implement exactly what you would do in C), but the code doesn't get any more complicated and any cost in terms of performance really isn't as big as you seem to believe. VB has switch equivalents, that are compiled to jump tables, just like in C and any other language that supports them. > > I love basic, for it's ease of use, it let's me write a quick and dirty > prototype of my idea. But to write a full blown enduser safe app in it? > Not on my life. As easy as it lets me prototype it lets me f**k up an > app in ways no debugger gets unrevelled in a 100 manhours. See the paragraph on typing ... any further expression of my views on your comments on this paragraph would almost certainly be construed as a flame and that's not the point. > > For sure C++ is a pain the ass if you want to write something quickly, > but for designing and maintaining serious software nothing beats it yet. I don't think anyone has ever refuted that, but then I may have got bored part way down a thread. BUT VB is used for both tactical and (to a much lesser extent) strategic enterprise systems throughout the industry. Lefts face it, for the most part bots are toys and there's no need to keep hacking on VB when most people here just want to make bots. > > Furthermore don't forget most os's are written in C or C++ combined with > assembly for a reason. This is as irrelevant as the "AW isn't written in VB" remark before. Visual Basic is described, by its manufacturers, as a development system for Windows. > > If you want to slag someone do it well, or at least wait till you have > seen the product, which i offer to you for a special price ;) Totally agree! <cheeky grin> > > Enough, i've said my piece. I could really go on about this for hours > because as most of the flamers i've seen sofar my knowledge is based on > experience and not of selective reading of books. Its a shame you take that view. You're not the only experienced programmer here and some people are in a better position to judge certain technologies than yourself. You don't know most of the people here and their background. Its the irrational insistence on slating VB that gets a rise out of people in the first place. > > Be happy with whatsoever, and anyday you want ot derise C I definitely must've missed a post somewhere. Grims. stuffMay 26, 2002, 7:24am
This is a multi-part message in MIME format.
------=_NextPart_000_0046_01C2049D.14690A40 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Shock horror!! SelColor is documented in the VB Help Files and MSDN!!! SelColor Method: http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/rtfbox= 98/html/vbproselcolor.asp Color Constants: http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/vbenlr= 98/html/vamsccolorconstants.asp RGB Function: http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/vbenlr= 98/html/vafctrgb.asp Rich Text Box: http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/rtfbox= 98/html/vbobjrichedit.asp (Bother to) Seek and ye shall find. [View Quote] ------=_NextPart_000_0046_01C2049D.14690A40 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 5.50.4807.2300" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY> <DIV><FONT face=3DArial size=3D2>Shock horror!! SelColor is documented = in the VB=20 Help Files and MSDN!!!</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>SelColor Method:</FONT></DIV> <DIV><A=20 href=3D"http://msdn.microsoft.com/library/default.asp?url=3D/library/en-u= s/rtfbox98/html/vbproselcolor.asp"><FONT=20 face=3DArial=20 size=3D2>http://msdn.microsoft.com/library/default.asp?url=3D/library/en-= us/rtfbox98/html/vbproselcolor.asp</FONT></A></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Color Constants:</FONT></DIV> <DIV><FONT face=3DArial size=3D2><A=20 href=3D"http://msdn.microsoft.com/library/default.asp?url=3D/library/en-u= s/vbenlr98/html/vamsccolorconstants.asp">http://msdn.microsoft.com/librar= y/default.asp?url=3D/library/en-us/vbenlr98/html/vamsccolorconstants.asp<= /A></FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>RGB Function:</FONT></DIV> <DIV><FONT face=3DArial size=3D2><A=20 href=3D"http://msdn.microsoft.com/library/default.asp?url=3D/library/en-u= s/vbenlr98/html/vafctrgb.asp">http://msdn.microsoft.com/library/default.a= sp?url=3D/library/en-us/vbenlr98/html/vafctrgb.asp</A></FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Rich Text Box:</FONT></DIV> <DIV><FONT face=3DArial size=3D2><A=20 href=3D"http://msdn.microsoft.com/library/default.asp?url=3D/library/en-u= s/rtfbox98/html/vbobjrichedit.asp">http://msdn.microsoft.com/library/defa= ult.asp?url=3D/library/en-us/rtfbox98/html/vbobjrichedit.asp</A></FONT></= DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>(Bother to) Seek and ye shall = find.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>"zeo toxion" <</FONT><A=20 href=3D"mailto:zeo at activeworlds.com"><FONT face=3DArial=20 size=3D2>zeo at activeworlds.com</FONT></A><FONT face=3DArial size=3D2>> = wrote in=20 message </FONT><A href=3D"news:3cf0176a at server1.Activeworlds.com"><FONT = face=3DArial=20 size=3D2>news:3cf0176a at server1.Activeworlds.com</FONT></A><FONT = face=3DArial=20 size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>> Its not = working. It just=20 displays blank lines and if colorval is a text then<BR>> i guess = "black"=20 should work. It does error and highlight .SelColor =3D<BR>> colorval=20 though.<BR></FONT></BODY></HTML> ------=_NextPart_000_0046_01C2049D.14690A40-- stuffMay 27, 2002, 10:34am
For your AwEventAvatarChange proc.
Dim radianYaw As Single With awSDK radianYaw = ((.AwAvatarYaw / 10) - 180) * 3.1415927 / 180 ' Divide Yaw by 10 to get degrees ' subtract 180 from result because you want the point behind the avatar ' multiply by PI/180 to get radians .AwMyX = .AwAvatarX + (200 * Sin(radianYaw)) .AwMyY = .AwAvatarY .AwMyZ = .AwAvatarZ + (200 * Cos(radianYaw)) .AwMyYaw = .AwAvatarYaw .AwStateChange End With [View Quote] stuffMay 28, 2002, 12:15am
Sorry Zeo, should have said. The distance is the 200 in the X and Z
expressions (in the same units as the rest of the world). Its the equivalent of the radius of the circle in Brant's reply to the "Making a bot move in a circle" post a few threads ago. (news:3ce8eb97$1 at server1.Activeworlds.com). Grims [View Quote] aw_user_dataJun 5, 2002, 8:08am
I'm getting the complete opposite when I enter a world in Global Mode. The
avatars that are already in the world are not reported when the bot starts, unlike when aw_state_change is issued. When a new avatar DOES enter the world, that is when events are received for all the avatars. Bizarre. Grims [View Quote] |