Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

newbee to scripting

Renpat Greggan
Registered User
Join date: 9 Apr 2007
Posts: 1
05-11-2007 07:56
Hi all,

I'm quit new to scripting, I know how to adjust some scripts in SL but want to know how to create my own scripts. Since in RL I'm not in IT, it is hard for me to do, since basics I have to learn ;-).

Is there a way I can learn this? I tried some forum-links and also the limited explaining in SL-Wiki, but I need to have the basic understanding of why for example the { is used at that certain position in the script etc.

I also have looked for some books about that subject, but or they do not exist, or I simply can't find them. Preferably I want one in dutch (my native language ;-))

anyway, all the links I have followed, do not go deep enough according to my taste and if I want to write the scripts from A to Z myself, I need more understanding. Can anyone help me?

thanks in advance
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
05-11-2007 08:05
From: Renpat Greggan
Hi all,

I'm quit new to scripting, I know how to adjust some scripts in SL but want to know how to create my own scripts. Since in RL I'm not in IT, it is hard for me to do, since basics I have to learn ;-).

Is there a way I can learn this? I tried some forum-links and also the limited explaining in SL-Wiki, but I need to have the basic understanding of why for example the { is used at that certain position in the script etc.

I also have looked for some books about that subject, but or they do not exist, or I simply can't find them. Preferably I want one in dutch (my native language ;-))

anyway, all the links I have followed, do not go deep enough according to my taste and if I want to write the scripts from A to Z myself, I need more understanding. Can anyone help me?

thanks in advance


www.lslwiki.net
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
05-11-2007 10:50
From: Renpat Greggan
Hi all,

I'm quit new to scripting, I know how to adjust some scripts in SL but want to know how to create my own scripts. Since in RL I'm not in IT, it is hard for me to do, since basics I have to learn ;-).



I was in the same boat when I started scripting and for a while all I could do was modify scripts until I had one of those "ah hah!" moments of insight for how to think in SL code.


For me I see SL as being event driven. when this event happens do the stuff in the "{" brackets. for example take the "New Script" script. it has two events state_entry and touch_start. the things that are in the brackets for those two events are what will happen when those events happen. so when the default state is entered it will say "Hello, Avatar." And when it's touched it will say who touched it.

Simple enough concept really. from that point I had to think of what I wanted to do in terms of events and then figure out how to make those events happen. Say I wanted to have a basic following pet. It has to know where I am to follow me, and then move there. The simplest way for it to know where I am is to use a llSensorRepeat to tell it where I am on a regular interval. If the sensor finds me an event happens, so then within that sensor() event I put the commands that tell the pet to move to me. Since the sensor is repeating the sensor() event will occur on a regular basis and so the pet will move to me on a regular basis.

Really, the best way I found for myself to learn scripting in SL was to find someone who was willing to sit down with me for an hour or two and teach me how to create a specific script that I wanted, explaining everything that's done. the heavily commented scripts in the library are nice, but even then it won't answer some questions such as "why did you do this in event A instead of in event B"
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.
ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
05-11-2007 19:03
There are classes in SL you can take, such as the Academy of Second Life (ASL) LSL Scripting Boot Camp, a 4 day series of 1 hour classes. I'm taking it and the information is overwhelming, but I plan to take it over several times thinking a bit more will sink in each time.

Also as I learn simple things about scripting I try to make my own that do simple things, I learn something new each day in small steps, but in a years time that is 365 things I have learned and 365 steps I have taken.

A journey of 1,000 miles is accomplished one step at a time.
_____________________

VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30
http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240
http://shop.onrez.com/Archtx_Edo
Dnali Anabuki
Still Crazy
Join date: 17 Oct 2006
Posts: 1,633
05-11-2007 20:01
Good reminder Arch, thanks. It is easy to get overwhelmed and I'm going to remember what you said when I feel that way.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
05-11-2007 20:51
curly braces {} which is one of the things you mentioned can be the most confusing thing to noobie scripters

they get confusing becuase of the C++ stlye alot of ppl format their code in ie

CODE

if(a == b){llDoSomething();}else{llDoSomethingElse();{
new functions go here
and some more}{
some more stuff bla bla bla
}


if your used to it, im shure its fine personally i find it hard to read, but whats going on with them is something quite simple

all script in LSL (along with most popular languages) are arranged in blocks, the state is one block, an event is another block, if you have any loops or conditionals (ie if(something == something) are another block

now i could go on and on about how this works but for the sake of sanity heres a picture
Cryas Tokhes
Great Googley Moogley...
Join date: 8 Feb 2006
Posts: 124
05-12-2007 16:04
www.lslwiki.net is your friend... there are tutorials, walkthroughs, etc. If you follow the information and take the time, you will be going in no time.
Dnali Anabuki
Still Crazy
Join date: 17 Oct 2006
Posts: 1,633
05-12-2007 16:35
Thanks Osgeld, that little thing is quite helpful and works with visual people like me; verbal & written like the wiki not so much.
Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
05-14-2007 07:25
heyas;

starting by tinkering and changing some varaibles/parameters, then moving up to splicing/swiping code from othe scripts, then moving into writing your own scripts is a natural progression :)

i have a syntax jump-start guide on my web page. it also goes into 'how to write lsl script without actually KNOWING lsl scripting.' all you need is basic syntax, and the wiki ;)


http://bldsong.net/2L/


look under goodies for the tutorial link.
_____________________
Why Johnny Can't Rotate:
http://forums.secondlife.com/showthread.php?t=94705