Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Communication problems with scripts

Angelina Sinclair
Registered User
Join date: 4 Nov 2006
Posts: 34
04-28-2009 10:18
So I'm working on a hud that pretty does what these weapon gestures do. As some of you know when you go out and buy a weapon they would have gestures that usually are along the lines of:

/1 draw

/5 draw

/1 sheath

/5 sling



So on and such forth. Well the hud I'm working on would have it where you just click a button, and that same message is put out (/1 draw). And by logical thinking, your weapon should be drawn by the click of a button.

Apparently.. it doesn't work at all. The channel is right, the text is right but the weapon doesn't draw. So after busting my brains out about this I think it has to do with how the weapon makers script thier listens.

I'm assuming they have something like: llListen(5,"",llGetOwner(),"";);

Which if I'm right filters all the messages heard on channel 5 to just the owner. So a hud talking on that channel will get ignored.

But I've witnessed a way around this where a HUD is able to listen from a object and a owner. Yet if two people where wearing the same HUD, they won't cross communicate with each other.

So I'm like missing something to this. Anyone got any suggestions? Hopefully everything I said makes sense...
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
04-28-2009 10:25
You're making just the HUD or do you have access to the weapons scripts? If you just have access to your own HUD script, you're out of luck unless the weapon scripter tells you some way around the problem..
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
04-28-2009 10:31
Use llDialog, that forces your avatar to speak on that channel what is in the button. So if the command is /1 draw.. use llDialog to make the drop down handy dandy blue menu, and a button that says draw.. your avatar will then speak on the channel defined in the llDialog and say draw. That is how you get around those types of things, if you consider having a drop down menu getting around it :)
Angelina Sinclair
Registered User
Join date: 4 Nov 2006
Posts: 34
04-28-2009 12:40
llDialog is a good idea, but I was wanting to have more buttons created that do this. I'm just wondering if there's a way around it, a way to let the weapons know "Hey.. the owner clicked me to tell you to draw."
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
04-28-2009 13:42
The way that scripts get around this is by having an open-keyed listen, and checking the key of the speaker. This exploits the fact that if llGetOwnerKey() is run on an avatar, it returns the key of the avatar - we all own ourselves, despite what Goreans might say.

Thus

...

llListen(11, "", NULL_KEY, "";);

...

listen(integer c, string name, key id, string msg) {
if (llGetOwnerKey(id) != llGetOwner()) return; // neither me, nor an object owned by me
// otherwise, do things
}

...
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Angelina Sinclair
Registered User
Join date: 4 Nov 2006
Posts: 34
04-28-2009 15:10
That explains how they got around that, which is quiet interesting. Now I just need to see if there's a way to do this in reverse and find a way around the listen's filters.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
04-28-2009 15:17
If there is an existing listen which you cannot affect and which is tied to a key - no, you cannot, I'm afraid.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-28-2009 16:25
yup, gotta modify the receiver script.... and the only bindings that gestures understand are hotkeys and avatar speech. you could talk to the creator and have them modify the original for you, some might even do for free since it's a useful upgrade they can include with their regular products. (although some may decline for general products since sims tend to handle filtering faster than scripts do IIRC and will up script time/size for the product though not significantly for uncommon channels IMO)
_____________________
|
| . "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...
| -