How To: Reference an existing Virtual Worlds object

Conceptually there are 4 object types in most programming systems:

Content Objects:
    Contains property, method and event interfaces. 
    (Thing, World, Room, StateMachine, Portal, Artifact)

Datum Objects: 
   
These are kept as properties in Content and used as transients in Documents. 
    (Vector, Sound, Boundary, ObjReference, BSTRNames, Color,  MenuItem, StoryName, Settings)

Collection Objects:
    Selections, One Dimensional Arrays, Lists of Content and Datum Objects
    (PropertyMap, PropertyList,
Module, Menu)

Document Objects:
   
These are defined transient models the have at the root in one particular meaning.
    (Method, Event, MenuItem,
SearchResults, Story, Script ) 

This chotomy represents how the programmer uses the objects and not interface members. All of these objects have basic methods and properties for our convenience but those may mean very little to the object's intended purpose.  You see the vagueness between Datum and Document objects since a Vector for instance can be looked at like a 'Document about placement containing x,y,z, rotation' or as 'Datum to be used for placement'  The line between the two is this: A Document is a proprietary collection of Datum objects. When the document is destroyed the world state stays in tact.  A document is like a transient package that is intended to do one thing.  On the other hand, if Datum is destroyed then it can deface the Content object that held it as a property.  (Later we'll go into more detail on this theory)

So in Prolog terms we access Content objects like this:

thing(?Class,?Type,?ReferenceOrName,?MembersListBindings).
avatar(?Class,?Type,?ReferenceOrName,?MembersListBindings).
room(?Class,?Type,?ReferenceOrName,?MembersListBindings).
artifact(?Class,?Type,?ReferenceOrName,?MembersListBindings).
statemachine(?Class,?Type,?ReferenceOrName,?MembersListBindings).

Example:

An object created with:
Set NewThing = World.CreateInstance("Toy", "Artifact", User.Container)

could be referenced by
thing(artifact,

 

The functor being the class type:


 

 ModelKinds
Enum
Visual Basic/ActiveX Virtual Worlds Prolog [X,*]ML
Property INVOKE_PROPPUT / INVOKE_PROPGET  Thing.Properties property(PropertyName,Owner,Type,Value)  
Method INVOKE_FUNC Thing.Methods (without on*) method(MemberName,Owner,RetrunType,[parameterlist])  
Event INVOKE_EVENTFUNC ( major changes to notifacation system since some sites do not care for unsolicted messaging ) Thing.Methods
 (with on*)
event(MemberName,Owner,[parameterlist])  
Content INVOKE_PROPPUTREF/INVOKE_PROPGETREF  Thing.Contents object(?Class,?Type,?ReferenceOrName,?MembersList),
datum(?Type,?Value)
 
Parameter INVOKE_CONST ( Not partucualry Correct)  Thing.Name datum(?Type,?Value)  


Content Objects

Virtual World Objects

are of these types:

Thing
PropertyList
PropertyMap
....

From where the objects live and are brokered

Type Conversion

1)  Virtual Worlds Object Collection vwsystem.dll/vwmm.dll
2)  (soon ) Native COM Collection wrapped in Morphism.Dll
3)  Serialized Prolog Terms Representing Transient or InTransit objects
4) A markup language (Barely Implemeted)

 
   SITNAME_WINCOM SITENAME_VWSERVER/SITENAME_VWCLIENT SITENAME_PROLOG_CLIENT/SITENAME_PROLOG_SERVER SITENAME_XML
NodeKinds Enum Visual Basic/ActiveX Virtual Worlds Prolog [X,*]ML
Object True Object (Set) Thing object(?Class,?Type,?ReferenceOrName,?MembersList) XMLNodeElement
Collection For Eachable Collection of Variants  PropertyMap, Menu lists that only contain: objects and values
Sets
XMLDOM or
XMLElement
Value String,Long,Byte,Integer,Long,Byte,
VT_BSTR,VT_UI4, (etc)
String,Long,Byte,Integer,Long,Byte,
Single,Double
atom, string, quoted terms XMLNodeElement
Array Array of Variants or a single UDT PropertyList or Variant().. or a object that you/we have predefined a property list of named arguments such as:  Sound, Module, Method, Vector, etc  ?funct(Arg1,Arg2,..)
or Ordered Lists ./2
 
FuncDesc MemberName orAddressOf 
 + DISPARAMS (VTABLE Entry)
Method, MenuItem :-/2 , -->,2 ,/2 ;/2 or Canonical Terms 
or Static Predicates
XSLDocument

 

How to Access The Objects (The DOM )

 Objects Non-determently

objects(?Class,?Type,?IDRef,?MemberList)

example: 
findall(X,objects(avatar,thing,_Ref,[name=X|_]),ListOfNames).

objects(?Object).  %  Is the collection of all known objects

example: 
findall(X,objects(object(class([avatar]),type([thing]),_Ref,[name=X|_])),ListOfAvatarNames).

member_unify(-Object,?NewMembers).

member_assert(-Object,-NewMembers).

member_retract(-Object,?Members).

member_retractall(-Object,?Members).

 

Walking an Object's Model

find_member(?Object,?MemberName,?Value)

walk_member(?StartObject,?MembersWalk,?Value)

example:

   walk_member(objptr(345345),[error,description],datum(vt_bstr,Text)).
   walk_member(_,[error,description],datum(vt_bstr,Text)).
   walk_member(_,[_,description],datum(vt_bstr,Text)).
   walk_member(_,[_,error,_],datum(vt_bstr,Text)).
   walk_member(objptr(345345),[_,_,_],datum(vt_bstr,Text)).

   walk_member(_,[error],Err),walk_member(Err,[description],datum(vt_bstr,Text)).

 

PrologVirtualWorlds Partial Serialization of COM 
(Component Object Models)

We will look at some object models and see how they manifest in various places in our system.  First an object such as a newly created MSScriptControl.ScriptControl as PrologVirtualWorlds sees it:

Morphism.Dll    obj_pl(java_vbscript_engine,4,true) /* 4 levels deep,  Ground_Instancing=True */

The SWI-Prolog kernel had no problems working with an object in this form.  This is a ‘term serialization’ of the object’s model.  The MSScriptControl has ten Members marked as INVOKE_PROPGETable in COM.   I am of strong discipline that the future of properly written windows COM must expose it’s members (in TypeLibs) in such a way as an object model can be rendered with no side effects to the object (when using INVOKE_PROPGET/GETREF).  And members where this is unsafe need to hide behind INVOKE_FUNCT interfaces.   
We will use the rendered serialized model to classify objects and for PrologVirtualWorlds to understand them later.  This model was constructed 4 levels deep and anything 5 or below was set to Prologs ‘_’ this is so we can Unify objects later. 

Look at this call for a non-instanced version (the objptr/1 and datum/2 which are ignored and only vt_variant and vt_empty are explored)

 Morphism.Dll    obj_pl(java_vbscript_engine,4,fail) /* 4 levels deep,  Ground_Instancing=False */

This information can be later used to declare a new object. The smallest object declaration looks like this:

assert_object (object(class([our,new,class]),type([we,ll,know,later]),_,[])).

This creates a TypeLib info in for  we_ll_know_later that has no interface members.

To add a member to it we use:

               
objects (AnyObject),AnyObject = object(class(_),type([we|_]),_,_).

Back to Start Page