Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Why I'm not learning much

Dan Marten
The Grandmaster of Doom!
Join date: 21 May 2004
Posts: 16
03-13-2005 04:35
I've had SL for a while now, but I haven't learnt much about scripting. I know the syntax structure, and I could do loops and ifs, etc, but I've not learnt much else, because I haven't had anything to apply it to. I can't think of anything I'd like to try and do, something which I can gain experience with! Can anybody suggest any way I can apply my abilities, and learn functions and scripting methods? Can anybody offer some way that they learnt scripting that I could use myself?

Thanks if anybody can help me, I really want to make the most of my SL!
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
03-13-2005 04:56
Hang out in the Morris sandbox, and help out noobies with their first projects.
Usually they need something very simple, like a color changing script, a following script, a sensor, etc...
You'll get some free ideas, lots of practice, and since you're not asking money for it, there is no expectation of quality and so if there's something you can't do, it won't impact your reputation. Heck, helping out noobs for free will only look good on ya.
Plus, some of those noobs mightl eventually grow up to be card-carrying FIC members, which will definitely come in handy =)
Dan Marten
The Grandmaster of Doom!
Join date: 21 May 2004
Posts: 16
03-13-2005 05:47
Thanks for the tip. Colour changing and sensors are fine, but I'm not sure about following scripts - shouldn't be too hard to find out though. Learning new functions isn't a problem, it's finding situations to apply them to which I find hard. Next time I'm on, I'll look around for people who seem like they need help.
Jack Lambert
Registered User
Join date: 4 Jun 2004
Posts: 265
03-13-2005 07:23
A great way to learn how to write something, is to try and copy (perhaps even improve) something that exists already. For example, I've been toying with the idea of making a clone of the "Rent-o-matic" that you see all over SL. It might be hard to improve on it because it's done well (but oh dear is it spammy! :) ) ... but the creator has tackled a lot of difficult situations.

The first casino game I ever wrote taught me a lot about permissions, money handling, type casting, writing my own functions, link messages, playing sounds, using lists, etc.

A great first-time script is writing your own "raffle ball" - it's something that can even be useful someday, plus you have the added advantage of looking in some of the pre-written scripts to get that "OOOOH, so that's how you do that".

One of the smartest things I ever did was to write a notecard configuration function. I can drop this and a few variables in practically any script and be 90% ready to associate configuration parameters with values.

Don't be afraid to post in the forums. Even the best come here with questions and generally people are responsive as long as you've tried and done at least a little homework :) I suppose the most important thing you can do is pick something you're really interested in ... if it's weapons or boats, then do that. If you like business tools like vendors or visitor counters (as I do), do that... etc :)

Anyway these are just some suggestions ... also, if you have any questions - I'll do what I can to help here or in-game.

--Jack Lambert
_____________________
----------------------------
Taunt you with a tree filled lot? hahahahahahaha. Griefer trees! Good lord you're a drama queen. Poor poor put upon you.

-Chip Midnight
Jaynius Shaftoe
Automated User
Join date: 9 Jan 2005
Posts: 29
Why do you want to code then?
03-13-2005 09:26
If you can't think of anything you want to code, why do you want to learn then?
Dan Marten
The Grandmaster of Doom!
Join date: 21 May 2004
Posts: 16
03-13-2005 13:29
I just do, I enjoy coding. I need inspiration. It's just like asking a musician why they want to be a musician if they can't think of anything to write - they might not have any inspiration, or ideas for songs.

Anyway, thanks alot Jack. I might have a go at a raffle ball, that's a good idea. Or maybe some vendor tools too.
Cross Lament
Loose-brained Vixen
Join date: 20 Mar 2004
Posts: 1,115
03-13-2005 13:37
*giggles* I'm in the same boat, Dan. When I have a project, I absolutely love scripting. Right now I can't think of anything to make, so I feel useless. :D
_____________________
- Making everyone's day just a little more surreal -

Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?"
Dan Marten
The Grandmaster of Doom!
Join date: 21 May 2004
Posts: 16
03-13-2005 14:05
Exactly. Every time I learn something new, I think "Oh hey, I just learned something new! I'm so clever!" but then I have nowhere to use it, and I feel like I have no way to prove my worth or test my skills. Oh well...
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-13-2005 14:18
Some project ideas floating around that could use some love (and a few off my "To Do" list) -

- Create a realistic "cloth simulation" in LSL
- Create an in-world IRC system independant of outside connections
- Create a Rubik's Cube that works
- Create some nifty optical illusions
- Create some new building tools for residents (like my prim mirror)
- Create a prim terraformer that doesn't lag a sim (suggestion)
- Create a "picture in picture" feature for QT imports (1.6)
- Create a means to figure out where someone is "touching" a prim or object
- Create a realistic pet that doesn't fly (suggestion)
- Revise some others' code to make it less laggy
- Take over the world :D
_____________________
---
Dan Marten
The Grandmaster of Doom!
Join date: 21 May 2004
Posts: 16
03-13-2005 14:56
From: Jeffrey Gomez
- Create a Rubik's Cube that works


Ahh, now this I could try if I knew how a real Rubik's cube actually worked.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-13-2005 15:02
http://www.answers.com/topic/rubik-s-cube

And for an added challenge, automate this.
_____________________
---
Stylez Gomez
Union Micro
Join date: 4 Jun 2004
Posts: 146
03-13-2005 15:58
From: someone
- Create a realistic pet that doesn't fly


This is something I am going to undertake eventually. I started making a pet then realised there are no non-flying pet scripts that I could find. So I intend on mastering a flying pet with the help of the tutorials in the wiki, then HOPEFULLY being able to modify that to a non-flying pet.
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
03-13-2005 16:06
We already have a rubik's cube. Oneironaut Escher made it. It even solves itself.
Brilliant little bastard :)
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-13-2005 16:23
Hmph. Beat me to the punch. I'd like to see this little wonder sometime. :D
_____________________
---
Alondria LeFay
Registered User
Join date: 2 May 2003
Posts: 725
03-13-2005 17:29
I have some code that can detect where one is touching a prim (in mouselook).
Cross Lament
Loose-brained Vixen
Join date: 20 Mar 2004
Posts: 1,115
03-13-2005 18:20
I made a 'hopping bunny' pet script, that would follow its owner about. It was really annoying until I remembered to turn off its collision sounds. :D
_____________________
- Making everyone's day just a little more surreal -

Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?"
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
03-14-2005 04:19
Build a sim-to-sim pathfinder using a parallel terraced scan or other heuristic algorithm. You will have to be clever about how you handle the map in order to avoid A) running out of memory and/or B) the algorithm taking a day and a half to run. I have done the preliminary research & know how to do it. Now you figure it out. :)
Baba Yamamoto
baba@slinked.net
Join date: 26 May 2003
Posts: 1,024
03-14-2005 05:28
From: Cross Lament
I made a 'hopping bunny' pet script, that would follow its owner about. It was really annoying until I remembered to turn off its collision sounds. :D


That reminds me of my pet jumping bean.. It was rather wild and simcrashy in its day ;0 so i retired it to inventory.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-14-2005 17:49
Perhaps something like this will help? It's a cube-based system for getting touch coordinates, much like Alondria described:

CODE
default
{
state_entry()
{
llSetStatus(STATUS_BLOCK_GRAB,TRUE);
}
touch_start(integer total_number)
{
list spawns = [];

vector start = llDetectedPos(0);
vector height = llGetAgentSize(llDetectedKey(0));
start += (<0,0,0.85 * height.z> / 2);
vector diff = llRot2Fwd(llDetectedRot(0));

vector mypos = llGetPos();
rotation myrot = llGetRot();
vector size = llGetScale();
size /= 2;

// Unrotate our vectors...
diff /= myrot;
start = mypos + ((start - mypos) / myrot);

if(diff.x == 0) diff.x = 0.01;
if(diff.y == 0) diff.y = 0.01;
if(diff.z == 0) diff.z = 0.01;

vector zero_x = start + ((mypos.x - start.x) * diff / diff.x) - mypos; // When X = 0
vector zero_y = start + ((mypos.y - start.y) * diff / diff.y) - mypos; // When Y = 0
vector zero_z = start + ((mypos.z - start.z) * diff / diff.z) - mypos; // When Z = 0

vector temp;
// Plane: Face 0
temp = zero_z + (size.z * diff / diff.z);
if(llSqrt(llPow(temp.x,2)) <= size.x && llSqrt(llPow(temp.y,2)) <= size.y)
{
spawns += temp;
spawns += 0;
}


// Plane: Face 1
temp = zero_y - (size.y * diff / diff.y);
if(llSqrt(llPow(temp.x,2)) <= size.x && llSqrt(llPow(temp.z,2)) <= size.z)
{
spawns += temp;
spawns += 1;
}

// Plane: Face 2
temp = zero_x + (size.x * diff / diff.x);
if(llSqrt(llPow(temp.y,2)) <= size.y && llSqrt(llPow(temp.z,2)) <= size.z)
{
spawns += temp;
spawns += 2;
}

// Plane: Face 3
temp = zero_y + (size.y * diff / diff.y);
if(llSqrt(llPow(temp.x,2)) <= size.x && llSqrt(llPow(temp.z,2)) <= size.z)
{
spawns += temp;
spawns += 3;
}

// Plane: Face 4
temp = zero_x - (size.x * diff / diff.x);
if(llSqrt(llPow(temp.y,2)) <= size.y && llSqrt(llPow(temp.z,2)) <= size.z)
{
spawns += temp;
spawns += 4;
}

// Plane: Face 5
temp = zero_z - (size.z * diff / diff.z);
if(llSqrt(llPow(temp.x,2)) <= size.x && llSqrt(llPow(temp.y,2)) <= size.y)
{
spawns += temp;
spawns += 5;
}

integer i;
integer count = llGetListLength(spawns);


count = llGetListLength(spawns);
for(i = 0; i < count; i += 2)
{
temp = llList2Vector(spawns,i);
temp = <temp.x / size.x,temp.y / size.y, temp.z / size.z>;

llSay(0,"Intersection at Face " + (string)llList2Integer(spawns,i + 1) + " at " + (string)temp);
}
}
}

Like I said, some of these things were on my To Do List. In this case, the script will return a fairly rapid position on the face(s) of a cube (or the rotated bounding box of a prim) at any rotation.

The second you said "using Mouselook," Alondria, I realized it was easy. :D

You can then just use this data to "fire a bullet" at the prim, if it's something else, to get touch data for an arbitrary location.
_____________________
---
Kermitt Quirk
Registered User
Join date: 4 Sep 2004
Posts: 267
03-14-2005 18:47
From: Huns Valen
Build a sim-to-sim pathfinder using a parallel terraced scan or other heuristic algorithm. You will have to be clever about how you handle the map in order to avoid A) running out of memory and/or B) the algorithm taking a day and a half to run. I have done the preliminary research & know how to do it. Now you figure it out. :)


I actually did make a pathfinder like that once using the A* algorithm, but it A) ran out of memory on long paths, and B) took quite a few minutes to produce an average length path :rolleyes: . For debugging I also made it map out the path on a sim map made out of prims.

I was planning on putting it in a vehicle so u could just tell it which sim u wanted to go to (by sim name) and it would take u right there. If anyone manged to do this in LSL so that it was actually fast enuff to be useful I would love to see it. I gave up in the end because I just can't see how to get that sorta processing power out of LSL.

One of the features I'd really like to see the Lindens implement is functions to get sim world coordinates from a sim name and/or a sim name from world coordinates. I think that would greatly reduce the memory of something like this and make it much more practical because u wouldn't have to store the entire sim map in a notecard. BTW, when I did this SL was about half the size it is today. I doubt I could even hold the entire map in a list now.
gene Poole
"Foolish humans!"
Join date: 16 Jun 2004
Posts: 324
03-14-2005 19:46
From: Kermitt Quirk
...

I was planning on putting it in a vehicle so u could just tell it which sim u wanted to go to (by sim name) and it would take u right there. If anyone manged to do this in LSL so that it was actually fast enuff to be useful I would love to see it. I gave up in the end because I just can't see how to get that sorta processing power out of LSL.

...
Two words: parallel processing.

If you can divide the work up into independent chunks, you can have a "compute chunk" scripted object running a bunch of different sims, and then have them return the result to the controlling object. Bonus points if an arbitrary "chunk processor" can behave as a controller. :)
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-14-2005 19:56
From: Kermitt Quirk
One of the features I'd really like to see the Lindens implement is functions to get sim world coordinates from a sim name and/or a sim name from world coordinates. I think that would greatly reduce the memory of something like this and make it much more practical because u wouldn't have to store the entire sim map in a notecard. BTW, when I did this SL was about half the size it is today. I doubt I could even hold the entire map in a list now.

From Preview 1.6:
From: someone
Scripting Language Improvements:

* Allow users to query the position and status of simulators by name on the grid using llRequestSimulatorData.

PS. Yeah, you could probably store all of the data today. It would just take a while. :D
_____________________
---
Dan Marten
The Grandmaster of Doom!
Join date: 21 May 2004
Posts: 16
03-14-2005 23:12
Hmm....well, I realise you've all started talking about various things you'd like to do too, but alot of these projects are far too advanced for the likes of me. Anything simpler anybody can suggest?
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-15-2005 01:35
- Create a "Giant Bugzapper" security system
- Script a Grandfather Clock
- Script in-world instruments that play freeform (not fixed) music
- Script an automated vehicle to go from Point A to Point B
- Create a Linden out of Lincoln Logs :D
_____________________
---
Torley Linden
Enlightenment!
Join date: 15 Sep 2004
Posts: 16,530
03-15-2005 01:45
From: Jeffrey Gomez
- Create a "Giant Bugzapper" security system
- Script a Grandfather Clock
- Script in-world instruments that play freeform (not fixed) music
- Script an automated vehicle to go from Point A to Point B
- Create a Linden out of Lincoln Logs :D


Jeffrey, here's my suggestion:

Author a book...

101 Great Ideas For Projects YOU Can Do In Second Life!
By Jeffrey Gomez

:)
_____________________
1 2