User:Meyermagic Salome: Difference between revisions
No edit summary |
m →Some code: lsl code tagging |
||
| Line 27: | Line 27: | ||
== Some code == | == Some code == | ||
My Single-prim, scrollable Image Gallery:<br /> | My Single-prim, scrollable Image Gallery:<br /> | ||
< | <lsl> | ||
integer texture_count; | integer texture_count; | ||
list textures; | list textures; | ||
| Line 172: | Line 172: | ||
} | } | ||
</ | </lsl> | ||
== Notes == | == Notes == | ||
* *Title tentative | * *Title tentative | ||
Revision as of 21:02, 30 March 2008
About me
Name: Meyer S. Jacobs
Alias: Meyermagic, if(x), |-1|
Age: 472794735 as of 1175103075 (seconds since the Unix Epoch)
Avoids: Carbonated drinks, dressing up, political parties, organized religion
Is drawn to: Math, physics, technology, interesting people, old cartoons, sci-fi, anime, good books, things that spin, magnets, food
My plot in TG SL: TransGrid Corporation HQ🖈
My DeviantART Page: Meyermagic on DeviantART
My last.fm Page: Meyermagic's Music Profile
Projects
Perception - A four part story
⇒ Part One: The Crystals of Power
⇒ Part Two: The Tower Archive
⇒ Part Three: Perpetual*
⇒ Part Four: Transcend
The WeFiki - A next generation web protocol
null_Void - My personal site; not yet online
Some code
My Single-prim, scrollable Image Gallery:
<lsl>
integer texture_count;
list textures;
integer current = 0;
string str_repeat(string src, integer count) {
string output;
integer i;
for(i = 0; i < count; i++)
{
output += src;
}
return output;
}
next() {
if(current < texture_count - 1)
{
current++;
}
else
{
current = 0;
}
llSetTexture(llList2String(textures, current), ALL_SIDES);
}
prev() {
if(current > 0)
{
current--;
}
else
{
current = texture_count - 1;
}
llSetTexture(llList2String(textures, current), ALL_SIDES);
}
//list image_data() //{ // return []; //}
vector grab;
integer gc;
default {
state_entry()
{
texture_count = llGetInventoryNumber(INVENTORY_TEXTURE);
integer i;
for(i = 0; i < texture_count; i++)
{
textures += [llGetInventoryKey(llGetInventoryName(INVENTORY_TEXTURE, i))];
}
llSetTexture(llList2String(textures, current), ALL_SIDES);
}
touch(integer num_detected)
{
grab = llDetectedGrab(0);
gc++;
float scroll = grab.x;
//float shift = grab.y;
float trans = scroll * (float)llPow(gc, 0.5);
//float vtrans = shift * (float)llPow(gc, 0.5);
if(trans > 5.0)
{
next();
gc = 0;
}
if(trans < -5.0)
{
prev();
gc = 0;
}
trans = trans / 5.0;
string prev_char;
string next_char;
if(trans > 0.0)
{
next_char = ">";
prev_char = "|";
trans = llFabs(trans);
if(trans > 1.0)
{
trans = 1.0;
}
llSetText(prev_char + str_repeat("-", (integer)(trans * 50)) + next_char + str_repeat("-", 50 - (integer)(trans * 50)) + "|", <1,1,1>, trans);
}
if(trans < 0.0)
{
next_char = "|";
prev_char = "<";
trans = llFabs(trans);
if(trans > 1.0)
{
trans = 1.0;
}
llSetText("|" + str_repeat("-", 50 - (integer)(trans * 50)) + prev_char + str_repeat("-", (integer)(trans * 50)) + next_char, <1,1,1>, trans);
}
}
touch_end(integer num_detected)
{
gc = 0;
llSetText("", <1,1,1>, 10.0);
}
changed(integer change)
{
if(change == CHANGED_INVENTORY)
{
key old = llList2Key(textures, current);
texture_count = llGetInventoryNumber(INVENTORY_TEXTURE);
textures = [];
integer i;
for(i = 0; i < texture_count; i++)
{
textures += [llGetInventoryKey(llGetInventoryName(INVENTORY_TEXTURE, i))];
}
if((current = llListFindList(textures, [old])) == -1)
{
current = 0;
}
llSetTexture(llList2String(textures, current), ALL_SIDES);
}
}
} </lsl>
Notes
- *Title tentative