User:Athlon Maurer

From OpenSimulator

Jump to: navigation, search

OSSL NEW OWN IMPLEMENTED


       Author: Athlon Maurer (SecondLife, OpenLife, OpenSimulator Localhost)
       Date  : 15. June 2010

INSERT INTO: OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs


       # region by Athlon Maurer, 15. June 2010
       //  BEGIN OF OSSL NEW OWN IMPLEMENTED
       LSL_Integer osDerezObject(key objectID);
       LSL_String osHex(LSL_Integer value, LSL_Integer count);
       LSL_String osBin(LSL_Integer value);
       LSL_Integer osAsc(LSL_String value);
       LSL_String osChr(LSL_Integer value);
       key osGetAgentProfileImage(key agentID);
       void osWhisperAsOwner(LSL_Integer channel, LSL_String text);
       void osSayAsOwner(LSL_Integer channel, LSL_String text);
       void osShoutAsOwner(LSL_Integer channel, LSL_String text);
       LSL_List osGetAgentAttachments(key agentID);
       void osMessageAgentAttachment(LSL_Integer apoint, key agentID, LSL_String message);
       LSL_List osGetRegionAvatars();
       LSL_Integer osGetAgentAttachmentPoint(key aID, key agentID);
       key osGetAgentAttachmentKey(LSL_Integer apoint, key agentID);
       LSL_Integer osGetAgentOnlineStatus(key agentID);
       LSL_Integer osRenameObject(key objectID, LSL_String objectNAME);
       LSL_String osReversedText(LSL_String text);
       LSL_String osGetParcelMusicURL();
       LSL_Integer osGetLinkNumberOfSides(LSL_Integer linknum);
       LSL_Integer osRescaleObject(key objectID, vector objectSCALE);
       LSL_String osRgb(vector color);
       //  END OF OSSL NEW OWN IMPLEMENTED
       # endregion

INSERT INTO: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs


       # region by Athlon Maurer, 15. June 2010
       //  BEGIN OF OSSL NEW OWN IMPLEMENTED
       /// <summary>
       /// Delete objectID from World
       /// </summary>
       /// <returns>TRUE if successful, FALSE otherwise</returns>
       public LSL_Integer osDerezObject(LSL_Key objectID)
       {
           CheckThreatLevel(ThreatLevel.Moderate, "osDerezObject");
           m_host.AddScriptLPS(1);
           string s = (string)objectID;
           UUID id = new UUID();
           if (UUID.TryParse(s, out id))
           {
               SceneObjectPart sceneOP = World.GetSceneObjectPart(id);
               if (sceneOP != null)
               {
                   SceneObjectGroup sceneOG = sceneOP.ParentGroup;
                   if (sceneOG != null)
                   {
                       if (sceneOG.OwnerID == m_host.OwnerID)
                       {
                           World.DeleteSceneObject(sceneOG, false);
                           return new LSL_Integer(1);
                       }
                       if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
                       {
                           World.DeleteSceneObject(sceneOG, false);
                           return new LSL_Integer(1);
                       }
                   }
               }
           }
           return new LSL_Integer(0);
       }
       /// <summary>
       /// Convert value into hex with count
       /// </summary>
       /// <returns>String</returns>
       public LSL_String osHex(LSL_Integer value, LSL_Integer count)
       {
           CheckThreatLevel(ThreatLevel.None, "osHex");
           int i = (int)value;
           int d = (int)count;
           if (!(d < 1) && !(d > 8))
           {
               if (d == 1)
               {
                   return new LSL_String(String.Format("{0:X1}", i));
               }
               else if (d == 2)
               {
                   return new LSL_String(String.Format("{0:X2}", i));
               }
               else if (d == 3)
               {
                   return new LSL_String(String.Format("{0:X3}", i));
               }
               else if (d == 4)
               {
                   return new LSL_String(String.Format("{0:X4}", i));
               }
               else if (d == 5)
               {
                   return new LSL_String(String.Format("{0:X5}", i));
               }
               else if (d == 6)
               {
                   return new LSL_String(String.Format("{0:X6}", i));
               }
               else if (d == 7)
               {
                   return new LSL_String(String.Format("{0:X7}", i));
               }
               else if (d == 8)
               {
                   return new LSL_String(String.Format("{0:X8}", i));
               }
           }
           return new LSL_String("");
       }
       /// <summary>
       /// Convert value into bin
       /// </summary>
       /// <returns>String</returns>
       public LSL_String osBin(LSL_Integer value)
       {
           CheckThreatLevel(ThreatLevel.None, "osBin");
           int i = (int)value;
           // quick bounds check
           if (i < 0) i = 0;
           if (i > 255) i = 255;
           // build the returnvalue
           string s = "";
           if (((i & 128) == 128) == true) { s += "1"; } else { s += "0"; }
           if (((i & 64) == 64) == true) { s += "1"; } else { s += "0"; }
           if (((i & 32) == 32) == true) { s += "1"; } else { s += "0"; }
           if (((i & 16) == 16) == true) { s += "1"; } else { s += "0"; }
           if (((i & 8) == 8) == true) { s += "1"; } else { s += "0"; }
           if (((i & 4) == 4) == true) { s += "1"; } else { s += "0"; }
           if (((i & 2) == 2) == true) { s += "1"; } else { s += "0"; }
           if (((i & 1) == 1) == true) { s += "1"; } else { s += "0"; }
           return new LSL_String(s);
       }
       /// <summary>
       /// Asc/Char table for osAsc and osChr
       /// </summary>
       protected static readonly char[] asctable =
       {
           '\0', '☺', '☻', '♥', '♦', '♣', '♠', '•', '◘', '○', '◙', '♂', '♀', '♪', '♫', '☼', 
           '►', '◄', '↕', '‼', '¶', '§', '▬', '↨', '↑', '↓', '→', '←', '∟', '↔', '▲', '▼', 
           ' ', '!', '\"', '#', '$', '%', '&', '\, '(', ')', '*', '+', ',', '-', '.', '/', 
           '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', 
           '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 
           'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', 
           '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 
           'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', '⌂', 
           'Ç', 'ü', 'é', 'â', 'ä', 'à', 'å', 'ç', 'ê', 'ë', 'è', 'ï', 'î', 'ì', 'Ä', 'Å', 
           'É', 'æ', 'Æ', 'ô', 'ö', 'ò', 'û', 'ù', 'ÿ', 'Ö', 'Ü', 'ø', '£', 'Ø', '×', 'ƒ', 
           'á', 'í', 'ó', 'ú', 'ñ', 'Ñ', 'ª', 'º', '¿', '®', '¬', '½', '¼', '¡', '«', '»', 
           '░', '▒', '▓', '│', '┤', 'Á', 'Â', 'À', '©', '╣', '║', '╗', '╝', '¢', '¥', '┐', 
           '└', '┴', '┬', '├', '─', '┼', 'ã', 'Ã', '╚', '╔', '╩', '╦', '╠', '═', '╬', '¤', 
           'ð', 'Ð', 'Ê', 'Ë', 'È', 'ı', 'Í', 'Î', 'Ï', '┘', '┌', '█', '▄', '¦', 'Ì', '▀', 
           'Ó', 'ß', 'Ô', 'Ò', 'õ', 'Õ', 'µ', 'þ', 'Þ', 'Ú', 'Û', 'Ù', 'ý', 'Ý', '¯', '´', 
           '­', '±', '‗', '¾', '¶', '§', '÷', '¸', '°', '¨', '·', '¹', '³', '²', '■', ' '
       };
       /// <summary>
       /// Convert value into asc
       /// </summary>
       /// <returns>Integer</returns>
       public LSL_Integer osAsc(LSL_String value)
       {
           CheckThreatLevel(ThreatLevel.None, "osAsc");
           string text = (string)value;
           if (text != "")
           {
               char wanted = text[0];
               for (int i = 0; i < 256; i++)
               {
                   if (wanted == asctable[i])
                   {
                       return new LSL_Integer(i);
                   }
               }
           }
           return new LSL_Integer(-1);
       }
       /// <summary>
       /// Convert value into char (unicode)
       /// </summary>
       /// <returns>String</returns>
       public LSL_String osChr(LSL_Integer value)
       {
           CheckThreatLevel(ThreatLevel.None, "osChr");
           int i = (int)value;
           if (!(i < 0) && !(i > 255))
           {
               char wanted = asctable[i];
               return new LSL_String(wanted.ToString());
           }
           return new LSL_String("");
       }
       /// <summary>
       /// Get the Image UUID from agentID
       /// </summary>
       /// <returns>String</returns>
       public LSL_Key osGetAgentProfileImage(LSL_Key agentID)
       {
           CheckThreatLevel(ThreatLevel.Moderate, "osGetAgentProfileImage");
           m_host.AddScriptLPS(1);
           UUID id = new UUID();
           if (UUID.TryParse((string)agentID, out id))
           {
               CachedUserInfo cachedata = World.CommsManager.UserProfileCacheService.GetUserDetails(id);
               if (cachedata != null)
               {
                   return new LSL_Key(cachedata.UserProfile.Image.ToString());
               }
               UserProfileData userdata = World.CommsManager.UserService.GetUserProfile(id);
               if (userdata.CurrentAgent != null)
               {
                   return new LSL_Key(userdata.Image.ToString());
               }
           }
           return new LSL_Key(UUID.Zero.ToString());
       }
       /// <summary>
       /// Owner of script whispers text on channel
       /// </summary>
       /// <returns></returns>
       public void osWhisperAsOwner(LSL_Integer channel, LSL_String text)
       {
           CheckThreatLevel(ThreatLevel.Moderate, "osWhisperAsOwner");
           m_host.AddScriptLPS(1);
           string message = (string)text;
           if (message.Length > 1023)
           {
               message = message.Substring(0, 1023);
           }
           CachedUserInfo userinfo = World.CommsManager.UserProfileCacheService.GetUserDetails(m_host.OwnerID);
           if (userinfo != null)
           {
               ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
               if (presence != null)
               {
                   World.SimChat(Utils.StringToBytes(message), ChatTypeEnum.Whisper, (int)channel, presence.AbsolutePosition, userinfo.UserProfile.Name, m_host.OwnerID, false);
                   IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
                   if (wComm != null)
                   {
                       wComm.DeliverMessage(ChatTypeEnum.Whisper, (int)channel, userinfo.UserProfile.Name, m_host.OwnerID, message);
                   }
               }
           }
       }
       /// <summary>
       /// Owner of script says text on channel
       /// </summary>
       /// <returns></returns>
       public void osSayAsOwner(LSL_Integer channel, LSL_String text)
       {
           CheckThreatLevel(ThreatLevel.Moderate, "osSayAsOwner");
           m_host.AddScriptLPS(1);
           string message = (string)text;
           if (message.Length > 1023)
           {
               message = message.Substring(0, 1023);
           }
           CachedUserInfo userinfo = World.CommsManager.UserProfileCacheService.GetUserDetails(m_host.OwnerID);
           if (userinfo != null)
           {
               ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
               if (presence != null)
               {
                   World.SimChat(Utils.StringToBytes(message), ChatTypeEnum.Say, (int)channel, presence.AbsolutePosition, userinfo.UserProfile.Name, m_host.OwnerID, false);
                   IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
                   if (wComm != null)
                   {
                       wComm.DeliverMessage(ChatTypeEnum.Say, (int)channel, userinfo.UserProfile.Name, m_host.OwnerID, message);
                   }
               }
           }
       }
       /// <summary>
       /// Owner of script shouts text on channel
       /// </summary>
       /// <returns></returns>
       public void osShoutAsOwner(LSL_Integer channel, LSL_String text)
       {
           CheckThreatLevel(ThreatLevel.Moderate, "osShoutAsOwner");
           m_host.AddScriptLPS(1);
           string message = (string)text;
           if (message.Length > 1023)
           {
               message = message.Substring(0, 1023);
           }
           CachedUserInfo userinfo = World.CommsManager.UserProfileCacheService.GetUserDetails(m_host.OwnerID);
           if (userinfo != null)
           {
               ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
               if (presence != null)
               {
                   World.SimChat(Utils.StringToBytes(message), ChatTypeEnum.Shout, (int)channel, presence.AbsolutePosition, userinfo.UserProfile.Name, m_host.OwnerID, false);
                   IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
                   if (wComm != null)
                   {
                       wComm.DeliverMessage(ChatTypeEnum.Shout, (int)channel, userinfo.UserProfile.Name, m_host.OwnerID, message);
                   }
               }
           }
       }
       /// <summary>
       /// Get the keys from all attachments from an agent
       /// </summary>
       /// <returns>List of Keys</returns>
       public LSL_List osGetAgentAttachments(LSL_Key agentID)
       {
           CheckThreatLevel(ThreatLevel.Moderate, "osGetAgentAttachments");
           m_host.AddScriptLPS(1);
           UUID id = new UUID();
           LSL_List result = new LSL_List();
           if (UUID.TryParse((string)agentID, out id))
           {
               ScenePresence avatar = World.GetScenePresence(id);
               if (avatar != null)
               {
                   List<SceneObjectGroup> atts = avatar.Attachments;
                   foreach (SceneObjectGroup grp in atts)
                   {
                       result.Add(new LSL_Key(new UUID(grp.UUID).ToString()));
                   }
               }
           }
           return result;
       }
       /// <summary>
       /// Sents a message to an attachment identified by apoint attached to agentID
       /// a script in the attachment must implement the dataserver event
       /// the dataserver event is passed the UUID of the calling script and a message
       /// </summary>
       /// <returns></returns>
       public void osMessageAgentAttachment(LSL_Integer apoint, LSL_Key agentID, LSL_String message)
       {
           CheckThreatLevel(ThreatLevel.Moderate, "osMessageAgentAttachment");
           m_host.AddScriptLPS(1);
           UUID id = new UUID();
           if (UUID.TryParse((string)agentID, out id))
           {
               ScenePresence avatar = World.GetScenePresence(id);
               if (avatar != null)
               {
                   List<SceneObjectGroup> atts = avatar.Attachments;
                   foreach (SceneObjectGroup grp in atts)
                   {
                       byte attachedTo = grp.GetAttachmentPoint();
                       byte wanted = (byte)((int)apoint);
                       if (attachedTo == wanted)
                       {
                           object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), message };
                           SceneObjectPart part = World.GetSceneObjectPart(new UUID(grp.UUID.ToString()));
                           m_ScriptEngine.PostObjectEvent(part.LocalId, new EventParams("dataserver", resobj, new DetectParams[0]));
                           return;
                       }
                   }
               }
           }
       }
       /// <summary>
       /// Get the keys from all avatars in the region
       /// </summary>
       /// <returns>List of Keys</returns>
       public LSL_List osGetRegionAvatars()
       {
           CheckThreatLevel(ThreatLevel.Moderate, "osGetRegionAvatars");
           // same as osGetAgents() just returning keys instead of names
           LSL_List result = new LSL_List();
           foreach (ScenePresence avatarSP in World.GetAvatars())
           {
               result.Add(avatarSP.UUID);
           }
           return result;
       }
       /// <summary>
       /// Get the attachment point for an attachment specified by aID attached to agentID
       /// </summary>
       /// <returns>Integer</returns>
       public LSL_Integer osGetAgentAttachmentPoint(LSL_Key aID, LSL_Key agentID)
       {
           CheckThreatLevel(ThreatLevel.Moderate, "osGetAgentAttachmentPoint");
           m_host.AddScriptLPS(1);
           UUID id = new UUID();
           if (UUID.TryParse((string)agentID, out id))
           {
               ScenePresence avatar = World.GetScenePresence(id);
               if (avatar != null)
               {
                   List<SceneObjectGroup> atts = avatar.Attachments;
                   foreach (SceneObjectGroup grp in atts)
                   {
                       string attachedTo = grp.UUID.ToString();
                       string wanted = (string)aID;
                       if (attachedTo == wanted)
                       {
                           return new LSL_Integer((int)grp.GetAttachmentPoint());
                       }
                   }
               }
           }
           return new LSL_Integer(-1);
       }
       /// <summary>
       /// Get the attachment UUID for an attachment specified by apoint attached to agentID
       /// </summary>
       /// <returns>Key</returns>
       public LSL_Key osGetAgentAttachmentKey(LSL_Integer apoint, LSL_Key agentID)
       {
           CheckThreatLevel(ThreatLevel.Moderate, "osGetAgentAttachmentKey");
           m_host.AddScriptLPS(1);
           UUID id = new UUID();
           if (UUID.TryParse((string)agentID, out id))
           {
               ScenePresence avatar = World.GetScenePresence(id);
               if (avatar != null)
               {
                   List<SceneObjectGroup> atts = avatar.Attachments;
                   foreach (SceneObjectGroup grp in atts)
                   {
                       byte attachedTo = grp.GetAttachmentPoint();
                       byte wanted = (byte)((int)apoint);
                       if (attachedTo == wanted)
                       {
                           return new LSL_Key(grp.UUID.ToString());
                       }
                   }
               }
           }
           return new LSL_Key(UUID.Zero.ToString());
       }
       /// <summary>
       /// Get the online status for agentID
       /// </summary>
       /// <returns>Integer</returns>
       public LSL_Integer osGetAgentOnlineStatus(LSL_Key agentID)
       {
           CheckThreatLevel(ThreatLevel.Moderate, "osGetAgentOnlineStatus");
           m_host.AddScriptLPS(1);
           int online = 0;
           UUID id = new UUID();
           if (UUID.TryParse((string)agentID, out id))
           {
               UserProfileData userProfile = World.CommsManager.UserService.GetUserProfile(id);
               if ((userProfile.CurrentAgent != null) && (userProfile.CurrentAgent.AgentOnline == true))
               {
                   online = 1;
               }
           }
           return new LSL_Integer(online);
       }
       /// <summary>
       /// Rename objectID
       /// </summary>
       /// <returns>TRUE if successful, FALSE otherwise</returns>
       public LSL_Integer osRenameObject(LSL_Key objectID, LSL_String objectNAME)
       {
           CheckThreatLevel(ThreatLevel.Moderate, "osRenameObject");
           m_host.AddScriptLPS(1);
           string sobj = (string)objectID;
           string sname = (string)objectNAME;
           UUID id = new UUID();
           if (UUID.TryParse(sobj, out id))
           {
               SceneObjectPart sceneOP = World.GetSceneObjectPart(id);
               if (sceneOP != null)
               {
                   SceneObjectGroup sceneOG = sceneOP.ParentGroup;
                   if (sceneOG != null)
                   {
                       if (sceneOG.OwnerID == m_host.OwnerID)
                       {
                           sceneOG.Name = sname;
                           return new LSL_Integer(1);
                       }
                   }
               }
           }
           return new LSL_Integer(0);
       }
       /// <summary>
       /// Get reversed text
       /// </summary>
       /// <returns>String</returns>
       public LSL_String osReversedText(LSL_String text)
       {
           CheckThreatLevel(ThreatLevel.None, "osReversedText");
           string in_ = (string)text;
           string out_ = "";
           for (int i = 0; i < in_.Length; i++)
           {
               out_ += in_[in_.Length - i - 1];
           }
           return new LSL_String(out_);
       }
       /// <summary>
       /// Get music url from owned parcel
       /// </summary>
       /// <returns>String</returns>
       public LSL_String osGetParcelMusicURL()
       {
           CheckThreatLevel(ThreatLevel.Moderate, "osGetParcelMusicURL");
           m_host.AddScriptLPS(1);
           ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
           if (m_host.OwnerID == land.LandData.OwnerID)
           {
               return new LSL_String(land.LandData.MusicURL);
           }
           return new LSL_String("");
       }
       /// <summary>
       /// Get the numer of sides/faces for the given link prim
       /// constants LINK_* are allowed and will return the sum of faces
       /// </summary>
       /// <returns>Integer</returns>
       public LSL_Integer osGetLinkNumberOfSides(LSL_Integer linknum)
       {
           CheckThreatLevel(ThreatLevel.None, "osGetLinkNumberOfSides");
           m_host.AddScriptLPS(1);
           int link = (int)linknum;
           int sides = 0;
           if (m_host.ParentGroup != null)
           {
               if (link < 0)
               {
                   switch (link)
                   {
                       case -1: // LINK_SET
                           foreach (SceneObjectPart setpart in m_host.ParentGroup.Children.Values)
                           {
                               sides += setpart.GetNumberOfSides();
                           }
                           return new LSL_Integer(sides);
                       case -2: // LINK_ALL_OTHERS
                           foreach (SceneObjectPart otherpart in m_host.ParentGroup.Children.Values)
                           {
                               sides += otherpart.GetNumberOfSides();
                           }
                           sides -= m_host.GetNumberOfSides();
                           return new LSL_Integer(sides);
                       case -3: // LINK_ALL_CHILDREN
                           foreach (SceneObjectPart childrenpart in m_host.ParentGroup.Children.Values)
                           {
                               sides += childrenpart.GetNumberOfSides();
                           }
                           sides -= m_host.ParentGroup.RootPart.GetNumberOfSides();
                           return new LSL_Integer(sides);
                       case -4: // LINK_THIS
                           sides += m_host.GetNumberOfSides();
                           return new LSL_Integer(sides);
                       default:
                           sides += m_host.GetNumberOfSides();
                           return new LSL_Integer(sides);
                   }
               }
               else
               {
                   SceneObjectPart singlepart = m_host.ParentGroup.GetLinkNumPart(link);
                   if (singlepart != null)
                   {
                       sides += singlepart.GetNumberOfSides();
                       return new LSL_Integer(sides);
                   }
                   else
                   {
                       sides += m_host.GetNumberOfSides();
                       return new LSL_Integer(sides);
                   }
               }
           }
           return new LSL_Integer(0);
       }
       /// <summary>
       /// Rescale objectID with objectSCALE
       /// </summary>
       /// <returns>TRUE if successful, FALSE otherwise</returns>
       public LSL_Integer osRescaleObject(LSL_Key objectID, LSL_Vector objectSCALE)
       {
           CheckThreatLevel(ThreatLevel.Moderate, "osRescaleObject");
           m_host.AddScriptLPS(1);
           Vector3 scale = new Vector3((float)objectSCALE.x, (float)objectSCALE.y, (float)objectSCALE.z);
           string sobj = (string)objectID;
           UUID id = new UUID();
           if (UUID.TryParse(sobj, out id))
           {
               SceneObjectPart sceneOP = World.GetSceneObjectPart(id);
               if (sceneOP != null)
               {
                   SceneObjectGroup sceneOG = sceneOP.ParentGroup;
                   if (sceneOG != null)
                   {
                       if (sceneOG.OwnerID == m_host.OwnerID)
                       {
                           sceneOG.GroupResize(scale, sceneOG.LocalId);
                           return new LSL_Integer(1);
                       }
                   }
               }
           }
           return new LSL_Integer(0);
       }
       /// <summary>
       /// Convert color into rgb (<1.0, 1.0, 1.0> == "#FFFFFF")
       /// </summary>
       /// <returns>String</returns>
       public LSL_String osRgb(LSL_Vector color)
       {
           CheckThreatLevel(ThreatLevel.None, "osRgb");
           float min = 0.0f;
           float max = 1.0f;
           float ff = 255.0f;
           float r = (float)color.x;
           float g = (float)color.y;
           float b = (float)color.z;
           // quick bounds check
           if (r < min) r = min;
           if (r > max) r = max;
           if (g < min) g = min;
           if (g > max) g = max;
           if (b < min) b = min;
           if (b > max) b = max;
           int red = ((int)((r / max) * ff)) * 65536;
           int green = ((int)((g / max) * ff)) * 256;
           int blue = ((int)((b / max) * ff));
           int c = red + green + blue;
           return new LSL_String("#" + String.Format("{0:X6}", c));
       }
       //  END OF OSSL NEW OWN IMPLEMENTED
       # endregion

INSERT INTO: OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs


       # region by Athlon Maurer, 15. June 2010
       //  BEGIN OF OSSL NEW OWN IMPLEMENTED
       public LSL_Integer osDerezObject(key objectID)
       {
           return m_OSSL_Functions.osDerezObject(objectID);
       }
       public LSL_String osHex(LSL_Integer value, LSL_Integer count)
       {
           return m_OSSL_Functions.osHex(value, count);
       }
       public LSL_String osBin(LSL_Integer value)
       {
           return m_OSSL_Functions.osBin(value);
       }
       public LSL_Integer osAsc(LSL_String value)
       {
           return m_OSSL_Functions.osAsc(value);
       }
       public LSL_String osChr(LSL_Integer value)
       {
           return m_OSSL_Functions.osChr(value);
       }
       public key osGetAgentProfileImage(key agentID)
       {
           return m_OSSL_Functions.osGetAgentProfileImage(agentID);
       }
       public void osWhisperAsOwner(LSL_Integer channel, LSL_String text)
       {
           m_OSSL_Functions.osWhisperAsOwner(channel, text);
       }
       public void osSayAsOwner(LSL_Integer channel, LSL_String text)
       {
           m_OSSL_Functions.osSayAsOwner(channel, text);
       }
       public void osShoutAsOwner(LSL_Integer channel, LSL_String text)
       {
           m_OSSL_Functions.osShoutAsOwner(channel, text);
       }
       public LSL_List osGetAgentAttachments(key agentID)
       {
           return m_OSSL_Functions.osGetAgentAttachments(agentID);
       }
       public void osMessageAgentAttachment(LSL_Integer apoint, key agentID, LSL_String message)
       {
           m_OSSL_Functions.osMessageAgentAttachment(apoint, agentID, message);
       }
       public LSL_List osGetRegionAvatars()
       {
           return m_OSSL_Functions.osGetRegionAvatars();
       }
       public LSL_Integer osGetAgentAttachmentPoint(key aID, key agentID)
       {
           return m_OSSL_Functions.osGetAgentAttachmentPoint(aID, agentID);
       }
       public key osGetAgentAttachmentKey(LSL_Integer apoint, key agentID)
       {
           return m_OSSL_Functions.osGetAgentAttachmentKey(apoint, agentID);
       }
       public LSL_Integer osGetAgentOnlineStatus(key agentID)
       {
           return m_OSSL_Functions.osGetAgentOnlineStatus(agentID);
       }
       public LSL_Integer osRenameObject(key objectID, LSL_String objectNAME)
       {
           return m_OSSL_Functions.osRenameObject(objectID, objectNAME);
       }
       public LSL_String osReversedText(LSL_String text)
       {
           return m_OSSL_Functions.osReversedText(text);
       }
       public LSL_String osGetParcelMusicURL()
       {
           return m_OSSL_Functions.osGetParcelMusicURL();
       }
       public LSL_Integer osGetLinkNumberOfSides(LSL_Integer linknum)
       {
           return m_OSSL_Functions.osGetLinkNumberOfSides(linknum);
       }
       public LSL_Integer osRescaleObject(key objectID, vector objectSCALE)
       {
           return m_OSSL_Functions.osRescaleObject(objectID, objectSCALE);
       }
       public LSL_String osRgb(vector color)
       {
           return m_OSSL_Functions.osRgb(color);
       }
       //  END OF OSSL NEW OWN IMPLEMENTED
       # endregion

END OF OSSL NEW OWN IMPLEMENTED


Personal tools
General
About This Wiki