dose anyone know why this is not working
|
|
Dan Colville
Registered User
Join date: 28 Jul 2006
Posts: 26
|
09-22-2008 23:28
I using a script that plays a sound when ever the object moves. This is it worked when i first got it but now that i have changed the scrip to play a sound instead of say it moved as was what i did before. It now doesn't work. it says the play sound name is not defined within scope but it is exactly the same. I have also tried using the UUID but that has a syntax error. so dose anyone know what is wrong with the script. you can see it below. default { state_entry(){ //define current avatar/prim position here llTarget(llGetPos(), 2); } not_at_target(){ //Moved llPlaySound (move, 1); llStopSound(); llTarget(llGetPos(), 2); } } //End Script This in the original one i got from Ruthven Willenov default { state_entry(){ //define current avatar/prim position here llTarget(llGetPos(), 1.0); } not_at_target(){ //Moved llOwnerSay("Moved"  ; llTarget(llGetPos(), 1.0); } }
|
|
Dan Colville
Registered User
Join date: 28 Jul 2006
Posts: 26
|
09-22-2008 23:44
also i take it that llTarget(llGetPos(), 2) means it gets the pos every 2 meters or something or is it seconds i dont really know. if it is meters is there any it can be changes to get the pos very 2 seconds.
|
|
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
|
09-23-2008 01:31
Is «move» the name of your sound?
Then you have to put llPlaySound("move", 1.0);
You're using «move» as a variable which isn't defined anywhere in your script - that's way the compiler complains.
As for llTarget...
llTarget(llGetPos(), 1.0); - defines the target within 1 meter of the current pos. So whenever the object moves farther than 1 meter, the not_at_target()-event fires.
HTH
|
|
Dan Colville
Registered User
Join date: 28 Jul 2006
Posts: 26
|
09-23-2008 02:19
From: Haruki Watanabe Is «move» the name of your sound?
Then you have to put llPlaySound("move", 1.0);
You're using «move» as a variable which isn't defined anywhere in your script - that's way the compiler complains.
As for llTarget...
llTarget(llGetPos(), 1.0); - defines the target within 1 meter of the current pos. So whenever the object moves farther than 1 meter, the not_at_target()-event fires.
HTH Ok so what do i have to change or ad to defined the move variable to get it working
|
|
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
|
09-23-2008 05:21
To play a sound, you need to provide either the UUID or the name of the sound. If you provide the name, then the sound needs to be in the content of the object. So either: string move = "66864f3c-e095-d9c8-058d-d6575e6ed1b8"; llPlaySound(move, 1.0); or: string move = "mysoundfile"; llPlaySound(move, 1.0); of course, you can define the variable in the global-scope of the script:
string move = "66864f3c-e095-d9c8-058d-d6575e6ed1b8"; // Note, this key is just an example!
default{ state_entry(){ llTarget(llGetPos(), 1.0); } not_at_target(){ llPlaySound(move, 1.0); } }
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llPlaySound
|
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-23-2008 06:23
you need to keep llGetPos() in the not at target so it can update the target. otherwise it will keep triggering the not at target funtion even if you're not moving as long as it's not at the target specified in the state entry From: Haruki Watanabe To play a sound, you need to provide either the UUID or the name of the sound. If you provide the name, then the sound needs to be in the content of the object. So either: string move = "66864f3c-e095-d9c8-058d-d6575e6ed1b8"; llPlaySound(move, 1.0); or: string move = "mysoundfile"; llPlaySound(move, 1.0); of course, you can define the variable in the global-scope of the script:
string move = "66864f3c-e095-d9c8-058d-d6575e6ed1b8"; // Note, this key is just an example!
default{ state_entry(){ llTarget(llGetPos(), 1.0); } not_at_target(){ llPlaySound(move, 1.0); llTarget(llGetPos(), 2);//this is needed in the not_at_target state so it can update the target
} }
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llPlaySound
|
|
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
|
09-23-2008 17:46
Guys - I'm almost certain that the OP didn't notice the quotes (or understand their significance) in the answer Haruki gave already... From: Haruki Watanabe Then you have to put llPlaySound("move", 1.0); ...save your finger muscles  /esc
_____________________
http://slurl.com/secondlife/Together
|
|
Dan Colville
Registered User
Join date: 28 Jul 2006
Posts: 26
|
09-23-2008 19:46
string move = "87d359b2-838d-20e6-bab2-c7b483d413e0";
default { state_entry(){ //define current avatar/prim position here llTarget(llGetPos(), 0.1); }
not_at_target(){ //Moved llPlaySound(move, 5); llSleep(2.0); llTarget(llGetPos(), 0.1); } }
i think that's pretty much it but i works. So now that i got it going can someone help me out with a at_target the only think i could come up with but it dose not work.
string move = "87d359b2-838d-20e6-bab2-c7b483d413e0";
default { state_entry(){ //define current avatar/prim position here llTarget(llGetPos(), 0.1); }
not_at_target(){ //Moved llPlaySound(move, 5); llSleep(2.0); llTarget(llGetPos(), 0.1); } else at_target (){ llStopSound() } } }
Can someone correct what i did wrong here.
|
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
09-23-2008 19:52
If I'm seeing right there's an else without an if.
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-23-2008 22:07
the else isn't needed at all
|
|
Dan Colville
Registered User
Join date: 28 Jul 2006
Posts: 26
|
09-24-2008 01:23
Thanks for all your help guys if anyone needs a play sound on move script this is it below.
integer target_id; vector target_pos; string move = "87d359b2-838d-20e6-bab2-c7b483d413e0"; default { state_entry() { target_pos = llGetPos(); target_id = llTarget(target_pos, 0.5); //define current avatar/prim position here llTarget(llGetPos(), 0.1); } at_target(integer tnum, vector targetpos, vector ourpos) { if (tnum == target_id) { llStopSound(); } } not_at_target() {llPlaySound(move, 5); llSleep(2.0); llTarget(llGetPos(), 0.1);} }
|