OSSL Proposals

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(OSSL Proposal Table)
(OSSL Proposal Table)
Line 41: Line 41:
 
             return result;
 
             return result;
 
         }
 
         }
| list keys=osGetRegionAgentKeys(); integer i; integer l=llGetListLength(keys); string names; for(i=0;i<l;i++) { key id=llList2Key(keys,i); string add=llKey2Name(id); integer dist=llVecDist(llGetPos(),llList2Vector(llGetObjectDetails(id,[OBJECT_POS]),0)); add+="["+(string)dist+"]\n"; names+=add; } llSetText(names,<1,1,1>,1.0);
+
| list keys=osGetRegionAgentKeys(); integer i; integer l=llGetListLength(keys); string names; for(i=0;i<l;i++) { key id=llList2Key(keys,i); string add=llKey2Name(id); integer dist=llVecDist(llGetPos(),llList2Vector(llGetObjectDetails(id,[OBJECT_POS]),0))); add+="["+(string)dist+"]\n"; names+=add; } llSetText(names,<1,1,1>,1.0);
 
| Joshua Driver
 
| Joshua Driver
 
|- style="background-color:#CCFFCC;font-size:8pt;border-bottom:1px solid;" valign="top"
 
|- style="background-color:#CCFFCC;font-size:8pt;border-bottom:1px solid;" valign="top"

Revision as of 13:28, 27 March 2010

Technical Reference -> Terms -> OSSL Status -> OSSL Proposal List


What is OSSL?

Introduction

This is a page dedicated to OpenSim's very own home brew custom scripting language Known as "Open Sim Scripting Language"

Please see OSSL Standards for proposed naming schema


  • Please post your osFunction along with a brief description of what it would be for, or do and an example of it.
  • Make sure it begins with os NOT ll.
  • And remember, almost anything within reason can be posted here as an idea, who knows, maybe a variation of your request can be possible.
  • If a function could implemented in standard LSL, there is no reason to make an OS function. LSL code and function code executes at the same speed in OpenSim.

OSSL Proposal Table

osFunction Description Example Usage Signed
list osGetRegionAgentKeys(); C# Code:
       public LSL_List osGetRegionAgentKeys()
       {
           CheckThreatLevel(ThreatLevel.None, "osGetRegionAgentKeys");
           LSL_List result = new LSL_List();
           foreach (ScenePresence avatar in World.GetAvatars())
           {
               result.Add(avatar.UUID);
           }
           return result;
       }
list keys=osGetRegionAgentKeys(); integer i; integer l=llGetListLength(keys); string names; for(i=0;i<l;i++) { key id=llList2Key(keys,i); string add=llKey2Name(id); integer dist=llVecDist(llGetPos(),llList2Vector(llGetObjectDetails(id,[OBJECT_POS]),0))); add+="["+(string)dist+"]\n"; names+=add; } llSetText(names,<1,1,1>,1.0); Joshua Driver
string osBin(string char); To convert a char into its binary value. Will only convert 1 char at a time. string bin_a = osBin("A"); // bin_a = "01000001"; Athlon Maurer (please send me a notecard into secondlife, if that are too much ideas xD, this hint can be deleted by an opensimulator admin, if neccesary xD)
string osHex(integer number); To convert a number into its hexadecimal value. string str_ff = osHex(255); // str_ff = "FF"; Athlon Maurer
integer osAsc(string char); To convert a char into its ascii index. Will only convert 1 char at a time. integer asc_a = osAsc("A"); // asc_a = 65; Athlon Maurer
void osScanRegionRemove(); Remove an osScanRegionRepeat(). [ nearly the same as llSensorRemove() ] osScanRegionRemove(); Athlon Maurer
void osScanRegion(string name, key id, integer type); Scan the whole region where the script task object is in regardless where it is positioned. Triggers sensor() or no_sensor(). osScanRegion("", "", AGENT); Athlon Maurer
void osScanRegionRepeat(string name, key id, integer type, float rate); Scan the whole region where the script task object is in regardless where it is positioned with rate. Triggers sensor() or no_sensor(). osScanRegionRepeat("", "", AGENT, 15.0); Athlon Maurer
key osGetRegionMapTexture(string RegionName) return the map texture uuid for the region named by RegionName. llSetTexture(osGetRegionMapTexture("OpenSim Test"), ALL_SIDES);

<math> create a php file which is public <?php

// mapquery.php by Athlon Maurer (SL, OL, OS) // // hello, ive just started to learn php/mysql and this is one of my first // scripts for opensim. this script returns the texture uuid for a given // region by calling: mapquery.php?region=REGIONNAME // if a region has been found, it returns that regions map texture uuid, // otherwise it returns a null key uuid // mysql connection info is here, please make this more safe

// region name (do not change this) $region = htmlspecialchars($_GET['region']);

// default uuid (do not change this) $uuid = '00000000-0000-0000-0000-000000000000';

// your mysql host name (change this) $dbhost = 'localhost';

// your mysql user name (change this) $dbuser = 'root';

// your mysql user password (change this) $dbpass = ;

// your mysql opensim database (change this) $dbname = 'opensim';

// try to connect if ($conn = mysql_connect($dbhost, $dbuser, $dbpass)) { // try to select if ($select = mysql_select_db($dbname, $conn)) { $sql = 'SELECT regionName, regionMapTexture FROM regions'; $result = mysql_query($sql); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { if ($row['regionName'] == $region) { $uuid = $row['regionMapTexture']; } } // free result mysql_free_result($result); } // close connection mysql_close($conn); } // output echo $uuid;

?> then llHTTPRequest("http://www.yourserver.com/phpfile.php?region=" + llEscapeURL("OpenSim Test"), [HTTP_METHOD, "GET"], ""); the http_response event will return the uuid for the map texture in body, which can be used with llSetTexture() or other functions </math>

Athlon Maurer (This function is available as of November 12, 2009)
list osGetLinkPrimitiveParams(integer link, list params); Function llSetLinkPrimitiveParams() does exist, but no chance to get params from a prim in a linkset, like llGetPrimitiveParams() and llSetPrimitiveParams(). list linkparams = osGetLinkPrimitiveParams([PRIM_TYPE, PRIM_TEXTURE, ...]); Athlon Maurer (This function is available as of August 09, 2009)
void osDerezObject(key object) Deletes an InWorld-Object specified by object as uuid. Only successful if the object the script is attached to and the object which should be derezzed is owned by the same owner :). Useful if the object to be deleted should be unscripted. osDerezObject("key_of_object"); Athlon Maurer
int osRestartRegion() Restarts the region the script is currently in. The script this is run in has to be owned by the master avatar for that region. Returns 1 if the region is restarting, 0 on failure. osRestartRegion(); gryc (Implemented by AFrisby)
int osWebTexture() Sets the texture from a web-url osWebTexture(string url,integer maptype); AFrisby?
osGroupAdd(key, string Role) Adds user to a group with given role, default role Everyone. Returns 1 if successful 0 if fail. osGroupAdd(87f6e6a0-d884-11dc-95ff-0800200c9a66, "Officer") Nitrus Nori
int osShutdownRegion() Shuts down the region the script is currently in. The script this is run in has to be owned by the master avatar for that region. Returns 1 if the region is going down, 0 on failure. osShutdownRegion(); gryc
void osAttachmentSay(integer channel, string msg) Provide a secure, low lag method of communicating between attachments over the chat channels by only sending messages to objects attached to the same avatar. Would fail (or not be heard) if in a non-attached object. osAttachmentSay(-20, "detatch"); Del M
void osMessageSecure(string message_key, string str, integer num, key id);
secure_message(string message_key, string str, integer num, key id);
Provide a method of sending secure, salt encripted messages sim wide. Messages would only be able to be received by scripts with the matching key in the secure_message method. osMessageSecure("myPassPhrase", "Hello World", 0, NULL_KEY); Del M
void osSetText( vector color, string text [,vector color, string text]); Allow setting of multiple colors on the prim text osSetText(<1,0,0>,"Red", <0,1,0>, "\nGreen", <0,0,1>, "\nBlue"); Del M
osSensor Gets ALL the objects in the specified range not just the first 16 (same as standard) Sal
list lst=osDetectObjectsInSim(key id) given an Agent Key, provide a list of ALL object owned by that agent osDetectObjectsInSim(key id) returning a strided list of [ name, <pos> ] Sal
integer=osDialog([ title, label1, type1, len1, label2, type2, len2].... given title and a listing of fields, builds up a real form where to put structured checked data will return a [ value1, value2, valuen ] corresponding to fields read. Type might be something like (string, text (multiline), integer, float, currency(decimals), options(combobox) Sal
key id=osMakeTextureText(string name,integer width, integer height,[posx1,posy1,font1,color1,size1,text1,posx2,posy2,font2,color2,size2,text2....]) allow for producing a texture on the fly with desired Font content from a selected font selection. Width, Height in pixels 1024x512 to control how big will be the texture will generate a texture with defined text. (Allow some support for at least ISO-8859-1) texture will be created in the object inventory. posx, posy in the range 0-1 to be pixel independent Sal
osMakeNotecard(string name, [ line1, line2, line3, ...]) allow creation of new notecards in current object repository generate a new asset id useful for storing modified configuration Sal
integer handler=osReadNotecardKey(string notecard, string key) allows reading notecards (through dataserver) in format key=value in convenient and efficient way ... Sal
osWriteNotecardKey(string notecard, string key,string value) allows WRITING notecards in format key=value in convenient and efficient way. Might be optimized having a fixed record length "file" so to avoid rewriting of the entire notecard ... Sal
integer handle=osXMLParser(string xml) will activate a listener xmlparser(integer handler,string parent, string field, string value) to easily parse xml without writing php external code Sal
integer osReturnObjects(key owner, integer type); Provide a scriptable method of returning objects from a sim. type would be OBJECT_SCRIPTED, OBJECT_PASSIVE or OBJECT_ALL. Would return a binary Success/Fail, and work inline with land permissions for the script owner. osReturnObjects( target, OBJECT_ALL); Del M
integer osReturnItem(key item); Provide a scriptable method of returning individual objects from a sim. Would return a binary Success/Fail, and work inline with land permissions for the script owner. osReturnItem(uuid); Del M
osSetTimerEvent(integer timer, float rate);
(event) timer(integer timer_num)
Support for multiple timers in a script. osSetTimerEvent(2, 0.5); Del M
osTimerOnce(integer timer, float rate); Allow for a one shot timer event, rather than the normal repeating heartbeat type osTimerOnce(2, 10); Del M
integer osVerifyScripts(); Check to see if all scripts in an object are created by the owner of the script calling the function. Return TRUE if they are, FALSE otherwise, to prevent insertion of alien scripts into an object if (!osVerifyScripts()) { llDie(); } Del M
void osStopOtherAnimations(list animation_exceptions); Provide a method of stopping all animations on an avatar, except those defined in the list osStopOtherAnimations(["my_sitting_anim"]); Del M
void osPutScriptInLinkedSet(string name,integer linknum, integer starting_parm, integer running) Use this to propagate one script to ALL or part of linked set. Useful to have all objects in a linked set sharing a common behaviour Sal
osRezObject(string name, string description, integer permissionmask, list setPrimitiveObjectLikeList) will trigger the object_rez object as usual similar to llRezObject, but without the need of having a prim inside the inventory (which produced a lot of problems in deploying and in sl). Newly created object will have the same owner of current object where script is running. In case list is empty or position not specified, suitable defaults should apply like pos being 1 m higher in the z axis Sal
string osGetOwnerName(); Provide a method of getting the owner name without having to use llKey2Name myName = osGetOwnerName(); Del M
integer osXMPPOpen(string server, string username, string password, string resource); Open an XMPP session to a jabber or other XMPP server, returning a handle to be able to manipulate the connection. Incoming messages to be parsed through a xmpp_message(integer handle, string sender, string service, string message) event. Accounts would have to be set up manually by the scripter, or by some other method, to prevent scripted spamming of a server, and to allow users to set up gateways and other services if needed. handle = osXMPPOpen("jabber.org", "MyObject", "MyPassword", "OpenSim"); Del M
list osXMPPGetRosta(integer handle); Get the rosta from the XMPP server, list in the strided form of [username, presence, resource]; list presence = osXMPPGetRosta(handle); Del M
list osXMPPGetServices(integer handle); Get a list of available services from the XMPP Server. list services = osXMPPGetServices(handle); Del M
integer osXMPPAdd(string username, string service) Add a username to the account rosta. Return boolean success or fail if (osXMPPAdd("Test User", "Yahoo")) { ... } Del M
integer oxXMPPDelete(string username) Remove a username from the account rosta. Return boolean success or fail if (osXMPPDelete("Test User")) { ... } Del M
integer osXMPPGetStatus(string username); Poll the server for the status of a specific username on the rosta - returns would be OFFLINE, BUSY, AWAY and ONLINE if (osXMPPGetStatus("Test User") & ONLINE) { ... } Del M
integer osXMPPSendMessage(integer handle, string message, string target); Send a message via the open XMPP channel, to the specified target. Return boolean success values if (osXMPPSendMessage(handle, "Hello World", osGetOwnerName()) { llOwnerSay("Successfully sent message"); Del M
void osXMPPClose(integer handle); Close the XMPP session osXMPPClose(); Del M
void osRezObjectKey(key object,vector pos,vector vel,rotation rot, int param); Basically llGodLikeRezObject[1] with the features of llRezObject[2] but for everyone to use. Calls object_rez. osRezObjectKey(object_key,llGetPos(),ZERO_VECTOR,llGetRot(),0); Tdub
osRezFromURL(string url, vector pos, vector vel, rotation rot, integer param) - calls on_rez Fetch a fragment of xml from a web server and rez its contents in-world as in 'load-xml'. Off or intergrid object repositories, such as objects stored in SVN via websvn, CMS, etc. osRezFromURL("http://my.objectstore.com/myawesomeprims.xml", <1, 1, 1>, <0, 0, 0>, <0, 0, 0>, 0) Jimbo2120
list osRunCustom(string function, list params) Allow scripts to call external custom routines that are grid-specific without modifying the set of LSL and OSL functions. list results = osRunCustom("function1", [...]) Ezekiel
osSetScriptServer() Create a 'Server' prim that allows for extended scripting capabilities: more memory, higher bandwidth when communicating with external servers, probably some database connectivity, no artificial delays, can receive IMs, etc. Could be limited to one server per prim / parcel or per avatar, could be forced to remain in a fixed position. A server is important for residents that want to set up a virtual business. osSetScriptServer() Ezekiel
integer osRemoteLoadScript(string url, string target) Load a source file in txt format from "URL" and compile it into script "target" in the inventory of the same prim. Requires permission of the object owner (RequestPermission). Returns boolean success value. Replaces an existing script with same name. This function would allow updates to scripted solutions that operate in any grid and sim worldwide, allowing the creator of the solution to distribute code fixes and implement new functions. Since the source code is distributed openly, it can be copied and modified by anyone. A function that would allow for secure code distribution, protecting copyrights and certificates, would also be very interesting but should be far more difficult to implement. integer updatestatus = osRemoteLoadScript("http://www.xyz.com/updates/script1013.txt", "betterscript" ) Ezekiel
integer osSetCustomPrimitiveAttributes(list params) Set some custom persistent primitive attributes, the same way as llSetPrimitiveParams do. The attribute name has to be specified as a string, then the attribute type using a lSL constant. In the example, we set a "magnet" custom attribute as -0.5, supposing a customized physic engine handles this attribute to provide prim attraction. integer osSetCustomPrimitiveAttributes(["magnet", TYPE_FLOAT, -0.5]) Grumly
list osGetCustomPrimitiveAttributes(list paramNames) Return a list values of the specified attributes names, the same way as llGetPrimitiveParams do. list osGetCustomPrimitiveAttributes(["Magnetic"]) Grumly


integer osSyncUUID(key oldUUID, key newUUID); Allows to change the UUID of an avatar or item(requires permission from owner). Suppose a terminal in the LL-grid wants to communicate with an OS-Grid terminal. It can only send messages, if the UUID's of avatars match. An OS-Grid script can get the avatar's LL-UUID by calling the dataserver script. Then it calls osSyncUUID(llDetectedKey(0), keyFromHTTPRequest); . Now the two keys are equal, and avatar-avatar communication between grids can take place! Phrearch


integer osTeleport(string RegionName, int x, int y, int z); Teleports an avatar to a custom region

as : osTeleportAgent(key agentId, string regionName, vector position, vector lookAt);

(this is implemented now - edited April 2009 by Wordfromthe Wise) Phrearch
osSetStatus(integer status, integer value); Improved verion of the LSL function llSetStatus. The function works basically the same way as llSetStatus, except that an extra flag is added named STATUS_PHYSICS_ROOT. When this flag is TRUE, physics would be enabled Only for the root prim in a linked set, while the other prims in the set would behave as phantom. This would be useful for bypassing the 32-prim physics limit for vehicles by using only the root prim as a collision mesh. Pesho
vector osGetBonePos(); When called from an Attachment, retrieves the position of the bone it is attached to, in Region Coordinates. When llGetPos() is called from an attachment, the vector returned is the one of the avatar center, whereas llGetLocalPos() returns the local offset from the bone it is attached to. It would be useful to know where the attachment's location really is in world space. Pesho
string osGetOSLLRelease(); When called return the actual release of OSSL running on the sim. if osGetOSSLRelease() > 1.1 {llSay(0,"good");} Sacha Magne
List osGetServerLib(); When called return a list of all the additional libraries loaded on the server. it will avoid any scripts using a specific library to crash in case of missing libs. List lib=osGetServerLib(); Sacha Magne
osSetAttachmentPoint(integer attachment); When called from an Attachment sets the default attachment point to attachment value. osSetAttachmentPoint(ATTACH_HUD_BOTTOM_RIGHT); Peter
string osMySQLQuery(string query); Used to get informations out of a sql database. Works together with osMySQLConnect(), osMySQLSelectDatabase() and osMySQLClose(). osMySQLQuery("Select name FROM user LIMIT 0,1;"); Peter
string osGetGridName(); When called it return the hostname of the grid server. Useful to find out what grid you are on. string gridHostname = osGetGridHostname(); Patnad
key osName2Key(string avatarname); When called it return the key associated with a Avatar Name. key avKey = osName2Key("avatar name"); Patnad
vector osParcelCenterpoint(vector pos); When called it return the vector that represent the center point of the current parcel. Same height as the object running the script but centerpoint for x,y. vector parcel_center = osParcelCenterpoint(llGetPos()); Patnad
integer osSetMapDestination(integer mode, string simname, vector position, vector lookat); Sets a new "beacon" (red pole) without opening the worldmap: mode is for 1 (simname is a standard region name) or 0 (simname is a SLURL). If the code can handle standard sim names and SLURL(s) at the same time, the "mode" flag can be left behind. integer error = osSetMapDestination(TRUE, "cyberlandia", <128.0, 128.0, 0.0>, ZERO_VECTOR);

 If error is FALSE then no errors have occurred setting up the new beacon.  Errors can arise using unknown simnames/SLURL(s), out of ranges vector coords and so on (nearly the same as llSetMapDestination).

Elwe Ewing
osTeleportAgentPerm(key agentId, string regionName, vector position, vector lookAt);

osTeleportAgentPerm(key agentId, vector position, vector lookAt);

Works similarly as the two implemented osTeleportAgent but requires (at least the first time) the PERMISSION_TELEPORT flag set (via llRequestPermissions(key id, PERMISSION_TELEPORT); which should be implemented) and can be used by everyone (or restricted to a member of the group wich the region is deed, maybe with a new "Restrict teleports" Estate flag).
// requests permission to Teleport then do it

key  avie = NULL_KEY;

default
{
   state_entry()
   {
       llSay(0, "Touch to be teleported");
   }

   run_time_permissions(integer vBitPermissions)
   {
       if(PERMISSION_TELEPORT & vBitPermissions){
           osTeleportAgentPerm(avie, <128.0,128.0,0.0>,
ZERO_VECTOR);
       } else {
           llSay(0, "You deny teleport permission");
       }
   }

   touch_start(integer num_detected)
   {
       avie = llDetectedKey(0);

       llRequestPermissions(avie,
           PERMISSION_TELEPORT |
           PERMISSION_TRIGGER_ANIMATION |
           0);
       integer perm = llGetPermissions();
   }
}
Elwe Ewing
osGetSimulatorStatus(string Simulator) Extended / Enhanced version of llGetSimulatorData.

Purpose: When an avatar is Teleported with osTeleportAgent, there is no check to see if a given simulator is available. If it's down, Agent is Teleported to NULL resulting in Agent being fragged and viewer broken, requiring a relog. This would be especially useful for HyperGrid Teleporting. Command: osGetSimulatorStatus(string Simulator) Where Simulator = "RegionName", "IPAddress:PortNum", "HostName:PortNum" Returns: integer "0 = DOWN", "1 = UP", "2 = UNKNOWN" Security: Would require some form of Throttle to prevent recurring requests of destination Simulator.

WhiteStar Magic
osTeleportOwner(string regionName, vector position, vector lookAt); Works similarly as osTeleportAgent but could only teleport the owner of the script itself. Would be very useful for HUD and would not require any authorization. integer error=osTeleportOwner("Snoopies",<100,25,25>,ZERO_VECTOR); Agnes Chalet


string osName2Key(string name); A command which gives the UUID of an agent. Would work in the same way as llKey2Name, but in reverse. (Linden Lab may implement this first) osName2Key("Bob Smith"); Drava
integer osHyperGrid(); Detects whether or not the region the person is in is Hypergrid enabled. Could be expanded to any region in the current grid. osHyperGrid() == TRUE Drava



See Also

Personal tools
General
About This Wiki