|
Annetha Christensen
Registered User
Join date: 27 Dec 2005
Posts: 17
|
05-01-2006 23:08
I am writing a script for privacy windows. I need the windows to go from opaque to 2% opaque. This should happen only when the owner clicks on the window. I wrote a script, but i am doing something wrong. It will compile, but it does not work. Before I added the part to identify the owner it worked fine, but now it does not work at all not even for the owner. The script I wrote is below. Please help! Thanks key gfOwnerKey; gmInitFields() { gfOwnerKey = llGetOwner(); return; } default { state_entry() { gmInitFields(); llListen(0, "", "", ""  ; } listen(integer channel, string name, key id, string msg) { string operName; string ownerName; operName = llKey2Name(id); ownerName = llKey2Name(gfOwnerKey); if (ownerName != operName) { return; } else { state one; } } } state one { state_entry() { llSetAlpha(1, ALL_SIDES); } touch_start(integer total_number) { state two; } } state two { state_entry() { llSetAlpha(0.2, ALL_SIDES); } touch_start(integer total_number) { state default; } } It looks like the copy/paste removed all of the tabs. It is not written straight down the left side.
|
|
Champie Jack
Registered User
Join date: 6 Dec 2003
Posts: 1,156
|
05-01-2006 23:30
From: Annetha Christensen I am writing a script for privacy windows. I need the windows to go from opaque to 2% opaque. This should happen only when the owner clicks on the window. I wrote a script, but i am doing something wrong. It will compile, but it does not work. Before I added the part to identify the owner it worked fine, but now it does not work at all not even for the owner. The script I wrote is below. Please help! Thanks key gfOwnerKey; gmInitFields() { gfOwnerKey = llGetOwner(); return; } default { state_entry() { gmInitFields(); llListen(0, "", "", ""  ; } listen(integer channel, string name, key id, string msg) { string operName; string ownerName; operName = llKey2Name(id); ownerName = llKey2Name(gfOwnerKey); if (ownerName != operName) { return; } else { state one; } } } state one { state_entry() { llSetAlpha(1, ALL_SIDES); } touch_start(integer total_number) { state two; } } state two { state_entry() { llSetAlpha(0.2, ALL_SIDES); } touch_start(integer total_number) { state default; } } It looks like the copy/paste removed all of the tabs. It is not written straight down the left side. ok, a few problems here. First, I applaud your use of states. They arent great for everything, but they will prove to be a useful tool for some things you may try. Second, you mentioned that the windows will be touch controlled. If that is the case, you don't need the listen. anyway..here is the revised script: default { state_entry() { state one; } } state one { state_entry() { llSetAlpha(1.0, ALL_SIDES); } touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner()) { state two; } } } state two { state_entry() { llSetAlpha(0.2, ALL_SIDES); } touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner()) { state one; } } }
|
|
Annetha Christensen
Registered User
Join date: 27 Dec 2005
Posts: 17
|
Much thanks
05-01-2006 23:38
Thank you so much for your help. I will try it out right away. And thanks again!
|
|
Champie Jack
Registered User
Join date: 6 Dec 2003
Posts: 1,156
|
05-01-2006 23:46
oh no! hold on! I changed the script just a moment ago.. the changes allow it to be more portable. If you sell it or give it away it will work for the new owner no problem.
|
|
Annetha Christensen
Registered User
Join date: 27 Dec 2005
Posts: 17
|
Thanks again!
05-01-2006 23:58
Thank you so much. It looks like a much cleaner script then what I was trying to do. Once again checking it at once.
|