====== Objects ====== The objects module allows in world objects to connect in to GPHUD and interact with characters and so forth. See also [[Configuring an NPC guard]] for a more complex NPC example. ====Getting the "Objects Driver" script==== You require a copy of the Object Driver script, which can be retrieved by saying ''**Objects.GetDriver'' near a region server, or ''/1Objects.GetDriver'' if you have a HUD worn. You must have the permission ''Objects.GetDriver'' to make this call. ====Connecting to GPHUD==== Firstly you must have permission ''Objects.Connect'' to connect an object to GPHUD. If this is revoked at any point your objects will start to fall out of service the next time they attempt to communicate with the server (which happens at least once every 15 minutes). You place the Object Driver script inside the object you want interactable and let it boot. If all goes well you'll get a status dump about the objects, with no behaviour defined, e.g.:[18:26:50] Object: Registered object#41 Name: Object Owner: Iain Maltz[#1] Character: null Version: 30900 Behaviour: No behaviour is mapped ====Creating the object type==== In the web site, under Configuration, Objects, you should see your newly connected object. Below this you can "Create a new object type", this is what defines the object's functionality, e.g. you can select "ClickTeleport" to create an object that teleports a player when clicked. Much deeper functionalities are available! ====Configure the object==== On the main Configuration, Objects page you can now click the drop down list under your object's "Object Type" and set the type do your newly created Object Type, this should take effect immediately. If you are setting an object to be an NPC, or changing its character, it is advisable to reboot the object, manually in world, or via the web panel, otherwise it may take up to 15 minutes for some changes such as HUD text to take effect. It is also possible to have the object automatically configure using the Description on the object, setting this to a JSON structure will pass data to the object driver on the back end server, currently only objecttype is processed which may be set like this: {"objecttype":"Buff Wizard"} Note that NPC object types can not be used in more than one object at once as the secondary login of the character will replace the first and cause it to be shut down. All other types are multi-instantiable. ====Object Driver GSScripting==== Some object types invoke a script, these have different variables prepopulated. * **CALLER** - The owning charcter for the script ; for non NPC types this is the interacting player, for NPC types this is the NPC character. * **CALLERUUID** - For /non-NPC/ types (RunScript/PhantomScript) this contains the Second Life UUID of the agent.. For NPC types this is unset. * **TARGET** - For NPC object types, this is the player that invoked the interaction (while CALLER remains the NPC character). This is unset for non NPC types. * **TARGETUUID** - For NPC object types this is the Second Life UUID of the agent. This is unset for non NPC types. * **OBJECTNAME** - The name of the primitive in Second Life that is connected to this run - if you change the name of the prim you should reset the Object Driver script, or wait 15 minutes for it to register the new details. * **OBJECTTYPE** - The name of the object type invoked * **OBJECTKEY** - The UUID of the primitive connected to this invocation