Thread

Help maybe? (Bots)

Help maybe? // Bots

1  |  

lanezeri

Feb 20, 2001, 1:36am
Does anyone think they could teach me how to work the Survey thing in VB? I
looked at Grimm's site.. aint getting a thing..

--
- = [ T e c h n o ] = -
http://wt.s5.com
- = [ S t u f f - X ] = -
http://www.stuffx.com/aw

hal9000

Feb 20, 2001, 2:49am
its almost exactly the same way it is in C++.. and theres an example here...
http://www.activeworlds.com/sdk/sample2.htm
and there's detailed information on it here...
http://www.activeworlds.com/sdk/property.htm

needless to say, this is the most complicated part of the AW SDK...
good luck ;-)


--
-=Hal9000=- world:Discover
--==~~out~~==--
--== http://hal9000.xoasis.com

[View Quote]

lanezeri

Feb 20, 2001, 3:18am
Hey.. thanx!.. I looked at the example on Grimmiez site.. and then that
one.. and I think I can do it now.. but does the bot have to move to survey
a diff part of the world? It wont work for me..

--
- = [ T e c h n o ] = -
http://wt.s5.com
- = [ S t u f f - X ] = -
http://www.stuffx.com/aw

xelag

Feb 20, 2001, 6:18am
No, the bot can be anywhere to survey, it does not even need to be visible,
but it needs to be in the world.

[View Quote]

andras

Feb 20, 2001, 6:48am
The bot doesn't have to be at the survey location. You have to set the survey coordinates for the query in sector address. The example uses the sector "0,0" - GZ.
You want to invoke it with:
aw_query(aw_sector_from_cell(cell_x),aw_sector_from_cell(cell_z),sequence) where the cell_x,cell_z is the center coordinate the area you want to survey.
To receive object click/delete/add events the bot has to announce it's position (be visible) and will receive all clicks/delete/add within the 200m hearing radius.

(Those are C notations - I don't know the VB equivalents)
Andras


[View Quote]

xelag

Feb 20, 2001, 11:59am
The biggest problem, which is not well shown in the AW examples, is how to
query outside GZ. If you follow the AW example, you get stuck in GZ.

I'll give my example in Delphi Pascal, read it as pseudo code. Supposing you
start querying at coords CentralSectorNS, CentralSectorWE (I use NS and WE
instead of z and x, I find them more convenient to use). These coordinates
are in sector units, use aw_sector_from_cell(...) to get them from the cell
coordinates of your starting point.

Suppose that in the event CellBegin you get cNS, cWE (in cell units). You
need to do a sanity check:
// chnage to sector units
sNS := aw_sector_from_cell(cNS);
sWE := aw_sector_from_cell(cWE);
// the next two lines are the clue: you subtract the original sector
coordinates from the one you get in CellBegin.
sapNS := sNS - CentralSectorNS;
sapWE := sWE - CentralSectorWE;
// and you set your boolean CellOverflow
CellOverflow := (sapNS < -1) or (sapNS > 1) or (sapWE < -1) or (sapWE >
1);
then, if CellOverflow = False, everything is ok and you can proceed further.

Just one more remark: we work here actually with 3 different systems of
units, but they are all interrelated. The units used for positions of
objects and avatars are in centimetres (negative values for east and south).
To pass to cell units, which are in integer decametres, one divides by 1000
and converts the result to integer. Delphi does not have an adecuate
function, but Basic does: Int, or in some Basic dialects, Trunc. The
important thing is that the rounding off is done 'downwards' and not towards
zero. For positive numbers, there is no difference: down is always towards
zero. For negative numbers, towards zero changes -3.2 to -3, downwards
changes it to -4 (and this is what you need). So test your function first
(I think it is Int in VB, but I might be wrong). To pass from cell units to
sector units, use the function provided by AW: aw_sector_from_cell.

Example of a normal coord in cm:
NS := 54321
WE := -9276
these represent actually 54.321N 9.276E

The cell coordinates of these are
cNS := 54
cWE := -10

XelaG

[View Quote]

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