Syntax Error, simple help please?
|
|
Thunder Starbrook
Registered User
Join date: 25 Dec 2006
Posts: 98
|
06-08-2007 09:47
I'm trying to make a simple script that plays a sound and changes the prim colour when clicked, looks so easy but i keep getting errors, can somone give me a little assistance please? default { state_entry() { llSay(0, "HeavyBass"  ; llPlaySound ("HeavyBass",1.0); llSetColor(<0,255,0>, ALL_SIDES); llSleep(2.00); llSetColor(<255,0,0>, ALL_SIDES); } touch_start(integer total_number) } Thanks 
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
06-08-2007 09:52
1) Color values are 0.0 to 1.0, not 0 to 255, so full green would be <0.0,1.0,0.0>, not <0,255,0>. 2) You are missing a closing } at the very end to close out the default state statement block. 3) You are missing an opening { after touch_start(integer total_number). 4) All the code inside of the state_entry() {} block needs to be moved to the touch_start{} block.
|
|
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
|
06-08-2007 09:53
Maybe this is what you want: default { touch_start(integer total_number) { llSay(0, "HeavyBass"  ; llPlaySound ("HeavyBass",1.0); llSetColor(<0,255,0>, ALL_SIDES); llSleep(2.00); llSetColor(<255,0,0>, ALL_SIDES); } }
|
|
Dopel Dollinger
Registered User
Join date: 25 May 2007
Posts: 14
|
06-08-2007 09:54
missing curly brace.
touch_start(integer total_number) { }
|
|
Thunder Starbrook
Registered User
Join date: 25 Dec 2006
Posts: 98
|
06-08-2007 10:01
Thanks guys, i'm still having trouble though, i did have this working at one point but with one click to start the music and a second click to stop it but i didnt like it  Now i just dont understand whats wrong. Now nothing happens when i click. default { state_entry() { } touch_start(integer total_number) { llSay(0, "HeavyBass"  ; llPlaySound ("HeavyBass",1.0); llSetColor(<0,255,0>, ALL_SIDES); llSleep(2.00); llSetColor(<255,0,0>, ALL_SIDES); } }
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
06-08-2007 10:09
That code you have posted there will work perfectly for what you stated you wanted it to do, so you have another problem. Is the script running? (check the Running checkbox at the bottom of the script edit window) Are there other scripts in the object (like in other prims that you are clicking on) which also have touch_start events? Are scripts disabled on the land you are building on (and you're not the owner, or in the land group)?
|
|
Jake Trenchard
Registered User
Join date: 31 May 2007
Posts: 104
|
06-08-2007 10:11
With that code you should at least see the llSay when you touch. Is the 'Running' box checked on the script?
Certain errors stop a script and uncheck that box.
Are you working in an area that is set noscript?
Your colors are still wrong, those 255 entries should be 1.0 .
|
|
Thunder Starbrook
Registered User
Join date: 25 Dec 2006
Posts: 98
|
06-08-2007 10:12
Wow who would have thought several hours of pulling my hair out could have been solved by clicking the 'running' box!!
Thankyou very much, feels like i've learnt a valuable lesson!
The colours seem to be working fine as they are, guess there's more than one way to do it?
|
|
Jim Guyot
Tinkerer
Join date: 21 Apr 2007
Posts: 38
|
06-08-2007 14:15
Well, the parser just changes values larger than 1.0 to 1.0. You will have difficulty if you use smaller numbers in there, like <64,192,64> which SL will out put as <1.0,1.0,1.0> which is pure white.
|