Best Way To Dive Into Scripting?
|
|
Pleasure Ashbourne
Registered User
Join date: 24 Dec 2007
Posts: 60
|
01-12-2008 11:24
I'm new to scripting, and I have experience with many coding languages, not too amazing, but I figured this would be no different. So my question is: How should I go about getting this? I'm assuming practice practice practice. I didn't check to see if there was a compiled list of websites I should check out yet, so I will do that next.
For my first task I want to make a "lock" script, in which I have a gate that opens when you touch it, then closes again when you touch it. I want it so only I can open the gate. Too tough for a beginner?
|
|
Ravanne Sullivan
Pole Dancer Extraordinair
Join date: 10 Dec 2005
Posts: 674
|
01-12-2008 11:33
I'm not sure if this is the "best" way but how I learned LSL was by getting a lot of the freebie scripts out there and takiing them apart and playing with them. With that and use of the wiki you should be able to pick things up pretty quickly since you have some coding beckground.
The forum here is your friend, you will find lots of help from some really good scripters and lots of examples of how to do things.
|
|
Pleasure Ashbourne
Registered User
Join date: 24 Dec 2007
Posts: 60
|
01-12-2008 11:40
OK great, sounds good! So let's begin with my first task, a simple lock.
To break it down, I have to make it so:
Only I can open it It ignores all other people It's touch activated
Sounds easy to me. Suggestions?
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
01-12-2008 11:51
There's a sticky thread at the top of this forum which is a very good start into LSL, linking all the major resources available to scripters.
As for a lock, it amounts to determining what it "locks", and what constitutes a "key" to open it.
|
|
Pleasure Ashbourne
Registered User
Join date: 24 Dec 2007
Posts: 60
|
01-12-2008 11:53
From: Talarus Luan There's a sticky thread at the top of this forum which is a very good start into LSL, linking all the major resources available to scripters.
As for a lock, it amounts to determining what it "locks", and what constitutes a "key" to open it. Just touch. And it has to be me and only me. I could maybe work on a list of acceptables later on, but for now just me.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
01-12-2008 11:56
When I first joined SL, I started by perusing all the documentation at http://www.lslwiki.net/ . In particular look at the introduction, language reference, and tutorials before branching out and reading in-depth about the library API (on the right). Then never stop going back to learn the little intricacies and corner cases of the language and library. May not work for everyone, but that's my learning style.
|
|
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
|
01-12-2008 12:34
I've been at this for for about 8 months now and consider myself an intermediate scripter at this point. The various scripting wiki's are the closest thing there is to a reference to this language. I read this forum daily. There are also a number of scripting groups that you can join and listen to the chatter. I ditto reading scripts that others have created. Jesse Barnet (I think it was him) started a thread a while ago on something like "Things I wish I had known about LSL). I can't come up with it in a search. Maybe someone else remembers the thread.
As for your door script, I'd check out the TimelessLinkedDoorScript that you can find around and on this forum I believe. The rotations get complicated.
|
|
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
|
01-12-2008 12:34
From: Pleasure Ashbourne OK great, sounds good! So let's begin with my first task, a simple lock. To break it down, I have to make it so: Only I can open it It ignores all other people It's touch activated Sounds easy to me. Suggestions? You have two challenges. The first is learning how to tell who touched something, and then comparing that to who should be allowed to do something. The second is how doors work. Others will know better, as I am not a builder, but I think that doors have to be 2 prim -- the door, with a thin or invisible strip on one end that acts as the hinge, and it's actually the hinge that moves and the door moves with it; you dump the actual scripts into that hinge. I've seen loads of doors will work like this; perhaps someone can tell us both if it has to be this way, or if you can do just 1 prim doors without the hinge. So perhaps start by searching the library /15/1.htmlfor door scripts
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
01-12-2008 12:42
There are a few ways you can make rotating doors. If they are a separate object from the structure they are in, you can use a root prim at the edge of the big prim, as noted. Solutions that work whether or not the door is its own object are to cut the prim so that the center of the original prim is at the edge of what is left (so really what you have is half a box), and to use llSetPrimitiveParams() to change both the prim's position and rotation at the same time.
|
|
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
|
01-12-2008 13:12
This is the link to the thread "Wish I had known..." that I believe Monica may have been refering to. Its a pretty good read... /54/92/217724/1.htmlA "If I knew then what I know now..." thread followed a little while after. Again, another good read... /54/3c/221113/1.html
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
01-12-2008 14:10
looking at freebe scripts didnt really help me much, what finally kicked it in gear for me is actually sitting down and trying to make something from scratch mind you it wasnt easy and it took forever but once i did it i went alot smoother from then on out now for my wise arse response  +  +  = script
|
|
Okiphia Anatine
Okiphia Rayna
Join date: 22 Nov 2007
Posts: 454
|
01-12-2008 14:16
The way I started learning was with teleporters. I sat down with three or four variants, and tried to create my own, super simple teleporter that goes where you tell it to. Used the llSitTarget() method, and worked pretty well, though confused me a bit.
I'm still learning in essentially this way. Come up with an idea, find scripts that do something similar, and see how they work, then make my script by piecing together bits of other scripts.. if something does what I need it to then yay!
I have learned enough to do some (relatively simple) scripts from scratch now, and enough to do what I need most of the time, so I'm happy lol..
Just looking at a prewritten script doesn't help me unless I dissect it and see what exactly the different parts do, and why its done that way.
_____________________
In-world, I am Okiphia Rayna. This account is an alt, and is the only account I currently have with payment info on-file due to some account cracking that took place. This is a security measure at present, and I may return to the forums as Okiphia Rayna at a later date.
If you need to reach me, IM Okiphia Rayna, not Okiphia Anatine
|
|
Nika Talaj
now you see her ...
Join date: 2 Jan 2007
Posts: 5,449
|
01-12-2008 14:42
Well, let me take a stab at a more specific answer, without giving away so much that you don't get a chance to learn anything. First do one or two of the very simple tutorials on the LSL wiki *. If you already code, you will get impatient very soon with that and just begin using the wiki as a reference. That's cool. I'm assuming you already have a gate that opens and closes with a modifiable script. If not, search in the Scripting Library for a door script, like Chaz says. It may be hard to find one that doesn't already have locking  In the wiki, you will need to read about a few things to add locking: -- Events (specifically, the Touch events. Your door script already handles a touch event, but you should know what it's doing). -- States (one way or the other, your door script already has an open and closed state, and you are adding a locked/unlocked state. These can be done as official states, or as global variables. But it's good to understand how States work, mostly to be sure that you initialize your state variables in the right place.) -- Types - in this case, the Key type, a special kind of string -- llGetOwner command You should be able to get it done at this point. * LSL wikis: due to LL being dorky, there are now multiple LSL wikis. I generally use the old one, http://www.lslwiki.net/lslwiki/wakka.php?wakka=HomePageThe "official" new one is at http://wiki.secondlife.com/wiki/LSL_Portal . It's newer, but not yet as complete as the old one. Don't ask.
|
|
Scott Tureaud
market base?
Join date: 7 Jun 2007
Posts: 224
|
01-12-2008 14:48
I got in by making a few custom made stuff, looking for a commission that was really close to what I've had experiance with. and since then I've been free scripting whatever I want(commision on sales ftw).
|
|
Nika Talaj
now you see her ...
Join date: 2 Jan 2007
Posts: 5,449
|
01-12-2008 14:49
Where do you look for commissions, Scott?
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
01-12-2008 15:46
From: Monica Balut Jesse Barnet (I think it was him) started a thread a while ago on something like "Things I wish I had known about LSL). Wasn't me, but it is definitely a cool thread. Best way to learn: Combination of diving in and reading every available script pertaining to what you are interested in at the moment. Hit the wiki'S, big S because there is more then one and each has different comments and snippets. The best is the oldest, but it is also the most unreliable: http://lslwiki.net/lslwiki/wakka.php?wakka=HomePageThe new wiki: http://wiki.secondlife.com/wiki/LSL_PortalAnother one: http://rpgstats.com/wiki/index.php?title=Main_PageAbsolutely fantastic alternate mirror of the old one (courtesy of Osgled Barmy) because you can also download it: http://www.cheesefactory.us/lslwm/Download and use LSLEditor. http://www.lsleditor.org/Download.aspxIt makes coding much faster and gives a choice of the wiki's including a built-in one taken from Osgeld's. No matter what your expirience is with other codes, nothing will prepare you for the way LSL handles rotations. Don't waste time beating yourself up over it. Post any rotation questions here and we can point you in the right direction. Very simple door/lid scripts w/o any user limitations built in: /54/1c/215026/1.htmlWhat really helps is seeing how different people will code up the exact same thing. Every now and then we will have a great rambing thread with everyone posting thier own examples or tweaks with the accompanying discussions of pros and cons for each. After you have something cobbled together post it back to the forum here and ask how everyone else would code it. You'll be surprised by the feedback. Here is an example of a very basic script concept and yet look at the different ways of doing it and the chat: /54/93/234337/1.htmlWelcome to the forum!!!!!!!!!!!!!!
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|