13.6 SURFACES

(a) Overview

Surfaces are places that products can be set to go to when they are rezzed and also when you put them down. For instance, most food items that you cook will look for the SF Table, soap will look for the SF Soap dish and so on. The target surface for a product is defined in the products config notecard, eg:

TARGET=SF Table

You can find more information on customising products in section 13.3

So in this example, when the product is rezzed it will search for the closest SF Table and send a request to it for a landing spot. If there isn’t any available spots or if there isn’t an SF Table within range (approximately 20m) then the product will just settle where it is rezzed.

Surface objects consist of one or more prims names as follows:

Root prim – This will be set to the name from the NAME= line in the config notecard e.g. SF Table. If none of the other prims below are used, the root prim should be set to be the ‘surface’ prim by setting ROOT_SURFACE=1 in the config notecard. If you use the additional EMPTY prims below, you can choose if you wish the root prim to also be a surface.

EMPTY – These are optional prims that are used as extra surfaces for products to land on. The more you have, the more landing spots are available for products. These prims are simply a single prim without any scripts or content. The surface script automatically changes their name from EMPTY to FULL and back again to match with if a product is resting on it or not.

RESERVED – This optional prim is reserved for items that contain the addon-seek_reserved.lsl script (such as the SF Baby). It allows you to keep one prim available for a particular object. As an example, the SF High Chair is a surface object that the baby food will seek out, but the reserved prim allows the baby to always land sitting. This prim is simply a single prim without any scripts or content. The surface script automatically changes the name from RESERVED to R-FULL and back again to match with if something is resting on it or not.

Decor – This optional prim is normally hidden and then shown whenever one or more products are on the surface. An example is the table cloth on the SF Table

(b) How it works

When a product is rezzed, if it has a TARGET= entry in its config file, it searches for the closest object with that name and if it finds one it sends it a message asking if it can land there. If the object is running the surface script it will reply with either the landing location information (the coordinates and rotation of the next available empty prim) if a space is available, or else a message that it is full.

Next, when the product is touched it will move away from the object and send it another message to saying it has left that space. That way the surface object keeps a track of which prims are currently in use or vacant.

Note that sometimes objects may be removed but not notify the surface (such as if you directly deleted the product without first touching it) and so the owner of the surface object has a Reset option shown on the menu which clears all surfaces to the empty state.

When there are no products on the surface, the décor prim is set to transparent. It is shown again when the first product lands.

When a product requests a landing point, the surface script scans through all the prims in the object until it finds the first one named EMPTY (or if set to use the root prim it picks that first) and then send the location and rotation of the prim to the product.

(c) Configuration options

# Name of object
NAME=SF Table
#
# Is the root object a surface, 1=yes  0=no
ROOT_SURFACE=0
#
# Set to 0 if this is a stand-alone item (vase etc) or 1 if part of another item that handles touch events
EMBEDDED=0
#
# Does item have to be made  for it to work 0=no, 1=yes
MANUFACTURED=0
#
# (Optional) How many days until item wears out
#EXPIRES=60
#
# (Optional)  Set table cloth colour as vector, eg. <0.0, 0,5, 0,1>   or use word random for random colours
CLOTHCOLOR=random
#
# Default language (if EMBEDDED=1, otherwise ignored)
LANG=en-GB


NAME – This is the full name of the surface object e.g. SF Table

ROOT_SURFACE – Set to 1 to have the root prim be counted as one of the available surfaces. Set to 0 to only use the prims named EMPTY

EMBEDDED – If set to 1 the surface script will not respond to touch events. This is used when there is another script in the object handling touch events, e.g. you could use the surface script on the SF Bed to have a surface where the SF Duvet will land but touching the bed calls up the main script for interacting with the bed (sleep etc)

MANUFACTURED – If this is set to 1 the object will only work if it has been made (with the machine script) rather than being taken out of inventory or/and copied. As an example you can set the SF Vase so it has to be made with the pottery parts of the system before you can use it to put flowers in.

EXPIRES – You can set how long a surface object will last before expiring (wearing out!) Note that this value can be set for both manufactured and non-manufactured items.

CLOTHCOLOR – This will set the colour of the Decor prim to the specified colour vector (such as <1.0, 0.3, 1.0>) or you if you use the word random it will be a different colour every time the prim is shown.

 


Creative Commons License
This work by Buzzy Cnayl is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Based on a work at https://satyrfarm.github.io/

VivoSim Grid - Stats

7d uptime badge   24h uptime badge   1h uptime badge

GridStatus: ONLINE


Online_Now: 7

Visitors_Last_30_Days: 412

Total_Regions: 15

Login_URL: hg.vivosim.net:8002

Website: https://vivosim.net

XML format
JSON format


VivoSim Shop

donate

hg.vivosim.net:8002:Mintor

hg.vivosim.net:8002:Lugo

hg.vivosim.net:8002:Sandy Island

hg.vivosim.net:8002:Julian Beach

opensim logo