Jump to content

Help with Menu


Weihoppa Nirvana
 Share

You are about to reply to a thread that has been inactive for 4433 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hey guys!

 

So i've been playing SL for nearly two years now, but only recently did I get into building.

Now, i'm no scripting genius so please bare with me.

 

What i'd like to do, i'd like to create a menu (or maybe it's a HUD?) that will allow me to switch between animations, perhaps two or three. I'd also like, though this part isn't quite mandatory, to be able to activate and turn off different particle effects, such as fire or sparks, etc.

Finally, and the only other mandatory part besides animations, are sounds. I'd like to switch between a few sounds, and they also need to loop. I could be wrong but the loop part would just be another script for sound looping?

 

I'm not extremely familiar with scripting, I'd definitely consider myself a novice. Though i've played with basic scripts, though never made my own. I'd love it if you guys explained in depth or left me a link, that would show me how to do what i'm looking to do.

 

Any help at all is appreciated.

Thank you very much,

Weihoppa. :]

Link to comment
Share on other sites

Let's start with the menu.

First, you inact have to decide if you want a dialog or if you want a HUD - the two ways differ a lot - thecnically and in the use cases they are best used for. If you are talking about the poses (which are animations) for e.g. for some sitting obect, a menu would be best. If you want to play animations everywhere you are - like gestures - a HUD wold be better. In ths case, the HUD could open a dialog for choosing the animation (and whateer you want to do - like producing particles.

So let's start with a menu - the basic flow is:

  1. You touch something
  2. Dialog comes up
  3. you press on of the 12 possible buttons
  4. the script pplay an animation

First of all, the LSL wiki is the scripter's best friend. How to use a dialog, you can read there. I won't go into the dialog and it's workings any deeper - the wiki page should help you with that.

For the playing the animations, the most tricky bit (though not really tricky) is that the script has to get the permision to play animations on your avatar, first. Assuming is's somer sitting object, the flow above could look like this in a more detailed ersion:

  1. Ava sits on the object - you should define a sit target for it
  2. the object receives an changed event - to be more exact, a change in the links - the examples in the wiki pages show how to work with this kind of change event
  3. Now you call the llRequestPermissions function for playing an animation - that would finish the first step in the script

Now you define what to do on a tiouch by adding a touch event. On receiving the event you check if the permision to play animations using llGetPermissions - that would look something like:

touch_end(integer num_detected) {	integer perm = llGetPermissions();	if (perm & PERMISSION_TRIGGER_ANIMATION) {		//open dialog	}}

 

  1.  now you open the dialog and wait for input - apart from calling llDialog, this will involve listening to the response, which you will need to creat a listener for with llListen and a listen event
  2. in the listen event, you play the chosen animation using llStartAnimation

You're there!

Of course you can come back anytime one of these steps causes you headaches.

  • Like 1
Link to comment
Share on other sites

Thank you for your post Darkie,

 

I do want to take it everywhere, so the HUD would be better for me.

Thank you for your help, i'll follow your directions and see how it turns out. :]

 

It's actually a guitar by the way, not furniture or anything. Haha. Trying to change things around so it can play more than one animation and sound, and adding in effects would be nice.

 

Thanks again though! Trying things now.

Link to comment
Share on other sites

Actually now that i'm reading through the wiki and such, and fully following your instructions, I believe I still need some minor form of instruction on how to construct a hud. I understand the building part, it's just a prim with more prims on it that you attach to a HUD spot instead, but how do I relay a button I pressed on said HUD, to activate a script or animation on an object? Or my guitar in this example.

Link to comment
Share on other sites

If your HUD is an object that consists of several prims, that each should play a different animation, then you detect which prim has been touched by using the llDetectedLinkNumber function inside the touch event to find out which prim has been touched. You put the desribed script in the root. It could still be tricky to associate link numbers to animatios. So if you want to go down this road, let us know.

If your HUD consists of one prim and you want to associate certain areas of the prim to certain animations, you could find out with the function llDetectedTouchST in the touch event, which area of the prim has been touched.

If your HUD consists of one prim or the touch to a certain prim triggers a dialog, that you use to choose an animation from, the script I described plus the alterntions for the HUD use case is a simple example how to do it. Put the script in the prim that you want to make the dialog come up on touch

Link to comment
Share on other sites

Start learning LSL with some of the beginner tutorials here >>> http://wiki.secondlife.com/wiki/LSL_Tutorial

and then spend some time with a good tutorial on how dialogs work, like this one  >>> http://wiki.secondlife.com/wiki/DialogMenus

Once you have written something that you need specific help with, bring it back it and post it.  We'll be glad to help with the places that are giving you trouble.

BTW, scripting is 90% logic and 10% mechanics.  In the beginning, it's natural to spend most of your time on the 10% because it all looks unfamiliar.  That's why you need to work through a few tutorials and spend some time with the wiki, and it's the part we can often help you with most easily here. The important 90%, though, only comes with practice and careful planning.  It's not something that someone else can show you, except in a very general way.  You have to learn that part by doing it.

Link to comment
Share on other sites

Hey Darkie!

 

That was very useful, thank you, I believe i'm going with step 3 and going from there. I believe it will solve any troubles I may have.

 

Rolig, i've been playing on the wiki on occasion, but from what i've heard from several scripters it's more like the basic manual, and that you can learn quicker and faster from guides around the web. It really all depends really. The wiki is slightly harder to understand than the average scripting guide though. But i'm slowly and steadily learning from both. :]

Link to comment
Share on other sites


Weihoppa Nirvana wrote:

Hey Darkie!

 
[...]

Rolig, i've been playing on the wiki on occasion, but from what i've heard from several scripters it's more like the basic manual, and that you can learn quicker and faster from guides around the web. It really all depends really. The wiki is slightly harder to understand than the average scripting guide though. But i'm slowly and steadily learning from both. :]

Yeah, you're right about that.  The wiki isn;t a textbook or a tutorial.  It really is a user manual, in the strictest sense of the term.  In the absence of any documentation from Linden Lab, scripters have created their own manual to explain to each other how each function in LSL works.  I keep the wiki's Function page open all the time as I script, because I can't be bothered memorizing all details about every single function -- especially ones that I use rarely.  As I said earlier, mechanics are the relatively less important 10% of scripting -- the part for which you can always get reminders by consulting the wiki.  The only reason I suggested looking at it now, as you start, is to get in the habit of using it and to pique your curiosity about functions that sound potentially useful.

Link to comment
Share on other sites

That's a highly good point, perhaps with my curiousity i'll make the next revolutional script... Haha. Just give me a year or so.

I spent several hours on the wiki today though, I have a much better understand of how to write my own script. Shortly i'll put it into works and hopefully get my HUD up and running.

 

Thank you for your help though, it's always much appreciated. :]

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4433 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...