destruction and creation
|
|
Natsely Amaterasu
Registered User
Join date: 30 Sep 2008
Posts: 19
|
09-30-2008 16:05
Hi everyone,
Is it possible to make a certain area that can detect certain prym combinations when touched. Then if a certain combination is there it destroys the pryms and creates a new prym. The reason I'm asking is that I want to make an interactive dish that people can put in say...two hydrogen atom pryms and one oxygen atom prym, when they touch the dish it detects that combination and destroys the prym and makes a new prym in the shape of H20. Its kinda like the starcraft map editor (if anyone knows what I'm talking about). Any help would be loved.
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
09-30-2008 16:19
Yep. In broad outline, the objects themselves have to be scripted to call llDie() when the dish tells them to self-destruct. The dish could use llSensor() to scan for nearby scripted prims, and something like llRezAtRoot() to create a new object in-world from "molecule" objects contained in its inventory.
I think a slightly better alternative to the llSensor() would be for the dish to just communicate with the "atom" prims, llSay()ing and llListen()ing on a known channel, asking them to report which ones are in play. This may be slightly simpler, because much the same inter-object communications will be needed for the self-destruct command anyway.
|
|
Natsely Amaterasu
Registered User
Join date: 30 Sep 2008
Posts: 19
|
09-30-2008 17:36
would it be able to tell apart H2O2 from H20 when the player touches it. And how does llSay and llListen work?
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
10-01-2008 06:36
A script could certainly tell the difference between, on the one hand, having two H atoms and an O, and on the other, two of each. But I'm not sure what "chemistry" this dish should be able to perform. For example, if two of each, should it make hydrogen peroxide, or should it make H2O and leave an O behind, or should it just do nothing unless it sees exactly two Hs and an O? (I have a queasy feeling that the "chemistry" rules could get arbitrarily complex here... and I'm starting to yearn for a forward-chaining production system, written in LSL.  ) For an intro to llListen and llSay, see: http://wiki.secondlife.com/wiki/LlListenand http://wiki.secondlife.com/wiki/LlSayrespectively. In general, they just provide a means for rezzed-in-world scripted objects to communicate with each other over distances up to 20m. (llWhisper does the same as llSay, but only in a 10m range--which may be enough in this application; for longer ranges, there's llShout and llRegionSay.)
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
10-01-2008 09:02
I might be wrong, but I bet there are a lot of "chemistry engines" already out there that figure out what reaction might occur based on a blowl of atoms and molecules. Chemists feel free to way in here.
Therefore, one way to do this would be for the atoms and molecules to announce themselves to the bowl, then the bowl sends an http query to some external chemistry engine, get the result, tell the stuff in the bowl to die, and then construct the results.
When you get this working, please make me some LSD.
_____________________
So many monkeys, so little Shakespeare.
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
Simpler answer...
10-01-2008 09:04
If all you want is for two H and an O to turn into an H_2O, it would be easy to hardwire a script to do that.
I would be willing to do a rough draft. It might be all you need.
_____________________
So many monkeys, so little Shakespeare.
|
|
Scott Savira
Not Scott Saliva
Join date: 10 Aug 2008
Posts: 357
|
10-01-2008 09:42
Building a chemistry model would be really interesting. Even more so, taking into account the characteristics of various chemicals would be fun. I'm not sure how in-depth you could get with LSL though, and you'd have to have a pretty good head for chemistry if you wanted to get detailed.
|
|
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
|
10-01-2008 11:38
I'm not sure I'm comfortable with people messing around with sub-molecular particles in SL.
Sure, right now you just want to combine Hydrogen and Oxygen, but we all know that you'll slowly but surely work you way up to smashing megaprim hadrons together, and then where will we be? Strange particles, exotic radiation, black hole in Ahern? Boom! SL gone.
Bad scientist! No cookie!
|
|
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
|
10-02-2008 00:45
From: Ben Bacon I'm not sure I'm comfortable with people messing around with sub-molecular particles in SL. Any one interested in joining our project to build a 750 Sim micro prim accelerator. We hope to recreate the first few micro seconds of DeBoom Sim and detect the elusive Rosedale particle 
|
|
Natsely Amaterasu
Registered User
Join date: 30 Sep 2008
Posts: 19
|
10-02-2008 11:44
Well, I am planning to start with h20 and then making some others, but I am defently NOT working to make every combination known to man. How would a simple (for a lack of a better term) script look. (Learning as I go)
|
|
bobbyb30 Swashbuckler
Registered User
Join date: 8 Sep 2008
Posts: 46
|
10-02-2008 16:55
It's very possible. You simply need to detect which prims were touched...associate them with a particular element. Then arrange them in a certain combination that would be stored in a notecard. If you are still interested, please IM me ingame...though do note that I won't be on until Monday.
|
|
Natsely Amaterasu
Registered User
Join date: 30 Sep 2008
Posts: 19
|
10-02-2008 18:24
anyone have a script i can fool around with?
|
|
Natsely Amaterasu
Registered User
Join date: 30 Sep 2008
Posts: 19
|
10-04-2008 15:59
Ok, this is the code I have made so far. This first one is for the dish. I need some help for the rezzing of the atom that I want to create and I don't know how to make it and where. [START] integer listen_handle; integer hydro = 0; integer oxy = 0; default { touch_start(integer total_number) { llWhisper(-533, "Hydrogen" ); llWhisper(-533, "Oxygen" ); } state_entry() { listen_handle = llListen(-533, "", "Hydrogen", ""  ; llWhisper(-533, "Hydrogen"  ; listen_handle = llListen(-533, "", "Oxygen", ""  ; llWhisper(-533, "Oxygen"  ; } listen ( integer channel, string name, key id, string message ) { if ( message == "Hydrogen" ) { ++hydro; } if ( message == "Oxygen" ) { ++oxy; } } if (( hydro == 2) && (oxy == 1)) { llWhisper( 0, "You made water" ); } else if ((hydro != 2) && (oxy != 1)) { llWhisper( 0, "This Many elements make nothing"  ; } } [END] I know that how the if's at the end are right now won't work but I did get it to tell me that i made water but it also told me the else answer. This one is the atom code. I don't know if there is any room for improvement, so anyone that has any ways to make it better is welcomed. [START] integer listen_handle; default { state_entry() { listen_handle = llListen(-533, "", "Oxygen", ""  ; } listen ( integer channel, string name, key id, string message ) { if ( message == "Oxygen" ) { listen_handle = llListen(-533, "", "Oxygen", ""  ; llWhisper(-533, "Oxygen"  ; llDie(); } } } [END] Simple and to the point. This is for my oxygen atom (duh). Any help is (again) much apreciated.
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
10-04-2008 18:00
A couple of suggestions. First, the listen() event will trigger each time any message comes in on the channel, so when you poll the elements, every time one of them reports, the script will run that "if" statement. An alternative might be to llSetTimerEvent() there instead, and then in the corresponding timer() handler test the counts, and clear the timer with llSetTimerEvent(0). Another thing that may make it simpler to expand is to just use the names of the objects to know if you have Hydrogen or Oxygen or whatever. The atom script could report llGetObjectName(), but even simpler, the dish listen() can just use that "string name" parameter to know what kind of atom sent the message. Anyway, the idea is that every kind of atom can contain the very same script, and only differ by what they're named. Oh, and yeah, the "else if" condition is probably not what you want. As is, it's testing for both inequalities being true at the same time, so it won't say anything if for example there's one oxygen and one hydrogen because "  oxy != 1)" won't be true. Probably you want "||" instead of "&&"--but in this case, that's equivalent to just "else" of the "if" condition.
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
10-04-2008 19:46
I have a working prototype. You can visit it at
Sarafina/233/161/300
it is the Glass tank sitting in the corner of my lab.
Click on it for a menu. The rest is pretty obvious.
Call it the SL Small Prim Micro-Collider.
_____________________
So many monkeys, so little Shakespeare.
|
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
10-06-2008 14:42
ooh that sounds like a pretty cool idea, you could probably use the same idea for making magic potions lol
|