|
Lilly Noodle
Registered User
Join date: 8 May 2006
Posts: 4
|
05-17-2006 21:39
I'm looking for a script that will play a sound whenever you jump (a.k.a. press "Page up"  . Thankies, ~Lilly
|
|
Cross Lament
Loose-brained Vixen
Join date: 20 Mar 2004
Posts: 1,115
|
05-18-2006 00:01
This script will only play the sound when you are actually jumping, ie. you're on the ground (or some object) and jump into the air. It won't play the sound if you're already in the air and press up (eg. falling, flying, etc). // Some place to store the sound name. string gsSound = "your sound here" ; // Volume to play sound at. float giVolume = 1.0 ;
integer giHasperms = FALSE ;
default { attach( key id ) { if( id != NULL_KEY ) { llRequestPermissions( id, PERMISSION_TAKE_CONTROLS ) ; } else { llReleaseControls() ; giHasperms = FALSE ; } } run_time_permissions( integer perms ) { if( ( perms & PERMISSION_TAKE_CONTROLS ) && !giHasperms ) { giHasperms = TRUE ; llTakeControls( CONTROL_UP, TRUE, TRUE ) ; } } control( key id, integer held, integer change ) { // Is the UP control being pressed? if( held & change & CONTROL_UP ) { integer agentstatus = llGetAgentInfo( id ) ; // Make sure they're not already flying or falling. if( ( ~agentstatus & AGENT_FLYING ) && ( ~agentstatus & AGENT_IN_AIR ) ) { llPlaySound( gsSound, giVolume ) ; } } } }
_____________________
- Making everyone's day just a little more surreal -
Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?"
|