Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need Script

Pontias Peck
Registered User
Join date: 30 Mar 2006
Posts: 8
06-27-2006 12:49
I am in the process of learning scripting. Learning where and when and how things go into a certain order is not as easy as it looks.

I am looking for a set of scripts.

I am building a HUD that an avatar will attach, then one they click a button, it will send a chat message on a channel to a linked object with prims that have listen scripts. These scripts will cut the prim on or off (alpha) or start a particle effect.

If someone could point me in the right direction, or if they are willing to work with me I am willing to pay.

Thank You,

Pontias Peck
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
06-27-2006 12:59
That should be pretty simple to do. llDialog is used to set up a menu and say the value of the buttons you press on a specified chat channel - it does that automatically. If you're comfortable with putting a listen in a prim, receiving a message and starting an effect, that's all you need.

If you are dealing with prims all in one linked set, I would have one central listen in the root prim which is only turned on when you actually start the menu, then, when it receives a command, turns itself off and sends a link message to tell the prims to do things - more efficient, and easier to code as you have all of your commands in one place rather than scattered around different prims. If you're careful you can even use llSetLinkAlpha to change the alpha of specific prims in an object.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
06-27-2006 13:06
Here's a really simple example: put this script in the HUD
CODE
default
{
touch_start(integer n)
{
llDialog(llDetectedKey(0), "Please pick an option", ["Show", "Hide"], -666);
}
}


and this in another prim

CODE
default
{
state_entry()
{
llListen(-666, "", NULL_KEY, "");
}

listen(integer c, string name, key id, string msg)
{
if (msg == "Hide") llSetAlpha(0.0, ALL_SIDES);
else if (msg == "Show") llSetAlpha(1.0, ALL_SIDES);
}
}


Touching the HUD prim will give you a menu which should control the other prim.

I used this sort of method to control my Derringer; that's more complex and has feedback and so on, but the basic principle is the same, dialogs and listens.
Pontias Peck
Registered User
Join date: 30 Mar 2006
Posts: 8
COol
06-27-2006 13:29
That sounds easy enough, This seems like just what is needed. All the particle scripts and show/hide scripts are command based.

If the HUD contains different prims to issue the call, will I need a different script for every "button?
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
06-27-2006 13:34
Possibly. It depends on what they actually do. If you have more than one prim activating a menu I'd have those prims sending a link message on touch to a central script, which then launches the appropriate menu. It really does make it easier to co-ordinate the system and check status centrally, otherwise you have to have link messages buzzing about to inform all of your scripts in your prims what the current situation is, and that's a pain to deal with.

You'll need at least one script in every button, however it is being done, to detect touch on that button.
Pontias Peck
Registered User
Join date: 30 Mar 2006
Posts: 8
What they do
06-27-2006 14:05
One set of prims show and hide. There is also a channel command for starting Particle scripts.

Would it be best to have the parent prim of the object controlled by the HUD just listen for the commands for the child prims?

Also what is all the information about llgetowner is this necessary to the HUD?

Pontias
Sol Columbia
Ding! Level up
Join date: 24 Sep 2005
Posts: 91
06-27-2006 14:13
I had a little question. I know when an avatar clicks a button in llDialog, the avatar *says* the button text.

So this...

CODE

llDialog(llDetectedKey(0), "Please pick an option", ["Show", "Hide"], -666);


Will it work on a negative channel since avatars can't speak on negative channels? I always assumed it wouldn't work. =x
_____________________
Pontias Peck
Registered User
Join date: 30 Mar 2006
Posts: 8
If you wanna see what I am working on
06-27-2006 14:23
You can go here...

Maemilkkot 172, 171, 52

Click on the info sign that is spinning and you will get a notecard of commands.


Now I am trying to incorporate these commands, a button for each set, into a HUD.


Pontias
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
06-27-2006 15:50
From: Sol Columbia
I had a little question. I know when an avatar clicks a button in llDialog, the avatar *says* the button text.

So this...

CODE

llDialog(llDetectedKey(0), "Please pick an option", ["Show", "Hide"], -666);


Will it work on a negative channel since avatars can't speak on negative channels? I always assumed it wouldn't work. =x

This will work. I've written and used scripts which use llDialog on negative channels.
Sol Columbia
Ding! Level up
Join date: 24 Sep 2005
Posts: 91
06-27-2006 16:18
Cool, thank you for the info!
_____________________
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
06-28-2006 11:36
One caveat on setting the buttons' alpha to 0: if the script in the button still has a touch_start or similar event, it might get "in the way" of the landscape. If you want the buttons to totally disappear, you should probably also have a change of state (without a touch event) in their scripts and/or move them out of the way. I like to move mine "behind" a single button that causes them to show/hide.

Baron H.
Pontias Peck
Registered User
Join date: 30 Mar 2006
Posts: 8
Anyone?
07-05-2006 12:41
I love forums thay allow openess and discussion. Is there an answer to this or? Just wondering if my original post mattered?


Pontias
Rodrick Harrington
Registered User
Join date: 9 Jul 2005
Posts: 150
07-05-2006 21:30
I'm sorry didn't see what you asked that didn't get answered. What's still vexing you?
_____________________
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
07-05-2006 22:30
From: Ordinal Malaprop
You'll need at least one script in every button, however it is being done, to detect touch on that button.


This isn't actually right, see http://secondlife.com/badgeo/wakka.php?wakka=llDetectedLinkNumber.

That said for many things the benefit of this is dubious - if the prim needs a script in it anyway, I've never seen the benefit of passing touches this way and sending the data back, although I'm sure there will be an application for it sometime. But if ALL you need is a touch, then llDetectedLinkNumber can be your friend.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog