Como prometido mais script básicos para os visitantes do blog.
integer time = 86400; //update every 24 hours
key httpRequestId;
string mapTexture;
string URL = "http://www.subnova.com/secondlife/api/map.php";
default
{
on_rez( integer sparam )
{
llResetScript();
}
state_entry()
{
llSetTimerEvent(time);
httpRequestId = llHTTPRequest(URL + "?" + "sim" + "=" + llEscapeURL(llGetRegionName()),[], "");
}
http_response(key request_id, integer status, list metadata, string body)
{
if (request_id == httpRequestId)
{
mapTexture = body;
llSetTexture(mapTexture, ALL_SIDES); //you can replace ALL_SIDES with a side number instead
}
}
timer()
{
httpRequestId = llHTTPRequest(URL + "?" + "sim" + "=" + llEscapeURL(llGetRegionName()),[], "");
}
}
- Mostrar o mapa da região:
integer time = 86400; //update every 24 hours
key httpRequestId;
string mapTexture;
string URL = "http://www.subnova.com/secondlife/api/map.php";
default
{
on_rez( integer sparam )
{
llResetScript();
}
state_entry()
{
llSetTimerEvent(time);
httpRequestId = llHTTPRequest(URL + "?" + "sim" + "=" + llEscapeURL(llGetRegionName()),[], "");
}
http_response(key request_id, integer status, list metadata, string body)
{
if (request_id == httpRequestId)
{
mapTexture = body;
llSetTexture(mapTexture, ALL_SIDES); //you can replace ALL_SIDES with a side number instead
}
}
timer()
{
httpRequestId = llHTTPRequest(URL + "?" + "sim" + "=" + llEscapeURL(llGetRegionName()),[], "");
}
}
- Toque no prim e automaticamente a foto do perfil de quem toca aparecerá no prim:
// Snippets and HTTPRequest bits were taken from:
//~ RANDOM PROFILE PROJECTOR v5.4.5 by Debbie Trilling ~
// Get Profile Picture by Valentine Foxdale
// optmisation by SignpostMarv Martin
// workaround for WEB-1384 by Viktoria Dovgal, use meta tag instead of img since it comes earlier
list sides;
list deftextures;
integer s1l; // calculated from profile_key_prefix in state_entry()
string profile_key_prefix = "<meta name=\"imageid\" content=\"";
GetProfilePic(key id) //Run the HTTP Request then set the texture
{
//key id=llDetectedKey(0); This breaks the function, better off not used
string URL_RESIDENT = "http://world.secondlife.com/resident/";
llHTTPRequest( URL_RESIDENT + (string)id,[HTTP_METHOD,"GET"],"");
}
GetDefaultTextures() //Get the default textures from each side
{
integer i;
integer faces = llGetNumberOfSides();
for (i = 0; i < faces; i++)
{
sides+=i;
deftextures+=llGetTexture(i);
}
}
SetDefaultTextures() //Set the sides to their default textures
{
integer i;
integer faces;
faces = llGetNumberOfSides();
for (i = 0; i < faces; i++)
{
llSetTexture(llList2String(deftextures,i),i);
}
}
default
{
state_entry()
{
s1l = llStringLength(profile_key_prefix);
llSetText("Touch for this object to display your profile picture!",<0.8,0,1>,1);
//Note: Usage of another person's profile picture without their permission may be viewed as copyright infringement.
GetDefaultTextures();
}
touch_start(integer total_number)
{
GetProfilePic(llDetectedKey(0));
}
http_response(key req,integer stat, list met, string body)
{
integer s1 = llSubStringIndex(body,profile_key_prefix);
if(s1 == -1){SetDefaultTextures();}
else
{
s1 += s1l;
key UUID=llGetSubString(body, s1, s1 + 35);
if (UUID == NULL_KEY) {
SetDefaultTextures();
}
else {
llSetTexture(UUID,ALL_SIDES);
}
}
}
}
- Marcador de on ou off line. Script permitirá que outros avatares saibam quando o seu avatar está on/off. Ótimo para quem tem lojas.
key ownerkey;
string ownername;
default
{
on_rez(integer start_param)
{
llResetScript();
}
state_entry()
{
ownerkey = llGetOwner();
ownername = llKey2Name(ownerkey);
llSetTimerEvent(30.0); //check every 30 seconds
llRequestAgentData(ownerkey, DATA_ONLINE);
}
timer()
{
llRequestAgentData(ownerkey, DATA_ONLINE);
}
dataserver(key request, string data)
{
if (data == "1")
{
llSetText(ownername + " is Online", <0,1,0>, 1);
}
else
{
llSetText(ownername + " is Offline", <1,0,0>, 1);
}
}
}
- Cria uma caixa de doação de lindens, os famosos TIPs:
integer totaldonated;
default
{
on_rez( integer sparam )
{
llResetScript();
}
state_entry()
{
llSetText("Donation Box\nL$0 Donated so far",<1,1,1>,1);
}
money(key id, integer amount)
{
totaldonated = totaldonated + amount;
llSetText("Donation Box\nL$" + (string)totaldonated + " Donated so far",<1,1,1>,1);
llInstantMessage(id,"Thank you for the donation!");
}
}
Nenhum comentário:
Postar um comentário