It’s good practice to make code easy to maintain, so sometimes you’ll want to use less code using recursive functions. In order to find out how to this works in Second Life I created this small recusive example:
integer i = 0;
integer top = 0;
integer Monkeys()
{
llOwnerSay("monkeys");
i++;
if (i <= top)
return Monkeys();
else
return i;
}
default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
}
touch_start(integer total_number)
{
i = 0;
top = Monkeys();
llOwnerSay((string)top);
}
}
This script says monkeys an increasing amount of times every time you touch it by calling itself if and keeping track of the total amount of times the function is called. First time there will be 1 monkey, next time 2 monkeys etc. Find more products at our shop in Badmoon.
I had to create a simple script to turn a neon sign on and off. I decided to have both versions of the sign in a single texture and changing the offset with a script. Instead of using a timer and using llSetTimeout() instead I opted to pause the script for a small amount of time. The script does not respond when it’s sleeping which should be less laggy then the timeout. All i do then at the start of a state is offsetting the texture to show the on/off alternatively.
default
{
state_entry()
{
llOffsetTexture(0.0,0.25,ALL_SIDES);
llSleep(1.37);
state off;
}
}
state off
{
state_entry()
{
llOffsetTexture(0.0,0.75,ALL_SIDES);
llSleep(.723);
state default;
}
}
Hope this is of use to you. See the result in our Higher / Lower game at Badmoon.
Breaks Friday with Cloudseer @ the Drome! It’s my new spot: 3pm-5pm PST! Start off your weekend with the best breaks mixed by live DJ Cloudseer Writer, with a little bit electro thrown in! Bring all your friends to the Drome
It was good, managed to cram in a lot of breaks in two hours!
| # |
Title |
Artist |
| 1 |
Rattle Ya Cage |
General MIDI |
| 2 |
Bone Snow |
HELL, Sam |
| 3 |
No Rockstars (Bass Kleph Remix) |
Hyper |
| 4 |
Loving You (Atomic Hooligan Remix) - Ils |
Ils |
| 5 |
Soul Of Man - Foxy Moron |
Drummatic Twins |
| 6 |
Rusko v.s. the 80s |
Crendore |
| 7 |
Jahova |
Rusko |
| 8 |
Shake It Up (Hook n Sling Remix) |
Stanton Warriors |
| 9 |
Slyde - Vibrate To This (Dt’s Re-Edit) |
Drummatic Twins |
| 10 |
Tell Me How You Feel (Kid Kenobi vs Rogue Element Remix) |
Krafty Kuts |
| 11 |
Pop Ya Cork |
Stanton Warriors |
| 12 |
Message 2 Love (Alex Metric remix) |
Sharam Jey |
| 13 |
Plump Djs - Black Jack |
Drummatic Twins |
| 14 |
Everybody Get Up (Circuit Breaker Remix) - Transformer Man |
Transformer Man |
| 15 |
Cockney Thug |
Rusko |
| 16 |
Good To Go |
General MIDI |
| 17 |
Undertow feat. Patrick Scott - Oracle’s Man Overboard Mix |
Summer Channel |
| 18 |
Control (original mix) |
AUDIO DEALERS |
| 19 |
Rock This Place |
General MIDI |
| 20 |
Drummatic Twins - Feelin Kinda Strange (Bass Kleph & Nick Thayer Remix) |
Drummatic Twins |
| 21 |
Shredder |
Far Too Loud |
| 22 |
Da Virus |
Various Artists - XL Recordings |
| 23 |
Pop Ya Cork |
Stanton Warriors |
| 24 |
Turn It Loud |
General MIDI |
