How do I make an interactive (show/hide, clickable) HUD?
|
Six Dosei
Second Lifer
Join date: 10 Sep 2006
Posts: 18
|
01-16-2010 12:22
Ok, hello everyone! I'm not sure if this thread will be seen but I'm hopeful someone else will read and point me in the right direction! I'm trying to make a HUD but I have no idea where to start. Let me explain what I'm trying to do ...
I recently bought a penis attachment called "HARDWare Lite 'Fat Cock" from EXL. I really like the cock and haven't had a chance to play with it beyond trying it on and telling it what to do (there is no HUD for it, you have to talk to it and tell it what state you want it to be in). This is fine but I'd like to make it easier for me to play with/use later on down the road. The attachment has several settings for the penis 'arousal' states (3 semi-hard, 3 erect), cum (3 total animated sequences) and urinating (2 animated sequences here as well). There are also two 'soft' settings (1 being cut the other state showing foreskin). You can also tell it to change the color of the penis shaft itself, along with the ball/fur color (fur for anthro's).
//Now that you know each state available, here's what I'm trying to achieve ...
What I would like to do, is have a HUD (graphic has already been designed) that the user can touch on their screen; instead of having to (remember) say each command and state. I know I will need to create a thin panel that will attach to the user's screen (or monitor); but what I don't know, is how to make the buttons work.
I would like to have each 'state' change button light up to show which setting the user is currently on; along with a show/hide button to hide the HUD when the user isn't using it. Additionally, I thought it would be nice to have color presets for this project. That way both dark and light furs will have a quicker time getting the color to match themselves, without having to spend time 'talking' to the object (currently you have to 'tell' the objects what color you want them to be with the RGB values). This takes a lot of guess work and time messing around with the object when you shouldn't have to.
I'd like the object to do more, but I think trying to accomplish everything I've already listed here is more than enough for me to try first before going all crazy with extra options.
So all that said, how do I get started with this. More specifically, -where- do I get started on this? I have no clue how to script and to be honest, I'm more than a little scared of messing up royally with this and not having any help.
--
I've been to James Benedek's script area but I don't know what I'm looking at here. Do I just take the scripts he has here and put them in the object I'm trying to make? If so, which scripts am I looking for to add to the HUD?
In closing, I'm hoping to get some help and will post this thread in the Scripting forums as well to see if someone there can help me. Thank you for taking the time to read my post!
~Me
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
01-16-2010 12:31
It sounds like what you need to do is to learn to script, starting from the beginning, since you don't know how to at all.
In other words, rather than starting out with a complex project in mind, that you are hoping to get people to pretty much write for you for free, take some beginner classes in scripting, read the introductory material on scripting in the wiki, get some extremely simple scripts and start modifying them, do a google search on things like "second life how to script" and read as appropriate.
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
01-16-2010 12:49
I agree. This is an ambitious first project. It will be much harder and more frustrating than you expect. It would be wiser to start with some fairly simple scripting projects and work up to this one. If you have prior programming experience in another language, it shouldn't take long to come up to speed. Take a look at the many tutorials at http://wiki.secondlife.com/wiki/LSL_Tutorial. When you do start to work on this HUD script, feel free to come back here and post your trial script as it evolves, along with questions. BTW, since you are trying to create a control interface for someone else's scripted object .... I suspect that the creator did not give you mod permissions on the object's script. That may complicate your task, depending on how the script expects to hear commands. At the least, you will not be able to determine the current state of the object from its script if you don't have access, so you will have to devise some way to keep that information in your own HUD script.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
Six Dosei
Second Lifer
Join date: 10 Sep 2006
Posts: 18
|
01-16-2010 13:17
From: SuezanneC Baskerville It sounds like what you need to do is to learn to script, starting from the beginning, since you don't know how to at all.
In other words, rather than starting out with a complex project in mind, that you are hoping to get people to pretty much write for you for free, take some beginner classes in scripting, read the introductory material on scripting in the wiki, get some extremely simple scripts and start modifying them, do a google search on things like "second life how to script" and read as appropriate. Hey there SCB! While I appreciate your post, I'm a little taken aback by what I'm perceiving as a negative tone from it. I'm fairly certain that I stated I had no clue where to start with scripting this project in my opening statement. Perhaps I wasn't? I also find it odd that you've basically accused me of what I'm perceiving as "Your too lazy to look stuff up and expect people to do the work for me"; that's not an accurate assessment. I -have- looked (and still am) in the forums for help. I've been asking in groups if anyone knows scripters that are familiar with my concept, so that I can pick their brains on how a project like this would be done. I have been directed to look at other people's work and looking at their script work, I've also been told that getting a HUD to do what I've outlined in my previous post, is as simple as creating a script that says the commands so the user doesn't have to (I get that, that's how HUD's work. What I don't understand is what scripts I need to be researching in order to do all these things). I have several HUD items and have tried looking at how the scripts work. I'm either 'not allowed to view' the scripts, or end up looking at scripts that look like nothing but serial codes (EXL's Dev Packs make no sense to me but I'm still looking into those). So while your impression of me comes off to me as "I'm a lazy bastard", I've actually done a little research here, so could you please try and not assume that I'm just expecting someone else do the work on this for me? I will say that I appreciate the guidance you provided with taking starter classes. That makes sense and I have yet to explore that option as I've come to the forums for guidance and instruction first. I figured somebody here would know of a group or teacher that knows the gist of what I'm trying to do and say "Hey, these people over here know how to do that, you should go to their classes or IM them"; instead of "Figure it out for yourself noob", which is pretty much what you've stated. I've also looked on GOOGLE and am still rifting through the SL Wiki for scripting help. It's slightly difficult for me though since I'm looking for, what I perceive as, obvious keywords (like show/hide HUD script). I'm obviously missing something somewhere though since I have yet to find a subject that's discussed that specifically for the purpose of what I'm doing. I am trying to learn and be pro-active in getting answers from SL residents and I thought that I was asking specific questions to a problem that someone could give me a direct answer of "Go here for this, and there for that". If that's what you've done for me then please, forgive my presumption that you were being rude, It's difficult to tell people's tone in a forum post and for that I apologize. Closing my post here, since you mentioned that I should take online classes for this, where should I go and who are the best people to learn the pulp of this subject matter from? What I am expecting here, is someone to help guide me through what scripts I would need to achieve the end result of this project. I already know I'll need a 'show/hide' script but it's not been very easy to find that.
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
01-16-2010 13:55
Assuming your 'attachment' responds only to its owner (i.e the Avatar that it's attached to), your idea won't work. The only solution is to use llDialog (those blue drop-down menus).
Something like (unfortunately you didn't list any actual commands) this:
llDialog(llGetOwner(), "My HARDWare Menu, ["Hard", Harder", "Orgasmic", "Whatever"], ChannelNumber)
Find any scripted example using llDialog and you should get the idea.
The problem with your idea is that a HUD (basically an attached object) can only 'speak' as itself. Only llDialog will 'speak' as the agent (Avatar/You) who clicks on the menu option.
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
01-16-2010 14:01
Hmmmm.... Far from being negative, I thought that Suzanne and I were actually giving rather sound advice. The responses you got about HUDs when you posted in the Animations forum are right on target. There's nothing magical about a HUD, per se, that makes it much different from any other scripted object. You just attach it to your screen instead of attaching it to your avatar body. Scripting a HUD, though, can be a non-trivial exercise. That's especially true if you don't have access to the script that drives whatever the HUD is supposed to be controlling, as I said in my last post. You won't find a generic HUD script that's going to help you much, because you need to design yours specifically to work your device. If you really do want to leap right in, take a look at the sample script at http://wiki.secondlife.com/wiki/Button_Click_Detector to see one way to design a multibutton panel that might be used in a HUD. I imagine that you communicate with your device on a private channel, and that its script has some way to prevent other people from messing with it. That may also make it difficult or even impossible for your HUD to communicate with it, depending on how the device's script is written. ETA: This is what Pale was talking about in the post just above this one, posted while I was writing.) You can find out quickly enough by trying to send one of your commands with a test script like this.... default { touch_start(integer num) { llSay (x, "y"); // Where x is the private channel number that you send messages on and "y" is one of your control keywords. } }
Put appropriate values of x and y in the script, drop it in a prim, and touch it. If your device doesn't respond, then you know that you have a LOT of work ahead of you (or maybe you save yourself a lot of work by putting your idea on the shelf for now). ETA: Pale suggested using llDialog instead of a HUD to get around this problem. If you want to try that, see http://wiki.secondlife.com/wiki/LlDialogAs I said before, you probably won't be able to ask your object what state it is in, so you'll need to devise a way to reset it to some default state with your HUD every time it starts up, and then get the HUD to remember any changes it makes after that. When it comes to hiding the HUD, there are a variety of options. One is to apply an alpha texture that makes it invisible. Another might be to shrink it to an unobtrusive size, or maybe to rotate it 90 degrees, so that it's perpendicular to the screen. To find scripting classes, use Search in world and go to Events >> Educational. There are classes in everything under the sun offered regularly in SL. You may be able to pick up enough in a couple of sessions to get a running start. I would still recommend working through some of the tutorials I pointed to earlier, and then digging through sample scripts in the script library to figure out how they work.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-16-2010 14:06
before you try to jump on this particular project, there's two important facts that should be looked at that I noted in your other thread... are the scripts in the original object no-mod? if so, are they coded to respond to anything besides the owner? the way to test the second question would be to rez the object, create a new prim, and drop this highlighted script into the new prim (after modifying the string as instructed) string gStrTst = "replace the text inside these quotes with a command that the object should respond to exactly as you would type it in chat";
default{ state_entry(){ integer vIntChn; if (!llSubStringIndex( gStrTst, "/" )){ string vStrChk = llGetSubString( gStrTst, 1, 1 ); if ((string)((integer)vStrChk) == vStrChk){ vIntChn = (integer)llGetSubString( gStrTst, 1, -1 ); gStrTst = llGetSubString( gStrTst, llStringLength( (string)vIntChn ) + 1, -1 ); } } llSay( vIntChn, gStrTst ); if (vIntChn){ gStrTst = "/" + (string)vIntChn + gStrTst; } llOwnerSay( gStrTst ); } }
if it responds, or if the scripts for it are open modify, you'll be able to make your hud easily. if not, you'll have to use the exact commands with a dialog, that's limited to 24 characters, and will be a bit more difficult. ETA: the code above just tests how the object responds to commands from an object owned by you, rather than from you specifically. don't sweat about what it's doing, I just coded it to be as simple to test with as possible, and echo the command back via ownersay so you know it was sent (only matters if it uses an off channel) PS Roligs method works too, I was just generalizing for all cases, and she posted before I finished.. gotta move faster.
_____________________
| | . "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... | - 
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
01-16-2010 15:18
To find an example Show Hide script: Go to the Scripting Library forum /15/1.htmlClick on the "Search This Forum" link on the right side of the screen. /15/1.htmlType Show Hide into the search box. The third item in the results is Simple Show/Hide Script /15/85/144919/1.htmlOr go to Google and put simple show hide script second life in as a search term This produces, among others, up near the top of the results list, Hide/show script http://www.schome.ac.uk/wiki/Hide/show_script
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|
Six Dosei
Second Lifer
Join date: 10 Sep 2006
Posts: 18
|
01-17-2010 06:30
Ok so I put this into a prim: default { touch_start(integer num) { llSay (9, "cock state erect3"  ; // Where x is the private channel number that you send messages on and "y" is one of your control keywords. } } and touched it but nothing happened. So I also tried: default { touch_start(integer num) { llSay (9, "cock state erect3"  ; // Where x is the private channel number that you send messages on and "y" is one of your control keywords. } } Just o see if that had any difference on anything but that didn't work either so I tried: string gStrTst = "/9cock state erect3" //"replace the text inside these quotes with a command that the object should respond to exactly as you would type it in chat"; default{ state_entry(){ integer vIntChn; if (!llSubStringIndex( gStrTst, "/" )){ string vStrChk = llGetSubString( gStrTst, 1, 1 ); if ((string)((integer)vStrChk) == vStrChk){ vIntChn = (integer)llGetSubString( gStrTst, 1, -1 ); gStrTst = llGetSubString( gStrTst, llStringLength( (string)vIntChn ) + 1, -1 ); } } llSay( vIntChn, gStrTst ); if (vIntChn){ gStrTst = "/" + (string)vIntChn + gStrTst; } llOwnerSay( gStrTst ); } } This produces an error of: (3,0) : ERROR : Syntax error I know that means that there's something wrong with that specific area of code, but I don't yet know what the proper syntax should be. I have yet to read up on the other suggestions that everyone so far has provided, but I will today and will keep posting progress on the matter here. I wasn't sure if it mattered to the object I made and put the script in; had to be 'linked' to the penis in question, or not. I ended up linking it and found that a part of the penis would disappear and then nothing would happen when I clicked on the scripted ball. Also, after (finally) speaking to a few content creators (one on one); They told me how to look at the object to see if the scripts inside it were 'No-Modify': The process of which requires you to rez the item on the ground > edit > look in the contents tab > view the scripts (Still tried to do the above examples just in case). They also made the suggestion to contact the actual creator of the product and ask for a modifiable version of the object that isn't transferrable (so I couldn't sell it later on), and said to explain what I want to do with the product (which I've done as well, can't hurt to ask right?). We'll they say  Talking to a few more content creators about this, they recommended a place to go for ready-made scripts (for those that don't already know about it) that I'm assuming you just drop into objects and you then have a scripted object that does whatever script is dropped into it. Check out: sl free script library - script, Nimnam (200, 71, 601) for a massive amount of scripts. Since I haven't had any luck with this so far, and seem to be unable to tell the object what state to go to via another object (I wasn't aware that a HUD was not considered a separate object from my avatar), I'm going to try to do the Dialogue option next. While I'm confident that I can figure that out ... I'm a little disappointed that I'll have to look at a blue box when wearing the attachment. I was hoping to have a cool looking HUD that I could poke but ... the dialogue option is just a temporary fix for now. I'm hoping the Content Creator will have some good news for me  Thank you to everyone that's posted so far. I really appreciate it!
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
01-17-2010 07:05
A little clunky but your HUD could itself issue a single button dialog to relay the desired command to the attachment: // function to relay the command showDialog (string mnuCommand) { llDialog(llGetOwner(), "\nRelay Command: " + mnuCommand, [mnuCommand], 9); }
default { touch_start(integer num) { // example of what you'd use in the body HUD control script showDialog ("cock state erect3"); } }
This would at least retain the idea of having a nice looking HUD but you would have to suffer the blue menu each time you want to communicate with your attachement.
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
01-17-2010 10:11
Gee, I'm glad clocks, not cocks, were my inspiration to learn LSL 
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
01-17-2010 19:35
From: Pale Spectre A little clunky but your HUD could itself issue a single button dialog to relay the desired command to the attachment: // function to relay the command showDialog (string mnuCommand) { llDialog(llGetOwner(), "\nRelay Command: " + mnuCommand, [mnuCommand], 9); }
default { touch_start(integer num) { // example of what you'd use in the body HUD control script showDialog ("cock state erect3"); } }
This would at least retain the idea of having a nice looking HUD but you would have to suffer the blue menu each time you want to communicate with your attachement. and you could also feed it a list of commands on one dialog (assuming it's 12 or less commands) if more that's where it gets trickier with pages
|
Ephraim Kappler
Reprobate
Join date: 9 Jul 2007
Posts: 1,946
|
01-17-2010 20:12
From: Johan Laurasia Gee, I'm glad clocks, not cocks, were my inspiration to learn LSL  I'm just glad I never had to talk to my freenis. Sounds like an exascerbated case of Portnoy's complaint.
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-17-2010 21:41
From: Ruthven Willenov and you could also feed it a list of commands on one dialog (assuming it's 12 or less commands) if more that's where it gets trickier with pages I built a quick paging function for this that includes left to right top to bottom ordering to... just haven't gotten around to posting it, because it requires some incorporation into the listen event, fwd+bck supports as many pages of ten items as you can cram into memory.... suppose I'll post that later today as a Library item. a simple dialog script with no listens (your existing scripts are doing that)
integer gIntChn = 9; list gLstMnu = [ "command 10", "command 11", "command 12", "command 7", "command 8", "command 9", "command 4", "command 5", "command 6", "command 1", "command 2", "command 3" ]; //-- numbering is for a full set of 12, commands are displayed LtR/BtT
default{ touch_end( integer vIntTouch ){ if (llGetOwner() == llDetectedKey( 0 )){ llDialog( llGetOwner(), "Command:", gLstMnu, gIntChn ); } } }
this is the reverse case pale's suggestion... his is select then touch, this is touch then select (requires no special handling on the hud, just that you can click it. alternatively you can drop it in the object since it's +mod I encourage you to try out both methods, as if nothing else, it'll give you a better handle on scripting. ETA: lost half my reply in another window the rest was... From: Six Dosei string gStrTst = "/9cock state erect3" <-- missing semicolon
This produces an error of: (3,0) : ERROR : Syntax error happens to the best of us.
_____________________
| | . "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... | - 
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-18-2010 16:15
link for Ruthven (or anyone else watching the thread) re the dialog pagination 
_____________________
| | . "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... | - 
|