state change
|
GuanPeng Woodrunner
Registered User
Join date: 12 Jul 2009
Posts: 11
|
09-05-2009 08:00
is there a way to animate my items to change in accordance to solid liquid gas. meaning, for 20 secs, my container containing particles will change its state. so, first 20 sec, it will be solid and the next 20 sec it will be liquid and the next 20 sec after that, it will be gas and the cycle repeats forever. Thanks a lot! I'm a newbie in Second Life and desperately needs help. 
|
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
|
09-05-2009 08:22
Well since state is a consequence of energy, just animate them more for a gas than for a liquid 
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-05-2009 08:28
you don't want to use a state change for that, probably a timer something like integer render = 1; default { state_entry() { llSetTimerEvent(20.0); }
timer() { if(render)//if render is "TRUE" { llParticleSystem([ //PARTICLE SYSTEM PARAMS ]); } else//otherwise render is "FALSE" { llParticleSystem([]);//use an empty particle system call to turn off the particles } render = !render//switches render between TRUE/FALSE so the if test will get an opposite result on each timer event, which allows the particles to switch on and off } }
|
Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
|
09-05-2009 08:31
I would create a script to put in the container that would change states for each different state of the element. And for each state change I would rez a prim dead center of the container. Each prim rezzed would represent the state of the element. For gas, I would rez a prim that has a particle script representing gas. For liquid and solid, I would rez a prim that looks exactly like the element in that state. So I would first create the container. And then create a version of your element for each state so that it would fit in your container. And finally, create the script to go in your container to rez your elements. 
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-05-2009 08:42
you can use the particle system in the prim that looks like the solid gas, use a timer event to switch between the looks, something like: integer OnOff = 1; default { state_entry() { llSetTimerEvent(20.0) }
timer() { if(OnOff) { llParticleSystem([ //gas particle params ]); llSetAlpha(0.0)//makes the prim invisible } else { llParticleSystem([]);//empty particle function turns them off llSetAlpha(1.0);//makes the prim visible } OnOff = !OnOff; } }
|
GuanPeng Woodrunner
Registered User
Join date: 12 Jul 2009
Posts: 11
|
09-05-2009 09:23
thanks everybody! I now have a problem. I need to count for 20 seconds before exiting the state. This means that I need a llSetTimerEvent, but then how to I incorporate it together with the state_exit method?
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-05-2009 10:42
From: GuanPeng Woodrunner thanks everybody! I now have a problem. I need to count for 20 seconds before exiting the state. This means that I need a llSetTimerEvent, but then how to I incorporate it together with the state_exit method? sounds like you're doing more than just the switch between liquid and vapor, what are you changing states for?
|
Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
|
09-05-2009 10:48
From: GuanPeng Woodrunner thanks everybody! I now have a problem. I need to count for 20 seconds before exiting the state. This means that I need a llSetTimerEvent, but then how to I incorporate it together with the state_exit method? Include a timer in your state to exit to wherever you want to go to. Sorta like this:
state GAS { state_entry() { llSetTimerEvent(20.0); }
timer() { state LIQUID; } }
state LIQUID { state_entry() { llSetTimerEvent(20.0); }
timer() { state SOLID; } }
state SOLID { state_entry() { llSetTimerEvent(20.0); }
timer() { state GAS; } }
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-05-2009 10:51
aah, ok, i missread the first post, thought you were switching between liquid and vapor, but how are you doing the "liquid" form?
|
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
|
09-05-2009 11:08
From: GuanPeng Woodrunner This means that I need a llSetTimerEvent, but then how to I incorporate it together with the state_exit method? Change the script state in the timer event. The change of state will automtically trigger the state_exit event for the current state.
|
Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
|
09-05-2009 11:51
Here's something that might work for you. There are 2 scripts: one to go into your container and the other to go into your objects;
// Rez Script - Will Rez Objects at Center of Root Prim (Container?)
integer num = 0; integer channel; // Comm. Channel to DeRez Object - Same as DeRez Script Channel. string GAS1; //Name of Gas Object string LIQUID1; // Name of Liquid Object string SOLID1; // Name of Solid Object
RezGAS() // Rez Gas Object { llRezAtRoot((GAS1),(llGetPos()+(<0,0,0>)*llGetRot()),<0,0,0>,llEuler2Rot(<0, 0, 0>*DEG_TO_RAD)*llGetRot(),num); }
RezLIQUID() // Rez Liquid Object { llRezAtRoot((LIQUID1),(llGetPos()+(<0,0,0>)*llGetRot()),<0,0,0>,llEuler2Rot(<0, 0, 0>*DEG_TO_RAD)*llGetRot(),num); } RezSOLID() //Rez Solid Object { llRezAtRoot((SOLID1),(llGetPos()+(<0,0,0>)*llGetRot()),<0,0,0>,llEuler2Rot(<0, 0, 0>*DEG_TO_RAD)*llGetRot(),num); } DeRez() //DeRez Previously Rezzed Object Before Rezzing a New Object { llWhisper(channel,((string)num)); }
default { state_entry() { state GAS; }
}
state GAS { state_entry() { DeRez(); RezGAS(); llSetTimerEvent(20.0); } timer() { state LIQUID; } }
state LIQUID { state_entry() { DeRez(); RezLIQUID(); llSetTimerEvent(20.0); } timer() { state SOLID; } }
state SOLID { state_entry() { DeRez(); RezSOLID(); llSetTimerEvent(20.0); } timer() { state GAS; } }
// DeRez Script
// Drop a Copy of this Script Into Each Object You Plan to Rez so that it can be DeRezzed.
integer thekey; integer listencontrol; integer channel; //Comm. Channel to DeRez Object - Same as Rez Script Channel
default { state_entry() { llSetStatus(STATUS_PHANTOM, TRUE); llSetStatus(PRIM_TEMP_ON_REZ, TRUE); listencontrol = llListen(channel,"","",((string)thekey) ); } listen( integer channel, string name, key id, string msg) { llListenRemove(listencontrol); llDie(); } }
|
GuanPeng Woodrunner
Registered User
Join date: 12 Jul 2009
Posts: 11
|
09-06-2009 12:54
Hey Zena, there's something wrong with your code and I can't seem to figure out...
|
Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
|
09-06-2009 14:33
From: GuanPeng Woodrunner Hey Zena, there's something wrong with your code and I can't seem to figure out... What kind of problem are you having? Make sure you only use what is between ... . Also don't forget to include your object names: string GAS = "ObjectGas"; string LIQUID = "ObjectLiquid"; string SOLID = "ObjectSolid"; 
|
Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
|
09-06-2009 15:18
I went back thru the code and made a couple of edits in both scripts. Always bound to be something out of whack when I type instead of copy/paste... lol Try them again. And don't forget a channel too! 
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
09-07-2009 04:05
it helps to add whitespace between operators and function arguments, else the forum software likes to insert it for you (and never in a useful spot) 
_____________________
| | . "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... | - 
|