| |
Avatar Biorythm
Page history last edited by Codie 2 yrs ago
Avatar Biorythm 0.01 LSL Script
Author: CodeBastard "Codie" Redgrave <cbredgrave@gmail.com>
Date: 19/05/2007
Codie is a member of Bot Babes and Optimal Prim Corporation
This is my first entry as a fresh new BotBabe as an attempt to apply a very old algorythm to a brave new world. Biorythms are a quite old theory about the biological cycles of a living being as being continuous waves of ups and down. I absolutely realize the irony of applying this algorythmic principle to an avatar but it only made it more amusing to try. Since we only wanted to demonstrate usage of an algorythm in a LSL script, entering RL data into the script seemed undesirable and laborious. So instead I opted tu push the joke even further and apply biorythmy according to the avatar's age in-game. The biorythmic calculations are quite simple and requires only 1 parameter: the lifespan of of the subject calculated in seconds. Since LSL provides avatar age and timestamp in minimaly managable formats, we needed to convert both into seconds and substract them. For this I used a commonly used LSL date converter picked up directly from LSLWiki in the time related function pages.
Once we have our total lifetime in seconds, we only needed to apply this to those 3 simple formulas, the t variable of course being the lifetime in seconds:
- physical: sin(2Ï€t / 23)
- emotional: sin(2Ï€t / 28)
- intellectual: sin(2Ï€t / 33)
BE WARNED: THIS SCRIPT IS SHITTY. I am very not satisfied with it. The algos are okay and im basically satisfied of the syntax, but was tired and had several blockages when writing this script. I'm still struggling with certain aspects of global variable scopes when using certain events like dataserver. I also had problems actually returning any results from the neato set of function I made for this script, so ended up ditching the functions to pack most of the code inside some unique function. Again, this is one of my first more advanced script, still learning, so bear with me. I'm just 4 month old after all, ask your 4 month old daughter to do that. This code needs a complete rewrite, notecard support and many enhancements cam be made. It's a first jet, not too bad for a PHP programmer struggling with LSL variable type declarations.
Anyways I had fun learning doing that script, have fun fiddling with it.
Instructions:
1. Create a prim
2. Create a new script in the prim
3. Copy and paste this in the emptyied script
Usage:
Click it beyoch!
Here's the code:
Avatar Biorythm
|
|
Tip: To turn text into a link, highlight the text, then click on a page or file from the list above.
|
|
|
|
|
Comments (0)
You don't have permission to comment on this page.