Board ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
baron // User Search
baron // User SearchAwCreateJan 27, 2002, 8:55pm
It didn't take more than one minute, hardly my definition of "wasted time". In fact it was a poor attempt of programming humor, much
like yours I guess :) [View Quote] [VB] Next Problem, lol: Combo BoxesFeb 16, 2002, 9:58pm
Function RemoveCit(AwSession As Long)
For i = 0 To PresIdx - 1 If cbPresent.ItemData(i) = AwSession Then cbPresent.RemoveItem (i) Exit For End If Next i End Function Itemdata can only store a *long*, never a string. It is a bad idea to remove items based on the name, always remove using the session# which is available during AW_EVENT_AVATAR_DELETE, if a bot leaves the area all with the same name will be removed. Also note that cbPresent.ItemData(PresIdx) is out of bounds since the array is zero based, hence the PresIdx-1. -Baron [View Quote] Avatar Click EventsFeb 18, 2002, 8:17pm
http://www.activeworlds.com/sdk/AW_EVENT_AVATAR_CLICK.htm, check the properties that are set during the event. Remember to register it with aw_event_set and don't let all that C stuff scare you, it's easy to read through it and get it in VB :)
-Baron [View Quote] AW_UNIVERSE_TIME?????Apr 25, 2002, 6:16pm
AW Facing DirectionApr 26, 2002, 6:12pm
Not sure if I got this right but you can get the direction the browser is facing by loging in an instance within 200m from the avatar and get AW_AVATAR_YAW within AW_EVENT_AVATAR_CHANGE. Title bar is not and was never meant to be precise but you can get the title with a call to EnumWindows and then checking the return value of GetClassNameA (both in user32.dll) for each window handle looking for a string containing "Active Worlds -" in the callback function...kinda clumsy but works. Remember that if the user does not use the default message file you'll be in serious trouble if you search for hardcoded strings like "E", "W" or "Facing".
-Baron [View Quote] Deleteing INI Entries/SectionsMay 19, 2002, 6:01am
These should do the trick:
Public Sub DeleteKey (ByVal SectionName As String, ByVal KeyName As String) WritePrivateProfileString SectionName, KeyName, vbNullString, strINIFileName End Sub Public Sub DeleteSection (ByVal SectionName As String) WritePrivateProfileString SectionName, vbNullString , "dummy", strINIFileName End Sub [View Quote] Active Worlds Utility 1.00Feb 12, 2001, 8:08pm
I had similar problems before installing VS6 SP4 ( http://msdn.microsoft.com/vstudio/sp/vs6sp4/ ). Packages created in Win9x machines would not install on WinNT/Win2K and vice versa. Especially WinNT packages could mess a Win9x machine pretty badly. After this I haven't experienced any incompatibilities. Have you got SP4 installed? I suppose you use package and deployment wizard to create the packages, right? A visit to http://windowsupdate.microsoft.com/ for updates on your OS is a must too.
Baron [View Quote] [View Quote] World List in VBFeb 18, 2001, 7:59am
Just call sdk.AwWorldList and use sdk_EventWorldInfo to add the worlds to the listbox. For example:
Private Sub cmdWorldList_Click() If sdk.AwWorldList Then MsgBox "Unable to query world list" End If End Sub Private Sub sdk_EventWorldInfo() Select Case sdk.AwWorldListStatus Case AW_WORLDSTATUS_PUBLIC List1.AddItem "Public : " & sdk.AwWorldListUsers & " " & sdk.AwWorldListName Case AW_WORLDSTATUS_PRIVATE List1.AddItem "Private: " & sdk.AwWorldListUsers & " " & sdk.AwWorldListName Case Else List1.AddItem "Unknown: " & sdk.AwWorldListUsers & " " & sdk.AwWorldListName End Select End Sub [View Quote] VB: Converting Unix Times to get VRT.Jun 23, 2002, 5:49pm
AwSDK 5x5 Query WorriesJul 8, 2002, 7:29pm
OK since there is no documentation and it's not expected anytime soon it makes sense to share; not sure if everything is working as expected since I just figured these out and tested them only a couple of times, sure seems like everything is in place. Set the FiveXFive flag to determine if you are going for 3x3 or 5x5 query, call QueryNow to get rolling. Please let me know if something is wrong before I update all my projects :)
=============================================== Option Explicit Dim FiveXFive as Boolean Dim sect_x As Long Dim sect_z As Long Dim cell_x As Long Dim cell_z As Long ---------------------------------------------------- Public Sub QueryNow() cell_z = 0 'or whatever cell_x = 0 'or whatever ' Set the sector to query sect_z = sdk.aw_sector_from_cell(cell_z) sect_x = sdk.aw_sector_from_cell(cell_x) ' Perform the query If FiveXFive = False Then sdk.aw_query sect_x, sect_z Else sdk.aw_query_5x5 sect_x, sect_z End If End Sub ---------------------------------------------------- Private Sub sdk_CallbackQuery(ByVal rc As Long) ' Continue the query until it is complete If Not sdk.aw_bool(AW_QUERY_COMPLETE) Then If FiveXFive = False Then sdk.aw_query sect_x, sect_z Else sdk.aw_query_5x5 sect_x, sect_z End If Exit Sub End If 'Do stuff here End Sub ---------------------------------------------------- Private Sub sdk_EventCellBegin() Dim X As Long Dim Z As Long If FiveXFive = False Then ' Get the current cell cell_x = sdk.aw_int(AW_CELL_X) cell_z = sdk.aw_int(AW_CELL_Z) ' Calculate the sector the cell is in X = sdk.aw_sector_from_cell(cell_x) - sect_x Z = sdk.aw_sector_from_cell(cell_z) - sect_z ' ' Sanity Check, X and Z may be either -1, 0, or 1 If (X < -1 Or X > 1 Or Z < -1 Or Z > 1) Then Exit Sub End If ' Update the Sequence variable for the current sector 'You can use this syntax too sdk.aw_seq_3x3(z + 1, x + 1) = sdk.aw_int(AW_CELL_SEQUENCE) sdk.aw_sequence_set AW_SEQUENCE_3X3, (Z + 1), (X + 1), sdk.aw_int(AW_CELL_SEQUENCE) Else ' Get the current cell cell_x = sdk.aw_int(AW_CELL_X) cell_z = sdk.aw_int(AW_CELL_Z) ' Calculate the sector the cell is in X = sdk.aw_sector_from_cell(cell_x) - sect_x Z = sdk.aw_sector_from_cell(cell_z) - sect_z ' ' Sanity Check, X and Z may be either -2, -1, 0, 1, 2 If (X < -2 Or X > 2 Or Z < -2 Or Z > 2) Then Exit Sub End If ' Update the Sequence variable for the current sector 'You can use this syntax too sdk.aw_seq_5x5(z + 2, x + 2) = sdk.aw_int(AW_CELL_SEQUENCE) sdk.aw_sequence_set AW_SEQUENCE_5X5, (Z + 2), (X + 2), sdk.aw_int(AW_CELL_SEQUENCE) End If End Sub ---------------------------------------------------- Private Sub sdk_EventCellObject() 'Handle Objects here End Sub ---------------------------------------------------- -Baron [View Quote] VB COM aw_createJul 7, 2002, 6:10pm
Calling sdk.aw_create(0, 0) returns 429, it needs an explicit call with hostname and port to sdk.aw_create("auth.activeworlds.com", 5670) to connect. Am I missing something here?
-Baron more than 1 query?Jul 15, 2002, 7:12am
Actually it's the only way, as mentioned at http://www.activeworlds.com/sdk/aw_query.htm "sequence is a 3x3 array of sector sequence numbers. These sequence numbers come from previous calls to aw_query and indicate the last time your application queried property in this zone. A zero sequence number indicates that you have no previous property for that sector. To get a complete property update for the entire zone, set all nine sequence numbers to zero".
While using the ocx a call to Erase Sequence did the trick since Sequence was an array declared in your program but now you have to manualy set all sector sequence numbers to zero. The array has to be erased before the first EventCellBegin fires off, makes sense to me to erase it before you call aw_query, looks tidier too. As an alternative you can do something like : For i = 0 To 2 For j = 0 To 2 aw1.aw_seq_3x3( i, j)=0 Next j Next i -Baron [View Quote] more than 1 query?Jul 15, 2002, 8:38am
Probably, works like a charm here :) You might want to check a working query example I posted last week (news://news.activeworlds.com/3d2a043a$1 at server1.Activeworlds.com), see if that helps...combine it with the sequence erase from this thread and you are set. Make sure you set all required events and callbacks before calling aw_query btw.
-Baron [View Quote] AW_CreateAug 24, 2002, 1:14pm
Try setting the events like this:
.aw_event_set (AW_EVENT_CHAT) .aw_event_set (AW_EVENT_AVATAR_ADD) .aw_event_set (AW_EVENT_AVATAR_DELETE) .aw_event_set (AW_EVENT_AVATAR_CHANGE) Always use Option Explicit, compiler would have caught these if you did. Btw are you sure it receives AW_EVENT_AVATAR_ADD? If it does you have set the events elsewhere in your code too. You already tried to set them twice in this procedure, setting events just once for an instance is sufficient :) -Baron [View Quote] > .aw_event_set EventAvatarAdd > .aw_event_set EventAvatarChange > .aw_event_set EventAvatarDelete > .aw_event_set EventChat > .aw_event_set EventAvatarAdd > .aw_event_set EventAvatarChange > .aw_event_set EventAvatarDelete > .aw_event_set EventChat > .aw_event_set EventWorldInfo > > Is what im using.. But it still does not recieve any events appart from avatar add > > AW_CreateAug 24, 2002, 9:32pm
Option Explicit being optional is one of the reasons for a lot of sloppy VB code in general and the bad reputation the language has, not referring to this example or you personally. VB is very tolerant, a lot more than it should be so it's up to the developer to make it more strict in order to maintain his sanity. Fortunately this has changed a lot with VB.NET, those who think their compiler (and computer) actually speaks English are in for a big surprise. Anyway to make sure you don't forget it in the future you can make Option Explicit the default behavior in your projects by checking Tools/Options/Editor/Require Variable Declaration. That is the first thing I do in every new VS6 installation :)
-Baron [View Quote] Damned LiveUpdate / Callback Query CrashesSep 21, 2002, 4:53am
Looks like your program never enters live update due to an old VB story and how it converts int to boolean.
tmp=sdk.aw_bool(AW_QUERY_COMPLETE) "If (Not tmp)" is evaluated as true until tmp = -1; the dll returns tmp=0 for sdk.aw_bool(AW_QUERY_COMPLETE) =False and tmp=1 for sdk.aw_bool(AW_QUERY_COMPLETE) =True. So what happens is you call aw_query with your timer's interval even though the sequence is updated...the seq you send matches so no data is sent. As soon as sequence changes due to an object change you have a valid new query. If you use "If sdk.aw_bool(AW_QUERY_COMPLETE)=False" all should be fine, your program stops calling aw_query, enters live update and starts receiving AW_EVENT_OBJECT_*. -Baron [View Quote] AW_EVENT_WORLD_DISCONNECTOct 13, 2002, 5:58am
You have to check AW_DISCONNECT_REASON in the content of AW_EVENT_WORLD_DISCONNECT to see why you were disconnected and take action from there. RC could be 466, 467, 469, 471. If it's 471 all you have to do is wait, it's like the browser's WFS, SDK will attempt to reconnect. http://www.activeworlds.com/sdk/AW_EVENT_WORLD_DISCONNECT.htm
-Baron [View Quote] [VB] RichTextBoxTabNov 10, 2002, 8:37pm
With RichTextBox
.SelTabCount = 1 ' or more if you need them .SelTabs(1) = 500 ' set width for each tab from left edge .SelHangingIndent = 500 ' this will do the trick, text will wrap at this indent after vbTab End With http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rtfbox98/html/vbproselhangingindent.asp [View Quote] Legacy issuesNov 12, 2002, 4:27am
[View Quote]
VB.NET is an entirely different language, about the only thing that remained the same is the name. There is a built-in VB6 project import wizard available that works great for "not-so-advanced" VB6 code but the changes in syntax and general approach are so massive that I often found it easier to rewrite small projects from scratch instead of porting them. IMO moving to VB.NET is not worth it unless you work for a company that requires it or if its demand raises in the job market; if you have to learn a new language and want to work with the CLR you might want to try C#.
> > 3. Does anyone have any idea where I can find a decent free tutorial on designing graphical user interfaces (with the Windows API) using Visual C++ (preferably .NET, if 6 and .NET differ significantly)? I couldn't find one that's easy to understand in the MSDN. I have a great deal of knowledge of and have written quite a few programs in C++, but have never used it to design Windows forms. If I can figure out how to use C++ to work with Windows, then I can use AW's SDK directly and not have to rely on third-party products in the future. > I found the resources on http://gotdotnet.com/ very helpful on C++, C#, VB.NET. Anyway crash courses still work, get .NET, get a couple tons of books, mess with it, google it, solve problems as they appear :) -Baron target=aw_3dNov 17, 2002, 10:47am
Anyone knows if/how you can restore the 3d window after sending a URL with target=aw_3d without having the user "clicking on the large X button "?
================ From http://activeworlds.com/help/url_command.html: New in 3.3: you can now specify the special target keyword aw_3d with the url command. This causes the triggered web page to replace the 3D window instead of being sent to a separate web window. For example: activate url www.activeworlds.com target=aw_3d Once the 3D window has been replaced with a web page, it can be restored by clicking on the large X button in the upper right corner of the new web page. -Baron target=aw_3dNov 17, 2002, 2:54pm
[View Quote]
A worthy idea, thanks a lot. Btw it doesn't have to ask the user, something like the following snaps it clean in default IE configs:)
<script language=javascript> var closew = window.self; closew.opener = window.self; closew.close(); </script> -Baron target=aw_3dNov 17, 2002, 6:06pm
Seems to work fine with any external browser and any target frame. I'm no JS wiz but I believe all this does is fool the browser to believe the window was opened with javascript, so it is allowed to close with javascript without the confirmation message 'window.close()' would normally trigger.
-Baron [View Quote] Problems with updatingNov 18, 2002, 4:05am
The "refresh" is done by periodically calling aw_wait, usually through a timer; a couple times a second should be sufficient in most cases. http://www.activeworlds.com/sdk/aw_wait.htm
-Baron [View Quote] Problems with updatingNov 20, 2002, 4:07am
If the avatar leaves the world and comes back the event you are looking for is not AW_EVENT_AVATAR_CHANGE, it's AW_EVENT_AVATAR_ADD and you need to check the AW_AVATAR_TYPE attribute in its content; check http://www.activeworlds.com/sdk/AW_EVENT_AVATAR_ADD.htm. My guess is you maintain some sort of session table which you don't update during the above events and AW_EVENT_AVATAR_DELETE
-Baron [View Quote] Problems with updatingNov 21, 2002, 7:45pm
Um nope, you don't need a session table for the task in hand, it was just a remote guess. A little more information on the language you use and maybe some (pseudo)code would be helpful since I'm out of ideas now. For example if it's VB and if you don't use Option Explicit, AW_AVATAR_ADD is not a syntax error but it's a dang logic error, the correct is AW_EVENT_AVATAR_ADD. Anyway I can't think of anything else as it is, sorry :)
-Baron [View Quote] Problems with updatingNov 22, 2002, 9:30pm
I don't get it, it seems to work fine for me; entered, changed avatar, bounced, changed avatar, bounced, changed avatar, all events received and handled. Just add 'printf ("avatar_change: %s %d\n", aw_string(AW_AVATAR_NAME),aw_int(AW_AVATAR_SESSION));' or something of the kind in your handle_avatar_change and you'll see you receive all events fine. One note, http://www.activeworlds.com/sdk/aw_avatar_set.htm needs world server build 44 but in any case it is called in the content of both ADD and CHANGE event handlers; must be gremlins.
-Baron [View Quote] SDK COM Wrapper Multiple instances ...Nov 19, 2002, 8:42pm
At least I don't see a difference, ported all my multiple instance ocx projects to the com with almost no modifications.
-Baron P.S (OT). If anyone from AWI reads this, Start/run/cmd and type net time/? on the news server, or check out http://www.microsoft.com/WINDOWS2000/techinfo/howitworks/security/wintimeserv.asp ...time flies [View Quote] SDK COM Wrapper Multiple instances ...Nov 21, 2002, 4:22am
Not difficult at all, last time I checked that's a Win2KS box. Anyway SNTP would be equally easy to handle if it was *nix; my point was it's always a good administrative practice to automate things like server time sync, especially on machines that need an accurate timestamp.
-Baron [View Quote] Event Subscriptions ... Where's the filter?Nov 23, 2002, 9:07pm
Same in build 24, events and callbacks can be set and unset on the fly at any time. This most likely means the mask is sent by the SDK 'on mask change' and not just 'on instance connect' which is a subtotal of 'on mask change' anyway.
-Baron [View Quote] AW_AVATAR_CITIZENNov 30, 2002, 6:02am
Yes the documentation appears to be mistaken here, for bots AW_AVATAR_PRIVILEGE contains the login owner's citnum in the content of AW_EVENT_AVATAR_ADD. To me it makes sense that it works like this; a bot is just using privs, it doesn't login with a citizen number.
-Baron [View Quote] |