my lllisten doesnt seem to be listening ??
|
|
Bill Schmo
Registered User
Join date: 16 Aug 2006
Posts: 53
|
06-27-2007 18:16
ok simple right.. i thought so but have been denied, lol.. im just trying to get one child prim button to shout a phrase, that should trigger another seperate (Unlinked to the button) object to go phys.. sounded simple in my head.. heres my scripts. what did i foobar? cause im loseing it.. thx everyone [ CODE START ] /////////// // // =This script is inside a Ball that is rezzed by another object= // Object Script - makes an unlinked object (within 10m) change // its status when it hears "Triggered" message // /////////// integer CHANNEL = 555555; default { state_entry() { llSay(0, "ready to release"  ; llListen(CHANNEL, "", llGetOwner(), ""  ; } on_rez(integer start_param) { llResetScript(); } listen(integer CHANNEL, string name, key id, string message) { if (message == "Triggered"  { llSay(0, "Falling"  ; llSetStatus(STATUS_PHYSICS, TRUE); } } touch_start(integer total_number) { llSay(0, "hello"  ; } } [ CODE END ] ================================================================================ [ CODE START ] /////////// // Trigger Script // // =This script is inside of a child prim named Trigger, in a linked set that // also includes the rezzer for the Ball= // Trigger Script - when touched it should send the message "Triggered" to // the Ball // /////////// integer CHANNEL = 555555; default { state_entry() { llSay(0, "Trigger Script Running"  ; // just so i know its running } touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner()) { llSay(0, "Released"  ; // so i know the touch worked llShout(CHANNEL, "Triggered"  ; // shout just incase its over 10m } } } [ CODE END ]
|
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
06-27-2007 18:27
From: Bill Schmo llListen(CHANNEL, "", llGetOwner(), ""  ; Speaking object doesn't have the owner key. 
_____________________
 Seagel Neville 
|
|
Bill Schmo
Registered User
Join date: 16 Aug 2006
Posts: 53
|
06-27-2007 18:35
could u elaborate.. im still confused, lol.. or is this what u mean i should change [ CODE START ] /////////// // // =This script is inside a Ball that is rezzed by another object= // Object Script - makes an unlinked object (within 10m) change // its status when it hears "Triggered" message // /////////// integer CHANNEL = 555555; default { state_entry() { llSay(0, "ready to release"  ; llListen(CHANNEL, "", NULL_KEY, ""  ; // <------ THIS RIGHT? } on_rez(integer start_param) { llResetScript(); } listen(integer CHANNEL, string name, key id, string message) { if (message == "Triggered"  { llSay(0, "Falling"  ; llSetStatus(STATUS_PHYSICS, TRUE); } } touch_start(integer total_number) { llSay(0, "hello"  ; } } [ CODE END ]
|
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
06-27-2007 18:42
Yes. It should work, shouldn't it?
_____________________
 Seagel Neville 
|
|
Bill Schmo
Registered User
Join date: 16 Aug 2006
Posts: 53
|
06-27-2007 18:56
yeah that worked..Thx Seagel, i dont know how i missed the llgetowner, durrr.. now to play with it a bit.. I have a few more questions tho, b/c i want to get it so 2 of these things can be next to each other and not clash.. i was reading in the wiki about this.. i like the idea, and it will decrease pressure on the sim right? from: http://rpgstats.com/wiki/index.php?title=LlListen" For private channels across multiple objects use a deterministic equation that results in a unique value yet is repeatable. For example, base the channel on the integers contained in the owner's key. This way two users can both use their copies of the same object in close proximity without difficulty. " anyone have an example of this that i could look at b/c this sounds wayyyy over my head 
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
06-27-2007 19:05
something like...take the owner's key. convert it into a string. Take each letter in the string, convert it to a number (a=1, b=2 or whatever) and add them up.
An owner always gets the same result. The probability that two owners in the same sim will get the same result at the same time is very small/
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
06-27-2007 19:31
From: Lee Ponzu something like...take the owner's key. convert it into a string. Take each letter in the string, convert it to a number (a=1, b=2 or whatever) and add them up. Actually, since keys only use hexadecimal characters (other than the dashes), you can easily convert any 8-character section of a key (which doesn't include dashes) to a number by prepending "0x" and casting to integer. integer some_num = (integer)( "0x" + llGetSubString( llGetOwner(), 0, 7 ) ); The easiest sections of a standard key to use would be the first 8 (0-7) or any 8 out of the last 12 ( 24-31 - 28-35 )
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
06-27-2007 19:43
I think there's a simpler solution, though: As I understand it, the Trigger prim is in the object that rezzes the Balls. When it does that, it can pass an integer start_param to the Ball--a handy place to pass a randomly-chosen private channel for subsequent Ball-specific communications.
Incidentally, I suspect it may ultimately prove simpler to pull the scripts out of the individual Trigger prims and instead use llDetectedLink() in the root prim to figure out which Trigger was pressed.
|
|
Bill Schmo
Registered User
Join date: 16 Aug 2006
Posts: 53
|
06-27-2007 22:30
ok i followed Deannas lead and added the command she showed.. but i musta screwed up something b/c all commands are being casted in chat.. when touched it works but its also working another persons and i see the "Triggered" in chat.. and thank you all so much, im learning alot.. hope my brain will retain it all, lol ( only thing i changed was the "some_num" to "Owner_Chan"... ) [ CODE START ] /////////// // // =This script is inside a Ball that is rezzed by another object= // Object Script - makes an unlinked object (within 10m) change // its status when it hears "Triggered" message // /////////// integer Owner_Chan; default { state_entry() { llSay(0, "ready to release"  ; llListen(Owner_Chan, "", NULL_KEY, ""  ; integer Owner_Chan = (integer)( "0x" + llGetSubString( llGetOwner(), 0, 7 ) ); } on_rez(integer start_param) { llResetScript(); } listen(integer Owner_Chan, string name, key id, string message) { if (message == "Triggered"  { llSay(0, "Falling"  ; llSetStatus(STATUS_PHYSICS, TRUE); } } touch_start(integer total_number) { llSay(0, "hello"  ; } } [ CODE END ] ================================================== ============================== [ CODE START ] /////////// // Trigger Script // // =This script is inside of a child prim named Trigger, in a linked set that // also includes the rezzer for the Ball= // Trigger Script - when touched it should send the message "Triggered" to // the Ball // /////////// integer Owner_Chan; default { state_entry() { llSay(0, "Trigger Script Running"  ; // just so i know its running llListen(Owner_Chan, "", NULL_KEY, ""  ; integer Owner_Chan = (integer)( "0x" + llGetSubString( llGetOwner(), 0, 7 ) ); } touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner()) { llSay(0, "Released"  ; // so i know the touch worked llShout(Owner_Chan, "Triggered"  ; // shout just incase its over 10m } } } [ CODE END ]
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
06-28-2007 00:24
Both in the Ball and the Trigger, it uses Owner_Chan in the llListen() before it computes it, so, as an uninitialized variable, it's channel 0 (open chat). [Edit: Oh, actually, that's just half the problem: Owner_Chan is meant to be a global variable, and it's declared top-level, but then it's *redeclared* as a local variable each time. So, wherever the script is *assigning* a value to it, it shouldn't have "integer" in front of it, cuz then it's a local variable, not the one shared with other parts of the script.]
But... aren't all the Balls going to belong to the same Owner anyway, so won't Owner_Chan always compute to the same value for all the Balls? (Or will there be several Owners, each with just one Trigger and one Ball?)
|
|
Bill Schmo
Registered User
Join date: 16 Aug 2006
Posts: 53
|
06-28-2007 10:51
i think i might just be having trouble wraping my head around this.. look above still what i got. integer Owner_Chan = (integer)( "0x" + llGetSubString( llGetOwner(), 0, 7 ) );
is this the way to generate a channel for all the commands that comes from the owners uuid?
i want each script to generate the channel itself, so it will be diffrent for everyone, but the same in each set. b/c with the llgetowner() the object still will release if someone next to it triggers the release on his
basicly if: Jimmy owns this object, scripts all get a channel from his uuid. ball will only drop if message is sent on his uuid generated channel.
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
06-28-2007 13:43
OK, so it really is that all the Balls owned by the same person are to be controlled as one, so the hash on owner key should be workable. And the calculation of the hash looks right (though I haven't tested it).
The problems with the script are that, first, there's an llListen() on Owner_Chan BEFORE it sets the value of Owner_Chan, and second, it sets the value of a LOCAL Owner_Chan variable, not the global one declared at top-level of the script.
To fix the first problem, where there's "llListen(Owner_Chan..." followed by "integer Owner_Chan=...", those statements need to be swapped. These occur in the state_entry handlers of both Ball and Trigger.
To fix the second problem, in those "integer Owner_Chan=..." statements, the word "integer" must be omitted so the assignment can apply to the variable at global scope, rather than a local one that is being declared in that statement.
Oh... maybe a third problem: the script should llResetScript() in the on_rez handler of the trigger object, as it does for the Ball. Otherwise, when a new owner rezzes the trigger object, it will still be using the old Owner_Chan. (Ideally, this instead should go in a changed() CHANGED_OWNER handler, but unless these will be sold as originals, it shouldn't matter.)
(Personally, since the trigger object rezzes the balls itself, I'd still do it with a random channel passed to the ball on rez, or change the messaging to include the key of the recipient known from the object_rez event. But never mind, because getting the owner key hash working should be easier at this point.)
|
|
Bill Schmo
Registered User
Join date: 16 Aug 2006
Posts: 53
|
06-29-2007 11:26
just wanted to let you know its working great now.. I think.. a little more testing and it should be good to go.. thank you all so much for the input. this scripting stuff is all still pretty new to me and I dont think I will every be good enough to help like you guys do, but I hope i will be one day, lol
Thanx again, Bill
|