Thread

more than 1 query? (Sdk)

more than 1 query? // Sdk

1  |  

tomilius

Jul 15, 2002, 12:17am
I'll bet this is really really obvious, but in the new VB Com DLL, how do
you have more than 1 query? I think its because query doesn't announce
objects that it's announced before, but how do I make it do so?

tomilius

Jul 15, 2002, 2:20am
aha! I've found one way at least....

Dim i1 As Integer, i2 As Integer
For i1 = 0 To 2
For i2 = 0 To 2
aw1.aw_sequence_set AW_SEQUENCE_3X3, i1, i2, 0
Next i2
Next i1
For i1 = 0 To 4
For i2 = 0 To 4
aw1.aw_sequence_set AW_SEQUENCE_5X5, i1, i2, 0
Next i2
Next i1

put that before it queries :) or after maybe.. whatever either will do :D
[View Quote]

baron

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]

tomilius

Jul 15, 2002, 7:32am
thanks cos my way was really buggy and barely worked anyway, hope this does

[View Quote]

tomilius

Jul 15, 2002, 7:39am
hmm - it seems that with either way i have to call the function to query two
times before it works (besides the first time).. so maybe ill just make it
clear the sequences at beginning and end

[View Quote]

tomilius

Jul 15, 2002, 7:45am
wow - that doesn't help either! i guess there must be something wrong with
my code!

[View Quote]

baron

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]

tomilius

Jul 15, 2002, 4:18pm
thanks baron - that's what ive been using :( i don't get it! i have it clear
the sequences but sometimes i have to tell the bot to query like twice.. and
i found out that its not my code :(
[View Quote]

tomilius

Jul 15, 2002, 4:26pm
here's my code:

'On Error Resume Next
Dim i As Integer, j As Integer
If Querying = True Then DoMessage theCurUser, "Please wait until the
current query is over or use CANCEL QUERY.", theCurWhisper: Exit Sub
DoCancel = False
Querying = True
'frmQuery.Show
Set qurUser = theCurUser
qurWhisper = theCurWhisper
cell_z = aw1.aw_int(AW_MY_Z) / 1000 'or whatever
cell_x = aw1.aw_int(AW_MY_X) / 1000 'or whatever
' Set the sector to query
sect_z = aw1.aw_sector_from_cell(cell_z)
sect_x = aw1.aw_sector_from_cell(cell_x)
DoMessage theCurUser, "Starting query...", theCurWhisper
' Perform the query
If FiveXFive = False Then
For i = 0 To 2
For j = 0 To 2
aw1.aw_seq_3x3(i, j) = 0
aw1.aw_seq_3x3(i, j) = 0
aw1.aw_seq_3x3(i, j) = 0
Next j
Next i
aw1.aw_query sect_x, sect_z
Else
For i = 0 To 4
For j = 0 To 4
aw1.aw_seq_5x5(i, j) = 0
aw1.aw_seq_5x5(i, j) = 0
aw1.aw_seq_5x5(i, j) = 0
Next j
Next i
aw1.aw_query_5x5 sect_x, sect_z
End If
'While aw1.aw_bool(AW_QUERY_COMPLETE) = False
' If FiveXFive = False Then
' aw1.aw_query sect_x, sect_z
' Else
' aw1.aw_query_5x5 sect_x, sect_z
' End If
'Wend

timTestFinished = True

I have everything just like Baron's code in the other places, don't know
whats wrong

[View Quote]

tomilius

Jul 15, 2002, 4:31pm
oh yeah and real quick... you'll notice i set the things to 0 three times,
but it didnt help
[View Quote]

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn