Group Information v1.0: Difference between revisions
No edit summary |
|||
| Line 20: | Line 20: | ||
All scripts are included.<br> | All scripts are included.<br> | ||
<br> | <br> | ||
== | ==Group Information v1.0== | ||
<lsl> | |||
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=// | |||
// // | |||
// Group Information script v1.0 // | |||
// Without dialog menu // | |||
// Created by: Tyrennic Rivera // | |||
// Finished on: June 10 2009 // | |||
// All Rights Reserved // | |||
// // | |||
// This script is free software: you can redistribute it and/or modify // | |||
// it under the terms that you share this script with other people. // | |||
// - You are allowed to use this script in your products however the // | |||
// script may not be sold stand alone under any circumstance. // | |||
// - If you give this script to other people please give the original // | |||
// script with this license. // | |||
// // | |||
// http://creativecommons.org/licenses/by-sa/3.0/ // | |||
// // | |||
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=// | |||
key GroupKey; // Key of the group. | |||
string GroupName; // The name of the group. | |||
string GroupEnroll; // The group enrollment (open or closed). | |||
string GroupContent; // Group contents (PG, Mature or Adult). | |||
integer GroupFee; // Group fee, How much to pay to join the group. | |||
integer GroupCount; // The number of members in the group (Includes owners). | |||
default | |||
{ | |||
state_entry() | |||
{ | |||
llSetObjectName("Group Information"); | |||
} | |||
touch_start(integer total_number) | |||
{ | |||
// Save the group key for later use. | |||
GroupKey = llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_GROUP]), 0); | |||
// If a group has been set on the object request group information. | |||
if(GroupKey != NULL_KEY) | |||
{ | |||
llHTTPRequest("http://world.secondlife.com/group/" + (string)GroupKey, [], ""); | |||
} | |||
// If no group has been set give a error message. | |||
else | |||
{ | |||
llSay(0, "No group has been set. You can set this in build mode under the \"general\" tab."); | |||
} | |||
} | |||
http_response(key request_id, integer status, list metadata, string body) | |||
{ | |||
// This means the page has succesfully loaded. | |||
if(status == 200) | |||
{ | |||
// Dont edit this unless you know what you are doing!! | |||
integer s1 = llSubStringIndex(body, "<title>"); | |||
integer s2 = llSubStringIndex(body, "</title>"); | |||
integer s3 = llSubStringIndex(body, "<meta name=\"member_count\" content=\""); | |||
integer s4 = llSubStringIndex(body, "<meta name=\"open_enrollment\" content=\""); | |||
integer s5 = llSubStringIndex(body, "<meta name=\"membership_fee\" content=\""); | |||
integer s6 = llSubStringIndex(body, "<meta name=\"mat\" content=\""); | |||
// All the group information is saved in these variables. | |||
GroupName = llGetSubString(body, s1+7, s2-1); | |||
GroupEnroll = llGetSubString(body, s4+38, s4+38); | |||
GroupCount = (integer)llGetSubString(body, s3+35, s4-14); | |||
GroupFee = (integer)llGetSubString(body, s5+37, s6-8); | |||
GroupContent = llGetSubString(body, s6+26, s1-14); | |||
// When a group contains non-mature content. | |||
if(GroupContent == "PG_NOT") | |||
{ | |||
GroupContent = "PG"; | |||
} | |||
// When a group contains mature content. | |||
else if(GroupContent == "M_NOT") | |||
{ | |||
GroupContent = "Mature"; | |||
} | |||
// When a group contains adult content. | |||
else if(GroupContent == "M_AO") | |||
{ | |||
GroupContent = "Adult"; | |||
} | |||
// If the group enrollment is open. | |||
if(GroupEnroll == "Y") | |||
{ | |||
GroupEnroll = "Open"; | |||
} | |||
// Else if the group enrollment is closed. | |||
else if(GroupEnroll == "N") | |||
{ | |||
GroupEnroll = "Closed"; | |||
} | |||
// Make a temporary list with the group variables. | |||
list info = [GroupName, "Content: " + GroupContent, "Enrollment: " + GroupEnroll, "Join fee: L$" + (string)GroupFee, "Members: " + (string)GroupCount]; | |||
// Say the group information plus the link to the group. | |||
llSay(0, llDumpList2String(info, " || ") + "\nsecondlife:///app/group/" + (string)GroupKey + "/about"); | |||
} | |||
// Triggered when show in search is disabled. | |||
else if(status == 404) | |||
{ | |||
llSay(0, "This group has \"Show in search\" disabled, Information cannot be retrieved."); | |||
} | |||
// If the request has timed out (60 Seconds). | |||
else if(status == 499) | |||
{ | |||
llSay(0, "Group information request has timed out."); | |||
} | |||
} | |||
} | |||
</lsl> | |||
Revision as of 02:28, 21 June 2009
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
This script will give you the following information about a group.
- The name of the group
- What the content of the group is. (PG, Mature or Adult)
- What the group enrollment is. (open or closed)
- How much an avatar needs to pay to get into the group. (Group fee)
- How many members there are in the group.
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Dont Delete im still editing this!
Tyrennic Rivera...
XyyyyzText is a variation of XyText allowing up to 10 characters on a prim.
It supports different text in each line, instead of one single text which will be broken into the next lines.
Here's a picture on how it looks like: http://screencast.com/t/1wMLujLcEO
It shows the text in reversed order as the prims were linked together.
All scripts are included.
Group Information v1.0
<lsl> //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=// // // // Group Information script v1.0 // // Without dialog menu // // Created by: Tyrennic Rivera // // Finished on: June 10 2009 // // All Rights Reserved // // // // This script is free software: you can redistribute it and/or modify // // it under the terms that you share this script with other people. // // - You are allowed to use this script in your products however the // // script may not be sold stand alone under any circumstance. // // - If you give this script to other people please give the original // // script with this license. // // // // http://creativecommons.org/licenses/by-sa/3.0/ // // // //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
key GroupKey; // Key of the group. string GroupName; // The name of the group. string GroupEnroll; // The group enrollment (open or closed). string GroupContent; // Group contents (PG, Mature or Adult). integer GroupFee; // Group fee, How much to pay to join the group. integer GroupCount; // The number of members in the group (Includes owners).
default {
state_entry()
{
llSetObjectName("Group Information");
}
touch_start(integer total_number)
{
// Save the group key for later use.
GroupKey = llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_GROUP]), 0);
// If a group has been set on the object request group information.
if(GroupKey != NULL_KEY)
{
llHTTPRequest("http://world.secondlife.com/group/" + (string)GroupKey, [], "");
}
// If no group has been set give a error message.
else
{
llSay(0, "No group has been set. You can set this in build mode under the \"general\" tab.");
}
}
http_response(key request_id, integer status, list metadata, string body)
{
// This means the page has succesfully loaded.
if(status == 200)
{
// Dont edit this unless you know what you are doing!!
integer s1 = llSubStringIndex(body, "<title>");
integer s2 = llSubStringIndex(body, "</title>");
integer s3 = llSubStringIndex(body, "<meta name=\"member_count\" content=\"");
integer s4 = llSubStringIndex(body, "<meta name=\"open_enrollment\" content=\"");
integer s5 = llSubStringIndex(body, "<meta name=\"membership_fee\" content=\"");
integer s6 = llSubStringIndex(body, "<meta name=\"mat\" content=\"");
// All the group information is saved in these variables.
GroupName = llGetSubString(body, s1+7, s2-1);
GroupEnroll = llGetSubString(body, s4+38, s4+38);
GroupCount = (integer)llGetSubString(body, s3+35, s4-14);
GroupFee = (integer)llGetSubString(body, s5+37, s6-8);
GroupContent = llGetSubString(body, s6+26, s1-14);
// When a group contains non-mature content.
if(GroupContent == "PG_NOT")
{
GroupContent = "PG";
}
// When a group contains mature content.
else if(GroupContent == "M_NOT")
{
GroupContent = "Mature";
}
// When a group contains adult content.
else if(GroupContent == "M_AO")
{
GroupContent = "Adult";
}
// If the group enrollment is open.
if(GroupEnroll == "Y")
{
GroupEnroll = "Open";
}
// Else if the group enrollment is closed.
else if(GroupEnroll == "N")
{
GroupEnroll = "Closed";
}
// Make a temporary list with the group variables.
list info = [GroupName, "Content: " + GroupContent, "Enrollment: " + GroupEnroll, "Join fee: L$" + (string)GroupFee, "Members: " + (string)GroupCount];
// Say the group information plus the link to the group.
llSay(0, llDumpList2String(info, " || ") + "\nsecondlife:///app/group/" + (string)GroupKey + "/about");
}
// Triggered when show in search is disabled.
else if(status == 404)
{
llSay(0, "This group has \"Show in search\" disabled, Information cannot be retrieved.");
}
// If the request has timed out (60 Seconds).
else if(status == 499)
{
llSay(0, "Group information request has timed out.");
}
}
} </lsl>