|
|
Basic Scripting Tutorial Available in this Thread
About Truespace Archives
These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.
They are retained here for archive purposes only.
Basic Scripting Tutorial Available in this Thread // Roundtable
Post by frootee // Aug 12, 2007, 5:55am
|
frootee
Total Posts: 2667
|
Hi Folks. I have assembled a very basic introductory tutorial to scripting and the LE. It takes you step by step through the script creation process. It is in powerpoint format, and I have included a free powerpoint viewer from Microsoft.
Please let me know what you think. I feel this will help others get their feet wet and build confidence in their LE and scripting skills.
Enjoy! If you like it more's coming!
Froo |
Post by nowherebrain // Aug 12, 2007, 6:47am
|
nowherebrain
Total Posts: 1062
|
Oh Yes, please....I know I could tackle this beast on my own...I just don't have the time to do the tinkering....Thanks a million!!
Keep em' comin'. |
Post by Emma // Aug 12, 2007, 6:55am
|
Emma
Total Posts: 344
|
Wonderful tutorial, wish something like this would have started already last year.
INFORMATION: your powerpoint file can also perfectly be seen if one uses the free Open Office (I use it also to create PDF files):)
- for myself I have in mind that "methods" are similar like "formulars" they have input, output and something happens in between. Programmers always like to phrase their language very important, this way words like "methods" get created;)
You use in your description already "integer" and "string". If that's a question for anyone, for myself I explain it always with breakfast:confused:
- typical german breakfast would be coffee, bread, butter and jelly
- typical amercan breakfast would be ham, egg, toast, peanutbutter and jelly (at least I got it always in NJ)
Well, a programm needs also something to "eat", of course data. And this data can be all kind of stuff. But while humans had an evolution time of millon years, programs exist for about 80 years now (if we leave out genious Ada comtess of Lovelace). So while our body knows what to do with all the ingrediances of bread, butter or ham and eggs, the computer has to be told by their developing engineers what to do with the input.
These 80 years are a quite short time and so we just can't simply talk with our pc as we do with friends or neighbours. So far they only know for a limited number of ingrediants what to do.
These are so fa mainly numbers, characters or bundles of characters which are called strings.
Numbers now can be expressed in different ways as there are for example
- integers = whole numbers, no fraction, no decimal point
- floating = numbers with a decimal point
Chracters are mainly handled by
- string = character (s) from single to a long row of characters
There are a lot of others, each one representing a special code that can be interpreted and handled from the script code inside the methods. |
Post by nowherebrain // Aug 12, 2007, 7:38am
|
nowherebrain
Total Posts: 1062
|
Wonderful tutorial, wish something like this would have started already last year.
INFORMATION: your powerpoint file can also perfectly be seen if one uses the free Open Office (I use it also to create PDF files):)
Open Office=yummy
- for myself I have in mind that "methods" are similar like "formulars" they have input, output and something happens in between. Programmers always like to phrase their language very important, this way words like "methods" get created;)
sounds like "function" to me...(or action...function is the little brother that can be called inside action)
You use in your description already "integer" and "string". If that's a question for anyone, for myself I explain it always with breakfast:confused:
integer=whole number eg:10
float,floating point,fp=all other numbers eg:9.99
string=generally a group of characters..eg: "smile@ your m3ss!" inside the quotations
- typical german breakfast would be coffee, bread, butter and jelly
- typical amercan breakfast would be ham, egg, toast, peanutbutter and jelly (at least I got it always in NJ)
- typical german breakfast would be coffee, bread, butter and jelly(and nuttella
- typical amercan breakfast would be ham, egg, toast, peanutbutter and jelly
...or just coffee and a smoke if you are Nowherebrain:mad: (grumpy in the AM)
Well, a programm needs also something to "eat", of course data. And this data can be all kind of stuff. But while humans had an evolution time of millon years, programs exist for about 80 years now (if we leave out genious Ada comtess of Lovelace). So while our body knows what to do with all the ingrediances of bread, butter or ham and eggs, the computer has to be told by their developing engineers what to do with the input.
yeah, they're kinda dumb.
These 80 years are a quite short time and so we just can't simply talk with our pc as we do with friends or neighbours. So far they only know for a limited number of ingrediants what to do.
These are so far mainly numbers, characters or bundles of characters which are called strings.
or variables
Numbers now can be expressed in different ways as there are for example
- integers = whole numbers, no fraction, no decimal point
- floating = numbers with a decimal point
Chracters are mainly handled by
- string = character (s) from single to a long row of characters
There are a lot of others, each one representing a special code that can be interpreted and handled from the script code inside the methods.
Wow, I commented all that nonsense thinking you may not know exactly what you were saying...only to find out...I am an idiot and never read the whole way through your message....
I am an idiot...
on a side note I hate home-made buzz words like methods, at least when a word already exists...like Romans "methods" rambling about things in tS..it just makes things confusing...I still am not sure what he is reffering to.
Anyway I've wasted enough time saying nothing....I'm going to take the day off(first time since the site has been up) and go check out this tut! |
Post by frootee // Aug 12, 2007, 7:40am
|
frootee
Total Posts: 2667
|
Thanks for pointing that out Emma regarding character strings. A string is a string of alphanumeric characters, like this:
This is a character string
A character string 'constant' value is usually enclosed in double quotes:
"This is a character string"
I'll start churning them out. I may pick some scripts from these forums and Frankenstein them; i.e. take bits and pieces and assemble something simple, and write a tutorial on the result. Then, build up to more complicated stuff. This way, folks can start with the basics, then see how new stuff is added on, then experiment by doing the same on their own.
Froo |
Post by nowherebrain // Aug 12, 2007, 7:43am
|
nowherebrain
Total Posts: 1062
|
Much of the time I rehash code from my game...little functions and stuff...no shame in that. Kinda odd I beat you to the last post...just kinda wedged between your comment to Emma. |
Post by spacekdet // Aug 12, 2007, 7:44am
|
spacekdet
Total Posts: 1360
|
Make mine French Toast. |
Post by nowherebrain // Aug 12, 2007, 7:46am
|
nowherebrain
Total Posts: 1062
|
And coffee, right? |
Post by weaveribm // Aug 12, 2007, 7:51am
|
weaveribm
Total Posts: 592
|
Thanks frootee!
A string I remember was the first computer thing that puzzled me back when and I had to look it up on the abacus. If we started again what would we call it I wonder. Using the Rosetta paradigm perhaps. An infundibulus? :)
The little ringbound BASIC book <sigh> ah there it is. Donald Alcock's 'Illustrating BASIC'. We needed pictures back then too :)
Peter |
Post by frootee // Aug 12, 2007, 8:11am
|
frootee
Total Posts: 2667
|
Actually, in the tutorial I have a single page that digresses to asking the question: What does Method mean? If you want to know the answer, read the tutorial! :)
Actually, the term Method was not coined by Roman. The term Method is also used in Object Oriented Programming terminology.
If you think that's bad, try learning Unix shell scripting. Now what were they thinking? I have heard that Unix programmers way back when were lazy typists so they used shortcuts (hotkeys so to speak) for searching files, editing (think: vi), parsing, etc. Look up: regular expression. That means nothing to me too, but I use them anyway.
Archaic terminology, but once you learn how to do it, man can you fly!
And that's the point of this tutorial series too. To help the truespace community learn...
To Fly. |
Post by stan // Aug 12, 2007, 8:17am
|
stan
Total Posts: 1240
|
at least in jscript a string can ne represented two ways
"This is a character string"
or
'This is a character string'
I like the lazy way, no shift required :rolleyes:
'number ' refers to - floating = numbers with a decimal point in the jscript 'add new attributes' |
Post by 3dvisuals dude // Aug 12, 2007, 9:11am
|
3dvisuals dude
Total Posts: 1703
|
Hi Folks. I have assembled a very basic introductory tutorial to scripting and the LE. It takes you step by step through the script creation process. It is in powerpoint format, and I have included a free powerpoint viewer from Microsoft.
Please let me know what you think. I feel this will help others get their feet wet and build confidence in their LE and scripting skills.
Enjoy! If you like it more's coming!
Froo
http://www.addis-welt.de/smilie/smilie/schild/1044821796.gif
Finally... finally... A SIMPLE tutorial where I don't have to put my perceptions through a meat grinder or change my religion to accomplish something BASIC...
Thank you. This is great Frootee.
- 3dvisuals dude |
Post by nowherebrain // Aug 12, 2007, 9:13am
|
nowherebrain
Total Posts: 1062
|
Yes, again, thanks froo... free coffee all around!!! |
Post by frootee // Aug 12, 2007, 9:32am
|
frootee
Total Posts: 2667
|
Thanks Guys.
3dv, I am especially interested in your feedback. Let me know what you think, and show me something!
Froo |
Post by nowherebrain // Aug 12, 2007, 9:37am
|
nowherebrain
Total Posts: 1062
|
Yes, and this is probably something a lot of us(me, maybe...not sure yet)can add to. it is easy enough to edit or add to and one day could serve as a very comprehensive guide to scripting in tS. |
Post by frootee // Aug 12, 2007, 9:49am
|
frootee
Total Posts: 2667
|
absolutely!
And one thing I forgot to put into the tutorial:
Homework: Follow the steps I put in there, and post your results here in this thread, with your own stuff, even if it's just a change of name for the script. Learn by doing!
EDIT: nowherebrain: please post this on your website if you want. The more exposure the better. :-D
Froo |
Post by Délé // Aug 12, 2007, 10:07am
|
Délé
Total Posts: 1374
|
Nice Work Froo! :) :banana: |
Post by 3dvisuals dude // Aug 12, 2007, 10:50am
|
3dvisuals dude
Total Posts: 1703
|
Thanks Guys.
3dv, I am especially interested in your feedback. Let me know what you think, and show me something!
Froo
I love it! That's my "feedback!":D
I'd also love to "show you" something but that's the whole point.... until you finish this I don't even know how to do that! Hahahaha!!!
I need to know (as does the ~HUGE~ silent majority here) the absolute newbie beginner basics of working with the Link Editor ~FIRST~ before I can do anything significant with developing interactivity within immersive FPN environments myself.
Watch out though Frootee... if you can get me over THAT hurdle I'll be burying you with contributions, just watch!!!!:D
I suspect lots of other folks at that time will suddenly also be finding their wings with trueSpace at long last too.;)
This is great... don't let up!
- 3dvisuals dude |
Post by Délé // Aug 12, 2007, 12:12pm
|
Délé
Total Posts: 1374
|
I need to know (as does the ~HUGE~ silent majority here) the absolute newbie beginner basics of working with the Link Editor ~FIRST~ before I can do anything significant with developing interactivity within immersive FPN environments myself.I made a very simple little LE tut a while back HERE (http://forums1.caligari.com/truespace/showthread.php?t=2928) that might be a start. |
Post by nowherebrain // Aug 12, 2007, 12:38pm
|
nowherebrain
Total Posts: 1062
|
I'm more used to seeing things as such....
var obj1_dist;//empty var
var obj2_dist;//
var number = 50;
function(SDS_by_dist)//call this if in camera view
{
obj1_dist = object that you plugged in;
obj2_dist = object that you plugged in;
if((vector math here to calc the dist between obj1_dist/obj2_dist) < number)
{
appropriate code to set SDS level or something;
}
else
{
null;
}
}
These are not real principals or terms necesarilly....I'm just wondering is this possible currently?? |
Post by Délé // Aug 13, 2007, 5:02am
|
Délé
Total Posts: 1374
|
These are not real principals or terms necesarilly....I'm just wondering is this possible currently??So you want to increase the a mesh resolution depending upon how near you are to it? If so, yes that should be possible to an extent. One way I can think of is to use the distance trigger to apply SDS to an object when you get near it, and remove the SDS when you move away. Should actually be very easy.
I can whip up a quick example if you're interested? Could actually be a useful tool for tP scenes. |
Post by frootee // Aug 13, 2007, 5:10am
|
frootee
Total Posts: 2667
|
This sounds very similar to LOD (Level Of Detail) in VRML scenes. I think someone mentioned that awhile back.
I wonder then, as another option, if a couple of LOD objects would occupy the same space, and as an avatar approaches, the low detail object is set to invisible, and the higher level object is set to visible.
Just another thought.
Froo |
Post by 3dvisuals dude // Aug 13, 2007, 5:13am
|
3dvisuals dude
Total Posts: 1703
|
I made a very simple little LE tut a while back HERE (http://forums1.caligari.com/truespace/showthread.php?t=2928) that might be a start.
That's an EXCELLENT "little LE tut" you made there Délé!
Thank you!!!
- 3dvisuals dude |
Post by 3dvisuals dude // Aug 13, 2007, 5:15am
|
3dvisuals dude
Total Posts: 1703
|
You guys are getting me so excited with all these possibilities here I think I may have to go take a very cold shower to calm down.
Thanks everybody.:)
- 3dvisuals dude |
Post by Délé // Aug 13, 2007, 6:44am
|
Délé
Total Posts: 1374
|
This sounds very similar to LOD (Level Of Detail) in VRML scenes. I think someone mentioned that awhile back.
I wonder then, as another option, if a couple of LOD objects would occupy the same space, and as an avatar approaches, the low detail object is set to invisible, and the higher level object is set to visible.
Just another thought.
Yeah, that's what I was thinking too. Technically it should work, although it would be quite tedious to set up an entire scene.
Does anybody know if having objects invisible reduces the load of the scene? If so, it would also be very easy to script an LOD tool where you can have multiple (commonly 3) meshes at different resolutions that will show up depending upon the distance of the avatars to the objects.
The thing to remember here though, is that when you have multiple avatars in an online environment, scripts like this may not be as useful because it's not processing LOD's locally. So the resolution of objects would be dependent upon "any" avatar near objects, not just you. If people are spread out in different areas of the scene, all objects could be at their highest resolution for everyone.
Still, scripts like this could have practical applications with regards to scenes with limited avatars. |
Post by 3dvisuals dude // Aug 13, 2007, 6:49am
|
3dvisuals dude
Total Posts: 1703
|
Hi Délé, sorry to barge in here but I'll make it brief.
What you just suggested sounds very similar to a "Magic Door" which W!ZARD and I had discussed previously here and would be very cool... details in Post#1 of the "Object Yard" thread.
Thanks, - 3dvisuals dude |
Post by frootee // Aug 13, 2007, 10:02am
|
frootee
Total Posts: 2667
|
Yeah, that's what I was thinking too. Technically it should work, although it would be quite tedious to set up an entire scene.
Does anybody know if having objects invisible reduces the load of the scene? If so, it would also be very easy to script an LOD tool where you can have multiple (commonly 3) meshes at different resolutions that will show up depending upon the distance of the avatars to the objects.
The thing to remember here though, is that when you have multiple avatars in an online environment, scripts like this may not be as useful because it's not processing LOD's locally. So the resolution of objects would be dependent upon "any" avatar near objects, not just you. If people are spread out in different areas of the scene, all objects could be at their highest resolution for everyone.
Still, scripts like this could have practical applications with regards to scenes with limited avatars.
Hm.
I wondered about that, but, what each user sees is dependent upon their POV. So it seems that this sort of thing (LOD on a per object basis) should/could also be dependent upon the POV. I think collision detection is in place right? I saw in the Thursday night chat someone got stuck in a cage via collision detection (CD). CD is based on distance between objects. So couldn't the methods applicable to CD be applied to LOD?
Froo |
Post by Délé // Aug 13, 2007, 10:51am
|
Délé
Total Posts: 1374
|
Hm.
I wondered about that, but, what each user sees is dependent upon their POV. So it seems that this sort of thing (LOD on a per object basis) should/could also be dependent upon the POV. I think collision detection is in place right? I saw in the Thursday night chat someone got stuck in a cage via collision detection (CD). CD is based on distance between objects. So couldn't the methods applicable to CD be applied to LOD?
It may be possible to find a way to script it so it process locally. The only way I currently know how to do it though, would only process on the server side I think.
What you just suggested sounds very similar to a "Magic Door" which W!ZARD and I had discussed previously here and would be very cool... details in Post#1 of the "Object Yard" thread.
If I understand right, the magic door was to become visible, open, close, and then become invisible again. Is that correct? Wait until you see what I made today...hee hee hee. It will not only make the magic door possible, but also many, many, many other things.
I'm going to try to make a short video again to show how to use it and upload it either later tonight or tomorrow sometime. |
Post by 3dvisuals dude // Aug 13, 2007, 12:36pm
|
3dvisuals dude
Total Posts: 1703
|
If I understand right, the magic door was to become visible, open, close, and then become invisible again. Is that correct? Wait until you see what I made today...hee hee hee. It will not only make the magic door possible, but also many, many, many other things.
I'm going to try to make a short video again to show how to use it and upload it either later tonight or tomorrow sometime.
Oooooh....
A genuine Major Tease Moment here I see...
I'm diggin' it!!!:banana:
I never know what you'll come up with next...
http://www.smileyskit.com/guns-vehicles-smileys_files/spacecraft.gif
- 3dvisuals dude
PS: "Yes" that was correct... but somehow I think you have something better in mind...;) |
Post by nowherebrain // Aug 14, 2007, 10:50am
|
nowherebrain
Total Posts: 1062
|
Well I wanted to do 2 levels of sds actually....I only see one inside a given object when applied....I am still new to this...I have some experience with programming, but this seems foreign to me somehow...I don't know all the keywords and what they do(in laymens terms)???? |
|