|
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
|
01-13-2008 17:11
===== integers ===== float volume=1; vector moving; integer start; integer fwd; ======== sound loops ======== sounds() { moving=llGetVel(); float total = llVecMag(moving); if ((total = 0 && start == TRUE)) { llLoopSound("Ducati Idle",volume - 0.5); } else if (total < 3) { llLoopSound("D0",volume); } else if (total < 6) { llLoopSound("D1",volume); } else if (total < 9) { llLoopSound("D2",volume); } else if (total < 12) { llLoopSound("D3",volume); } else if (total < 15) { llLoopSound("D4",volume); } else if (total < 18) { llLoopSound("D5",volume); } else if (total > 17) { llLoopSound("D6",volume); } } // Stuff along with llSetTimerEvent(.1); ======= listen event ======= listen(integer channel, string name, key id, string message) { if(message == "on") { llLoopSound("Ducati Idle",1); llSetStatus(STATUS_PHYSICS, TRUE); llMessageLinked(LINK_SET, 0, "start", ""); start = TRUE; } else if(message == "off") { llSetStatus(STATUS_PHYSICS, FALSE); llMessageLinked(LINK_SET, 0, "stop", ""); start = FALSE; llStopSound(); } // control stuff ==== timer ==== timer() { fwd = FALSE; sounds(); } }
and now to my problem... i have it set up so it will check the jetskis speed every .1 second, not sure if that may be the problem but for some reason weather the jetski is running or not it has some kind of sound and it wont shut off till i reset the script and preeload all the sounds again, it basicly is allways on and refuses to shut off, this is the only things i have soundwise that are in the jetski can anyone spot my messup if any?
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-13-2008 17:56
for starters if ((total = 0 && start == TRUE)) should be if ((total == 0 && start == TRUE))
and it's not going to shut off because you never clear loopsound
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
|
01-13-2008 18:24
oops that might have did it xD
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-13-2008 19:10
repeat after me, when writing if statments, stick the variable LAST to avoid erros like this, constants FIRST...
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
|
What Void wanted to say:
01-13-2008 23:49
if ((total = 0 && start == TRUE))
will work, though not work as expected.
if ((0 = total && TRUE == start))
would have given you an error right away. Because you cannot assign a variable to a value.
Correct it to
if ((0 == total && TRUE == start))
and there will be much rejoicing
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-13-2008 23:58
lol point squirrel, getting the error on bad logical operators is what you want.. and it won't happen unless you reverse the positions putting the variable on the back end (Mrc has given us lots of these, but hey it is a common mistake so at least it's staying visible for new people)
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
|
01-14-2008 04:14
To make it clear:
a = 1; // You are asigning the value '1' to 'a'.
a == 1; //You are comparing the value '1' with the value stored in 'a'.
---
Another tip if you want to have smaller if sentences:
you can replace "if (a == TRUE)" by "if (a)"
you can replace "if(a == FALSE)" by "if (!a)"
---
About your script I see a listen() event but no llListen() function triggering it so your script is not listening. neither you have a llSetTimerEvent(). I suppose you just didn't put that part of the script here, but maybe there are mistakes there.
|
|
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
|
01-14-2008 12:53
i also found out part of the problem was i forgot to mess with the eventtimer, it would turn on but i didnt put in llSetTimerEvent(0) xD
|