How about a tutorial for using Jscript in the L E?

Post Reply
User avatar
BNG
Chief Warrant Officer
Posts: 678
Joined: 16 Oct 2009, 03:26
Type the number ten into the box: 0
Location: Texas
Contact:

How about a tutorial for using Jscript in the L E?

Post by BNG » 24 Aug 2011, 17:33

Frootee, posted a Powerpoint version which was quite helpful, but a few more would certainly be quite useful for helping unravel some of the mysteries surrounding the Truespace Link Editor. I know it has some very powerful tools, but little seems posted about it's purpose and potential usage for TS modelers. Thanks, BNG.
:bananalove:

froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: How about a tutorial for using Jscript in the L E?

Post by froo » 24 Aug 2011, 18:12

Hey BNG.
There should be some scripts floating around and about here.
The best thing to do would be, use that ppt presentation as a
reference, and look at a jscript object/command, and play with it.
The best way to learn it is to do it. :)

froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: How about a tutorial for using Jscript in the L E?

Post by froo » 24 Aug 2011, 18:15

I'll try to upload some fun ones. But you need to play with them, change values.
One thing to note when editing: if you see a line with a period in it like this:

System.Alert("Hey there");

you can click next to the period, press the period button, to see all the
other available functions and their prototypes (what they require inside
the parentheses).

Shell1850
Chief Petty Officer
Posts: 135
Joined: 21 May 2009, 21:44

Re: How about a tutorial for using Jscript in the L E?

Post by Shell1850 » 25 Aug 2011, 01:28

How is this

This will transpose a 2 Dimensional matrix
function OnComputeOutputs(params)
{
var inMatrix = params.ConValue('inMatrix');

// Always create define output factors first
Status = 'No Matrix';
var outMatrix = System.CreateDO('Common Data Package/Number Array Data');

// Legal Dim sizes are 0 (no matrix) or 2 or more (1 is illegal)
if (inMatrix.GetDim() == 2) {
Status = 'Normal';
outMatrix.SetSize(inMatrix.GetSize(1),inMatrix.GetSize(0));
for (var i=0; i < inMatrix.GetSize(0);i++) {
for (var j=0;j < inMatrix.GetSize(1);j++) {
outMatrix.SetAt(j,i,inMatrix.GetAt(i,j));
}
}
}

params.ConValue('outMatrix') = outMatrix;
params.ConValue('Status') = Status;
}
Last edited by Shell1850 on 25 Aug 2011, 19:01, edited 2 times in total.

User avatar
BNG
Chief Warrant Officer
Posts: 678
Joined: 16 Oct 2009, 03:26
Type the number ten into the box: 0
Location: Texas
Contact:

Re: How about a tutorial for using Jscript in the L E?

Post by BNG » 25 Aug 2011, 14:59

froo wrote:I'll try to upload some fun ones. But you need to play with them, change values.
One thing to note when editing: if you see a line with a period in it like this:

System.Alert("Hey there");

you can click next to the period, press the period button, to see all the
other available functions and their prototypes (what they require inside
the parentheses).
Thanks Froo, very cool tip. I agree the best way to learn is to actually do and then share what we learn with the community as we get a better understanding of it's purpose. Perhaps someone could post some known FAQ's about the Link Editor as I've scoured the web for information on Jscript and it's mostly unrelated to usage with Truespace. The SDK documentation seems to be the most comprehensive set of documents currently available, but I guess it wouldn't hurt to have an actual TS developer shed some light for those of us interested in the Link Editor and basic functions like the Jscript Editor. Greetings to all. BNG.
:bananahi:

Shell1850
Chief Petty Officer
Posts: 135
Joined: 21 May 2009, 21:44

Re: How about a tutorial for using Jscript in the L E?

Post by Shell1850 » 25 Aug 2011, 21:07

I dusted off my train set. It a T scale (Truespace). It use Jscript function set. It is more advanced than the one I put on the caligari website. One text file describes the track layout with switches, another text file describes the train and another text file describes the car (front truck, back truck and car).

It was put on the back burner when Truespace 64 was canceled. If you want to learn about JSript, this will keep you busy.

froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: How about a tutorial for using Jscript in the L E?

Post by froo » 25 Aug 2011, 21:30

Cool Shell.
Where we can we download it?

User avatar
trueBlue
Captain
Posts: 1627
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: How about a tutorial for using Jscript in the L E?

Post by trueBlue » 26 Aug 2011, 02:06

I was very impressed with your project! Looking forward in seeing your update.

Shell1850
Chief Petty Officer
Posts: 135
Joined: 21 May 2009, 21:44

Re: How about a tutorial for using Jscript in the L E?

Post by Shell1850 » 26 Aug 2011, 02:40

I am reminded of the cartoon in a computer magazine where the salesman would hold a bundle of wires, transistors and resisters and say "This is what we have today."

I am removing any diagnostic bricks. Trying to clean extra programing. Need to clean up the program so not to be embarrassed by the pro's. Reminds me when my mom had me vacuum the floor the day before the cleaning woman would show up. I will download a basic program, objects and configuration files.

Post Reply