|
Prano Quan
Registered User
Join date: 15 Aug 2008
Posts: 29
|
07-11-2009 00:19
Please see: http://riverfrog.blogspot.com/Thank you for your time!
|
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
07-11-2009 00:20
I quite agree.
_____________________
-
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
-
|
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
07-11-2009 02:22
Lack of personal success is well compensated by other peoples misfortune  (I don't have anybody present in mind, so don't take it personal)
_____________________
From Studio Dora
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
07-11-2009 02:48
It looks like Prano ran into one of the many forum filter bugs. I added a space to the vector in the timer event so that it will post. default { state_entry() { for(t = 0; t < 4; t++) { llSay(0,"This object will move to the right every 3 seconds."); //Comment for Object behaviour llListen(0,"", NULL_KEY, ""); //Introduce variables } listen(integer channel, string name, key id, string message) //Take in variables { if (message == "play firewall") //Listen to sentence "play firewall" { llSetTimerEvent(3); } } timer() { llSetPos(llGetPos() -< 1,0,0>); } } // End of for loop }
... and I can point out few things that won't work, but I'm afraid that it's not really clear yet what you want the script to do. What is it that you want to have happen four times? Right now the listen and timer handlers are inside state_entry, that won't work. Each event handler has to stand on its own, you can't nest them like that. You really won't want to start up llListen like that four times either, once it's set it's set and the listen event will catch each chat line and start up the listen handler until you remove the listener. And that's where I get lost. Your timer looks like it's going to move the object a meter at a time forever, is that the part you wanted to have happen four times?
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
07-11-2009 04:30
/me boggles first, events (like listen and timer) cannot go inside of other events. the {} brackets enclose events (and states, and loops, etc) think of it as boxes... with 3 sizes... states (default is a state) are big boxes, and are only allowed to contain medium boxes.... which are events (like state entry, listen, and timer). events boxes are only allowed to contain code and little boxes (anything that is not a state or an event but uses {}'s like your for statement ) little boxes cannot contain big or medium boxes, but they can contain other little boxes. so your structure should look like this big_box{ -med box{ --code --little box{ ---code --}// end of little box -}// end of med box - -another med box{ --code -}//-- end of another med box }//-- end of big box your code (which I assume move your object 1m east once every 3 seconds f times total) should look like this... default{ state_entry(){ llListen( 0, "", NULL_KEY, "" ); } //-- End of state_entry event
listen(integer channel, string name, key id, string message){ if ("play firewall" == message){ llSay(0,"This object will move to the right every 3 seconds." ; integer t; for(t = 0; t < 4; t++){ llSleep( 3.0 ); llSetPos( llGetPos() - < 1, 0, 0 > ; } //-- End of for loop } //-- End of if test } //-- End of Listen event } //-- End of Default State
or if you want to use a timer loop integer t;
default{ state_entry(){ llListen( 0, "", NULL_KEY, "" ); } //-- End of state_entry event
listen(integer channel, string name, key id, string message){ if ("play firewall" == message){ llSay(0,"This object will move to the right every 3 seconds." ; llSetTimerEvent( 3.0 ); } //-- End of if test } //-- End of Listen event
timer(){ if (++t < 5){ llSetPos( llGetPos() - < 1, 0, 0 > ; } //-- End of if test else{ t = 0; llSetTimerEvent( 0.0 ); } //-- End of else test } //-- End of timer event } //-- End of Default State
_____________________
| | . "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... | - 
|
|
Prano Quan
Registered User
Join date: 15 Aug 2008
Posts: 29
|
07-12-2009 23:26
@Viktoria Dovgal: Yes, I couldn't figure out why the forum isn't allowing me to post the codes... thank you for figuring it out. Also, I apologize for not making myself clear. The outcome of this program actually needs to look like this:
-Object Firewall Perfect State- (meaning: I'm still working on it :--( ) 1. Visitor comes close to the Firewall 2. Firewall gives notecard to visitor to let them know what it is (how it works, what it can do, etc) 3. User types keyword "play firewall" --- At this point, program (Object moving) should start running --- 4. Object move to firewall in increments of 3 seconds (the aim of 3 seconds is so that the users will see it moving slowly) 5. Object stops. 6. Object moves back to PC (Sender), then sends a notecard to visitor giving reason why it cannot continue to move --- End of program ---
-What I have right now- 1. Visitor comes close to the Firewall 2. Firewall gives notecard to visitor to let them know what it is (how it works, what it can do, etc) 3. User types keyword "play firewall" --- At this point, program (Object moving) should start running --- 4. Object move to firewall in increments of 3 seconds (the aim of 3 seconds is so that the users will see it moving slowly) 5. Object DOESN't STOP YET!!! (trying for loops, hence the t < 4 seconds) 6. Object moves back to PC (Sender), then sends a notecard to visitor giving reason why it cannot continue to move (still working out the kinks to this problem) --- End of program ---
PS: t < 4, means, I want the program "object move 1 m to the right in every 3 seconds to stop before fourth second" The idea is a little silly... I was trying to make a timer() within a timer(), the first timer will run so that the program will only loop before fourth second, the second timer belongs to TimerEvent which is connected to the llSetPos program to make the ball moving. You're correct Viktoria, my object is moving forever, and I'm trying to find a way to loop the program/stop the script from running, I've been to the help island and unfortunately, they only advised me on "Well, just take the item back to your inventory... Umm, how could put comments on the Timer??" What i want is a program script to loop/stop the moving script from moving.. I tried for loop but it gave me error and hence my shout for help. Sorry for the confusion, I didn't mean to confuse you...
@Void Singer: Thanks for your help so much!!!! The understanding of how programming works... .. I hope I can connect it with my brain to the idea I'm working on right now.. Cheers
|