Thanks for the replies.<br>Sure would be nice to be able to 'port' the existing haskell code to C or C++ or Java.<br>From what I've seen of haskell I can't make heads or tails of it.<br><br>Shameless plug for Second Life(SL). It has really affected my first life.<br>
Prompting me to continue to program, to struggle with gimp, and to learn to use <br>blender(used to make complex objects for import into SL), an open source 3d modelling package.<br>Some time back a blender demo was planned for colug and I wanted to see it as I was struggling.<br>
Unfortunately the blender demo was cancelled. Since them I've watched many youtube videos and<br>can make simple objects.<br><br>I have been thinking it would be fun to give a demo of using blender to create an object and import into<br>
SL for colug.<br><br>Here is a simple example of a working lsl script I wrote recently.<br><br>---------start---------------<br>string Version = "1.0";<br>string Help = "HairLock ReadMe";<br>string ArrivalSound = "5dfc8d49-344a-1810-5193-1ec067c14d3f";<br>
key Owner;<br>integer State;<br>integer Main = 0;<br>integer Sounds = 1;<br>integer Particles = 2;<br><br>integer SoundOn = TRUE;<br>integer ParticlesOn = TRUE;<br>integer locked;<br>integer Channel;<br>integer ListenToken;<br>
list ParticleList;<br>list SoundsList;<br><br>Menu(key Agent) {<br> list Buttons;<br> string Message;<br> Message = llKey2Name(Owner) + "'s Hair. " + Version;<br> if ( State == Main ) {<br>
if (locked ) Buttons += "Unlock";<br> else Buttons += "Lock";<br> Buttons += "Particles";<br> Buttons += "Help";<br><br> Buttons += "Sound";<br>
Buttons += "Test";<br><br> } else if ( State == Sounds ) {<br> if ( SoundOn ) Buttons += "Off";<br> else Buttons += "On";<br> Buttons += "^";<br> } else if ( State = Particles ) {<br>
if ( ParticlesOn ) Buttons += "Off";<br> else Buttons += "On";<br><br> Buttons += "^";<br> }<br> llDialog(Agent,Message,Buttons,Channel);<br> ListenToken = llListen(Channel,"",Agent,"");<br>
}<br><br>TelePort() {<br> if ( SoundOn ) {<br> llPreloadSound(ArrivalSound);<br> }<br> if ( ParticlesOn ) {<br> //BlueShine();<br> LightOfGod();<br> }<br> llSetTimerEvent(2.0); <br>}<br>
<br>BlueShine()<br>{<br> llParticleSystem([<br> PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK | PSYS_PART_TARGET_POS_MASK | PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_FOLLOW_VELOCITY_MASK | PSYS_PART_FOLLOW_SRC_MASK,<br>
PSYS_PART_MAX_AGE, 3.818628,<br> PSYS_PART_FLAGS, 337,<br> PSYS_PART_START_COLOR, <1.00000, 0.00000, 1.00000>,<br> PSYS_PART_END_COLOR, <0.00000, 1.00000, 1.00000>,<br>
PSYS_PART_START_SCALE, <0.10000, 0.10000, 0.00000>,<br> PSYS_PART_END_SCALE, <0.50000, 0.60000, 0.00000>,<br> PSYS_SRC_PATTERN, 2,<br> PSYS_SRC_BURST_RATE, 1.000000,<br>
PSYS_SRC_ACCEL, <0.00000, 0.00000, 0.00000>,<br> PSYS_SRC_BURST_PART_COUNT, 27,<br> PSYS_SRC_BURST_RADIUS, 8.000000,<br> PSYS_SRC_BURST_SPEED_MIN, 1.000000,<br> PSYS_SRC_BURST_SPEED_MAX, 1.000000,<br>
PSYS_SRC_TARGET_KEY, llGetKey(),<br> PSYS_SRC_INNERANGLE, 3.000000,<br> PSYS_SRC_OUTERANGLE, 3.000000,<br> PSYS_SRC_OMEGA, <0.00000, 0.00000, 0.00000>,<br> PSYS_SRC_MAX_AGE, 0.0,<br>
PSYS_SRC_TEXTURE, "",<br> PSYS_PART_START_ALPHA, 1.000000,<br> PSYS_PART_END_ALPHA, 1.000000<br><br> ]);<br>}<br><br>LightOfGod()<br>{<br> llParticleSystem([ <br>
PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK|PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_FOLLOW_VELOCITY_MASK,<br> PSYS_PART_START_COLOR, <1.0, 1.0, 1.0>, <br> PSYS_PART_END_COLOR, <1.0, 1.0, 1.0>,<br>
PSYS_SRC_ACCEL, <0.0, 0.0, 0.0>, <br> PSYS_PART_START_SCALE, <.4, 30.1, 0.0>,<br> PSYS_PART_END_SCALE, <0.1, 30.0, 0.0>,<br> PSYS_PART_START_ALPHA, 1.0,<br>
PSYS_PART_END_ALPHA, 0.0, //This sets the size (scale) of the particles to 0.5m<br> PSYS_PART_MAX_AGE, 5.0, //This gives us the lifetime of the particles<br> PSYS_SRC_BURST_RATE, 0.1,<br>
PSYS_SRC_BURST_RADIUS, 1.0, //There's a new burst every 1.0 seconds<br> PSYS_SRC_BURST_SPEED_MIN, 0.30, //The minimum speed of the particles (in m/s)<br> PSYS_SRC_BURST_SPEED_MAX, 2.0, //The maximum speed - so they move slowly<br>
PSYS_SRC_BURST_PART_COUNT, 1000, //How many particles to make<br> PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE //The pattern we use, this is all round the prim.<br> ]);<br>
}<br><br><br>default {<br> state_entry() {<br> locked=FALSE;<br> Channel = (integer)(llFrand(-64760) - 1000.0);<br> Owner = llGetOwner();<br> }<br><br> touch_start(integer num) {<br> if ( Owner != llDetectedKey(0) ) return;<br>
Menu( llDetectedKey(0) );<br> }<br><br> on_rez(integer num)<br> {<br> Owner = llGetOwner();<br> if (locked) llOwnerSay("@detach=n");<br> }<br> changed(integer change)<br> {<br>
if ( CHANGED_TELEPORT & change )<br> {<br> TelePort();<br> }<br> }<br> timer() {<br> llSetTimerEvent(0.0);<br> if ( SoundOn ) llPlaySound(ArrivalSound,10.0);<br> // shut off Particles if any<br>
llParticleSystem([]); <br> }<br> listen(integer chan,string name,key id,string msg) {<br> llListenRemove(ListenToken);<br> if ( "^" == msg ) {<br> State = Main;<br> Menu(id);<br>
return;<br> }<br> if ( State == Main ) {<br> if ( "Lock" == msg ) {<br> llOwnerSay("@detach=n");<br> locked = TRUE;<br> llOwnerSay("Locked");<br>
} else if ("Unlock" == msg ) {<br> llOwnerSay("@detach=y");<br> locked = FALSE;<br> llOwnerSay("Unlocked");<br> } else if ("Sound" == msg ) {<br>
State = Sounds;<br> Menu(id);<br> } else if ("Particles" == msg ) {<br> State = Particles;<br> Menu(id);<br> } else if ( "Help" == msg ) {<br>
llGiveInventory(id,Help);<br> } else if ( "Test" == msg ) {<br> TelePort();<br> }<br> return;<br> } else if ( State == Sounds ) {<br> if ( "On" == msg ) {<br>
SoundOn=TRUE;<br> } else if ("Off" == msg ) {<br> SoundOn=FALSE;<br> }<br> State = Main;<br> Menu(id);<br> return;<br> }else if ( State == Particles ){<br>
if ( "On" == msg ) {<br> ParticlesOn=TRUE;<br> } else if ( "Off" == msg ) {<br> ParticlesOn=FALSE;<br> }<br> State = Main;<br>
Menu(id);<br> return;<br> } else {<br> llOwnerSay("Unknown State");<br> }<br> llOwnerSay("Unknown Button \"" + msg + "\".");<br>
<br> }<br>}<br>--------------------------------------end--------------------<br><br>