Have you ever wondered how the Second Life Cache system works? What exactly does it do and how can you use it to your advantage? Well today we will go over exactly how this part of the Second Life viewer works and how to manipulate it.
Second Life viewers use the Cache system to store tiny bits of data on your computers hard drive in order to speed up loading times for your avatar in world. By doing this textures and sounds and objects load a tiny bit faster than they would without the Cache system.
Basically when your computer has already come in contact with an item in Second Life your viewer can load that information faster because the viewer you are using "remembers" the item. This as opposed to having to download every asset each time you need to view it in world.
So what kind of information gets stored on your computer? Well the client stores object data, texture data, and sound data. The latter two we will be manipulating in this post. We will not be manipulating object data because the format in which the object data is stored is not user friendly.
So how can we manipulate texture data? Well we will need to create a few script like items and a few objects in Second Life. Let us get started.
Create 3 objects in Second LIfe.
Link them together.
Name one prim next.
Name one prim back.
And name the main prim whatever you like.
Now in the contents of the main prim create a New Script.
Open the New Script and delete everything inside.
Now paste the following text into the New Script and click save.
Do not worry about any errors that pop up we will fix these in just a moment.
key getlines;
key r;
integer l;
integer i = 0;
string note;
list letters = ["a","b","c","d","e","f"];
list numbers = ["1","2","3","4","5","6","7","8","9","0"];
list main = ["Letters","Numbers","Rez"];
integer lis;
integer chan;
string prefix = "keys-";
string curtexture;
default
{
on_rez(integer sp)
{
llResetScript();
}
state_entry()
{
note = prefix+llList2String(letters,0);
getlines = llGetNumberOfNotecardLines(note);
}
touch_start(integer x)
{
if(llGetLinkName(llDetectedLinkNumber(0)) == "next")
{
i++;
if(i>l)i=l;
if(i<0)i=0;
r = llGetNotecardLine(note,i);
}else if(llGetLinkName(llDetectedLinkNumber(0)) == "back")
{
i--;
if(i>l)i=l;
if(i<0)i=0;
r = llGetNotecardLine(note,i);
}else
{
llListenRemove(lis);
chan = llFloor(llFrand(DEBUG_CHANNEL));
lis = llListen(chan,"","","");
llDialog(llGetOwner(),"Choose an option",main,chan);
}
}
object_rez(key id)
{
llSay(123,(string)id+"^"+curtexture);
}
listen(integer c,string n,key id,string m)
{
if(llGetOwnerKey(id)!=llGetOwner())return;
if(m == "Letters")
{
llDialog(llGetOwner(),"Choose an option",letters,chan);
}else if(m == "Numbers")
{
llDialog(llGetOwner(),"Choose an option",numbers,chan);
}else if(m == "Rez")
{
llRezObject(llGetInventoryName(INVENTORY_OBJECT,0),llGetPos()+llRot2Fwd(llGetRot())*2,ZERO_VECTOR,ZERO_ROTATION,123);
}else
{
note = prefix+m;
getlines = llGetNumberOfNotecardLines(note);
}
}
dataserver(key id,string data)
{
if(id == getlines)
{
i = 0;
l = (integer)data;
r = llGetNotecardLine(note,i);
}else
{
list t = llParseString2List(data,["."],[]);
curtexture = llList2String(t,0);
llSetTexture(curtexture,ALL_SIDES);
llSay(123,"kill");
}
}
}
Now create the following notecards and place them inside the main prims contents.
keys-0
keys-1
keys-2
keys-3
keys-4
keys-5
keys-6
keys-7
keys-8
keys-9
keys-a
keys-b
keys-c
keys-d
keys-e
keys-f
Take care to match the names of these notecards exactly.
Create a prim and name it CUT_Prim
Add the following script to the CUT_Prim
default
{
on_rez(integer sp)
{
llListen(sp,"","","");
}
listen(integer c,string n,key id,string m)
{
if(llGetOwnerKey(id)!=llGetOwner())return;
list t = llParseString2List(m,["^"],[]);
if(m == "kill")
{
llDie();
}else
{
if(llList2String(t,0) == (string)llGetKey())
{
llSetObjectDesc(llList2String(t,1));
llSetTexture(llList2String(t,1),ALL_SIDES);
}
}
}
touch_start(integer x)
{
llSetTexture("04ff1b12-4b15-736a-7644-f9c798ef08a8",ALL_SIDES);
llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_SCULPT,llGetObjectDesc(),1]);
}
}
Now create a .txt file on your computer and name it whatever you like.
Copy the following text to the .txt file and save it
REM Second Life Section as Second Life is the default client
REM change the path before >> to the path to your cache folders
REM change usernamehere to your username for your computer
REM save the edits and double click the file. please make sure it is named something.bat
REM look in c:\ for .txt files named CUT-KEYS-x.txt these files will have your texture keys in them.
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\0* >> C:\CUT-KEYS-0.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\1* >> C:\CUT-KEYS-1.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\2* >> C:\CUT-KEYS-2.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\3* >> C:\CUT-KEYS-3.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\4* >> C:\CUT-KEYS-4.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\5* >> C:\CUT-KEYS-5.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\6* >> C:\CUT-KEYS-6.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\7* >> C:\CUT-KEYS-7.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\8* >> C:\CUT-KEYS-8.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\9* >> C:\CUT-KEYS-9.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\a* >> C:\CUT-KEYS-a.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\b* >> C:\CUT-KEYS-b.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\c* >> C:\CUT-KEYS-c.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\d* >> C:\CUT-KEYS-d.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\e* >> C:\CUT-KEYS-e.txt
dir /b C:\Users\usernamehere\AppData\Local\Firestorm\textures\f* >> C:\CUT-KEYS-f.txt
Change the .txt to .bat and run as administrator
Now look for the files CUT-KEYS-0-9/a-f.txt in your C:\ drive.
Open each of these .txt files and copy the contents to the corresponding notecards inside your main Prim in Second Life.
NOTE that you should probably clear your Caches before you do this as if there are too many items in each .txt file they will not fit into the notecards in Second Life.
After you have copy and pasted everything to the notecards and saved each one. Touch they main prim and choose a notecard to read and use.
The main prim will change texture.
You can change texture by clicking next and back prims.
Choosing Rez will rez the CUT_Prim which will change textures and allow you to take a copy of a prim with the texture on it.
Each time you change textures the CUT_Prim will die.
If the texture you are looking at is a sculpty just touch the CUT_Prim and it will switch to sculpt mode.
And there you have it. You have full access to any texture in Second Life that you have ever seen in your Viewer.
Now to manipulate sound files using our Cache.
The process is much the same. You need the same build but with different scripts.
So build 3 prims linked named next back and main prim.
Create a new script inside the main prim and delete the text inside the script and replace with the following.
string sound = "";
integer i = 0;
integer count = 0;
key r;
key g;
string note = "sounds";
default
{
changed(integer c)
{
if(c & CHANGED_INVENTORY)llResetScript();
}
state_entry()
{
note = llGetInventoryName(INVENTORY_NOTECARD,0);
r = llGetNumberOfNotecardLines(note);
}
dataserver(key id,string data)
{
if(id == r)
{
count = (integer)data;
g = llGetNotecardLine(note,i);
}else
{
list t = llParseString2List(data,["."],[]);
sound = llList2String(t,0);
llSetText(sound,<1,1,1>,1);
}
}
touch_start(integer total_number)
{
if(llGetLinkName(llDetectedLinkNumber(0))==llGetObjectName())
{
if(sound != "")llTriggerSound(sound,1.0);
llOwnerSay("sound UUID: "+sound);
}else if(llGetLinkName(llDetectedLinkNumber(0))=="next")
{
++i;
if(i>count-1)i=0;
g = llGetNotecardLine(note,i);
}else if(llGetLinkName(llDetectedLinkNumber(0))=="back")
{
--i;
if(i<0)i=0;
g = llGetNotecardLine(note,i);
}
}
}
Create a notecard named sounds and place that inside the main prim.
create a .txt file on your computer
copy the following into that txt file and name it whatever you like
change .txt to .bat
REM Second Life Section as Second Life is the default client
REM change usernamehere to the username of your computer.
REM change SecondLife to whatever client you are using. various clients use various strings here.
REM save the edits and double click the file. please make sure it is named something.bat
REM look in c:\ for .txt files named CUT-SKEYS-x.txt these files will have your sound keys in them.
REM copy only lines that end with .dsf
dir /b C:\Users\usernamehere\AppData\Local\Firestorm*.dsf > C:\CUS-SKEYS-0.txt
right click the bat file and Run as Administrator
open C:\ folder on your computer and open the CUS-SKEYS-0.txt file and copy the contents of that file
paste the contents you just copied to the notecard you put in the main prim
save the notecard
touch next or back to change the active sound file.
touch the main prim to have it speak the UUID of the sound file in local chat.
copy the UUID and use llTriggerSound("soundUUID",1.0); to play that sound in any script you like.
And there you have access to any sound you have heard in Second Life.
If you like this small tutorial on how to manipulate your cache please give it a vote. Have fun using Second Life.
NDroid
You got a 1.18% upvote from @postpromoter courtesy of @lothendriel! Want to promote your posts too? Check out the Steem Bot Tracker website for more info. If you would like to support development of @postpromoter and the bot tracker please vote for @yabapmatt for witness!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
http://www.hivmr.com/db/ccm8cddcz3z8skxkx8dxk1ja1jj7zsdj
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @nocturnaldroid! You received a personal award!
Happy Birthday! - You are on the Steem blockchain for 1 year!
Click here to view your Board
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @nocturnaldroid! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit