Thread

VB-SDK: Getting an Object Number / Co-ords (Sdk)

VB-SDK: Getting an Object Number / Co-ords // Sdk

1  |  

flammable goat

Feb 1, 2002, 4:10pm
Hey there all, in the hope of expanding my knowledge, could anyone tell me
how (code if possible) to find an object based on its action (e.g. find an
object within range of the bot that has 'create name object1' on it) then
aquire it's co-ords? I can then use this information to Select, Change and
Delete Objects. :o)

Thanks in advance to anyone who can help :)

bowen

Feb 1, 2002, 4:18pm
This your new citname robbie? Just trying to keep things straight ;)

--Bowen--

[View Quote]

andras

Feb 1, 2002, 4:55pm
[View Quote] I/m not a VB expert but I know that when you are querying the area around the bot, you'll get all info embedded in the object. I.e.: the model name, the action and the description field together with the object coordinates and the object number which is unique within the cell. Of course you have to keep track of the objects within your memory.

HTH,
Andras

kah

Feb 1, 2002, 9:57pm
after trying some methods I found this method, that works very well:
create a custom type for objects, example:
Private Type AwObject
Model As String
Number As Long
Action As String
Owner As Long
End Type
this example only contains a few properties, I recommend putting all of
them, since not re-specifying all properties of an object in a world where
you have ED can result in objects changing owner, position, model, action,
description etc. At least this has happened to me many times. Declare it as
an array ( Dim Obj(50000) As AwObject ), an array scope of 0 - 50000 should
be largely enough I'd say, then declare a long that will contain the last
array index ( Dim ObjIndex As Long ) so we put the objects at the right
place. then on _EventCellObject increment the array index and set the
values, like this:
ObjIndex = ObjIndex + 1
Obj(ObjIndex).Model = sdk.AwObjectModel
Obj(ObjIndex).Number = sdk.AwObjectNumber 'and so on...

and when the query is done search through your array like this (declare a
long called i in the declarations first):
For i = 0 to ObjIndex
If Obj(i).Action Like "*name object1*" Then
NumberOfObjectOne = Obj(i).Number
End If
Next i

I hope this helps :-))

KAH

[View Quote]

flammable goat

Feb 2, 2002, 9:09am
this and Nerath are temp citizenships, as you may know Radon stole my
account Robbie (315021)...I'll be back soon...just passing the time with a
bit of programming :o)

[View Quote]

jackbnimble

Jun 17, 2002, 1:11am
I've had some experience with this. First of all, you need an awobject
class module. Put in the basic values like action. Next, create a
collection named AwObjects. In the objectadd and cellobject events, fit
in the following code:

Dim NewObject As New AwObject
Set NewObject = New AwObject

NewObject.Model = sdk.awobjectmodel
....
....
AwObjects.Add NewObject, CStr(sdk.awobjectnumber)

For Delete:
AwObjects.Remove sdk.awobjectnumber

Hope that helps!




[View Quote] > after trying some methods I found this method, that works very well:
> create a custom type for objects, example:
> Private Type AwObject
> Model As String
> Number As Long
> Action As String
> Owner As Long
> End Type
> this example only contains a few properties, I recommend putting all of
> them, since not re-specifying all properties of an object in a world where
> you have ED can result in objects changing owner, position, model, action,
> description etc. At least this has happened to me many times. Declare it as
> an array ( Dim Obj(50000) As AwObject ), an array scope of 0 - 50000 should
> be largely enough I'd say, then declare a long that will contain the last
> array index ( Dim ObjIndex As Long ) so we put the objects at the right
> place. then on _EventCellObject increment the array index and set the
> values, like this:
> ObjIndex = ObjIndex + 1
> Obj(ObjIndex).Model = sdk.AwObjectModel
> Obj(ObjIndex).Number = sdk.AwObjectNumber 'and so on...
>
> and when the query is done search through your array like this (declare a
> long called i in the declarations first):
> For i = 0 to ObjIndex
> If Obj(i).Action Like "*name object1*" Then
> NumberOfObjectOne = Obj(i).Number
> End If
> Next i
>
> I hope this helps :-))
>
> KAH
>
[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