jScript control that can use data from external files???

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.

jScript control that can use data from external files??? // Archive: Tech Forum

1  |  

Post by ProfessorKhaos // Sep 29, 2006, 7:52pm

ProfessorKhaos
Total Posts: 622
pic
Hi all,


I would like to create a jScript control that reads in a file and uses the data together with a 'inTime' parameter to control an animation. This has to do with a visualization project I'm working on that uses tabular numerical data to feed it so I really do need to get the outside data inside the animation.


Basically, I'd have a file that had two collumns. 1st is a time field and the 2nd is a value I wish to interpolate. If inTime is before the 1st time in the file I'd like to use the 1st value for output. If the inTime is between one time in the file and the next I'd like to linearly interpolate the value and output the value from the script. If beyond the last time, just use the last value. Format would be something like the following (exclude the header lines... they're just there for illustrating contents and aren't in the real file):


inTime Value

--------------

0.0 45.0

1.1 30.2

2.3 38.3

etc...


The file can be pretty long thus it's impractical to manually keyframe. Efficiency is not an issue since I intend to render, not play the animation in real time.


I've tried to find a way to open and read a file in jScript but I can't seem to find any.


I purchased the intro to scripting course by the way. It made a lot of the concepts much easier for me and I have ideas how to use this stuff...BUT... I do need to be able to read from a file.


Alternatively, if not possible in jScript, is it possible in VBScript?



Can someone provide me with an example? I can always resort to python scripting to open files but I'd rather not take that step backwards.


Thanks in advance!


P.K.

Post by Norm // Sep 30, 2006, 2:27am

Norm
Total Posts: 862
pic
ActiveX File System Object, is what you can use to open say a text file and read it.


http://forums1.caligari.com/truespace/showthread.php?t=235&highlight=file+system

Post by ProfessorKhaos // Sep 30, 2006, 3:01am

ProfessorKhaos
Total Posts: 622
pic
Thanks Norm!!! That's exactly what I needed!!!


v/r,


P.K.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2021. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn