A new way for scripting ? A better idea for code-conversion ?

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.

A new way for scripting ? A better idea for code-conversion ? // SDK, Plug-in & 3rd Party Area

1  |  

Post by Theo // Feb 25, 2009, 9:48am

Theo
Total Posts: 1
Hi everybody


I'm a truespace-user since version 4 or 5 and I was really enthusiastic about the free ts 7.6 in summer last year. Meanwhile, I produced some title-sequences, character-animations and special-effects for familiy-movies with it and learned a lot about advantages and disadvantages. Perhaps I can give back some of the chances truespace has already opened to me. My first idea in the forums is concerned about scripting and transfering functions of other 3d-visualisation-systems to the wonderful user-interface of truespace.


On the workspace-side, there is a brillant editor, a great animator, a comlicated, but manageable surfacer and a wysiwig-Renderer (remember the akronym of the 80ies desktop-publishing-systems, What You See Is What You Get ?). Unfortunately, there is a luck of some more sophisticated functions like follow-pathes, particles, arrays and others at the workspace-side (ts7.6/ws). On the other side of the software-"bridge", you find all these possibilities in the model-side, but no wysiwig, a weaker character animator and booleans-module, a slower performance, some crashes and so on. Therefore, my first decision was to use mainly ts7.6/ws.


To make things even more complicated, there exist free 3d-visualisation-systems with all the code for marvellous visual effects, but not in the ts-scripting context (keywords, dialect). Blender (www.blender.org) is a good example. Here you can easy obtain free scripts constructing hole cities in seconds - in python, a language which seems to be abandoned by caligari with ts7.6/ws. Unfortunately, there is no free machine-translation of python to other scripting languages (at least of my knowledge). You can sript and convert scripts manually in ts7.6/ws with jscript or vbscript, two coding-languages by Microsoft. They are mainly described in the "developer guide" of Caligari.


Or you can - as far as I have understood - use a compiler like MS-Visual Studio to add code to the system, which is mainly described in the "software development kit" of Caligari and probably is quite a hard way of enlarging ts. I do not recommend Visual Studio 2005/2008 as others do. Except for the „express“-model, it isn’t free, it has an enormous size like all MS-products and probably doesn’t understand python. I suppose it doesn't support the code-generation of jscript/vbscript in a user-friedly way.


Jscript and Vbscript can be used as interpreted laguages which is an easier way of extending a 3D-Prog. But even so, coding or just understanding what's going on in a script are not trivial tasks in ts7.6/ws. The internal editor of ts isn't bad at all, it can indent, highlight and parse the code. On the other side, it cannot display the global structure of it nor make suggestions about the syntax nor support the user in translating code from other sources. Perhaps, there is a better way to use jscript/vbscript in conjunction with transcoding from python. It lies in an external editor, from where it interacts with the code-bricks of ts-7.6/ws.


One tool, which can make life easier (the best I found after a long search) is PSPad (www.pspad.com). It can interpret python and vbscript/jscript, understand eight foreign languages, has an extensive help-system, comes with all the bells and whistles of a professional programming-editor and - best of all - it costs the same as truespace (absolutely nothing). An there is no notifier every ten minutes which invites you kindly to buy an expensive professional version. If you like PS-Pad, you can make a donation of course.


Choose e.g. the English webside, download the latest build and - if you want - also the English dictonary (in the bottom of the download side), which ensures spell checking. More important help is delivered by code-language-specific help-files, downloadable from the "external help resources" (accessible through "help files" in the left side of the menu). In our case, there is a python-file ("Python 2.5") and a doc called "ScriptHelp.msi" containing in depth-Information on both vbscript and jscript. They all can be offline-installed ("settings"-"highlighter settings"-"specification"-"help file"; refer to the Help-Topics of the program). An advantage of this solution is its offline-character (with other tools you often have to keep open an internet-connection and wait for tons of information to be transported).


I was concentrated on jscript, because there are more examples in the developer guide. As a good introcution to jscript, I suggest studying the chapter "Fundamentals" in the help-file "ScriptHelp.msi".


The attached screenshot (dualmonitor) shows a typical (blender-)python-file opened to the left and the jscript-file of the ts-landscape-generator to the right. As you see, the codes are not only indented and keyword-highlighted, there is also a structure-console to the very right, which shows the most important scripting-parts as foldable/unfoldable items. And the best is, a special key-combination on most regular expressions shows - context sensitive - the most important information about that that keyword and its spelling in a list. If it is the searched one, the insertion with all parameters is just a click away.


This intelligence is based on a so-called clip-definition-file per language (the delivered one for jscript contains already more than 1'100 lines). And you can edit/expand these files at will ! You can download a list with some of the important rosetta-specifical-keywords and their specifications (only about 50 !) from the second attached link ("JavaScript.txt"). Just search "JavaScript.DEF" in ...\PSPad editor\Context\, open it, go to the end of that file and insert the content of "JavaScript.txt" (and save, of course). From now on, you can open an empty window in PS-Pad, open ts7.6/ws, dragn'drop a code in the LE and open it, from there copy-paste the code in PS-Pad, declare it as JavaScript ("view" - "change syntax" - JavaScript") and



enjoy highlighting / indentation / spelling check (CTRL-F7 - "Spell Settings" - "English")

look at the Code explorer window for a global structure-overview (Shift-Ctrl-E)

use the log-window (CTRL-L) in the bottom of the screen to see what's going on in the script

use "Help for Language" (ALT-F1) to obtain language-specific help (full sercheable)

type CTRL-Spacebar to get help on a specific node (if contained in the clip-definition-file; for jscript in ts, you have to place the cursor in the first node of the expression before the ".")

choose of a list of nodes/commands to insert (if you hit CTRL-Spacebar out of any text, all clip-boarded suggestions appear)

do many things more (advanced search/replace with options, bookmarking, auto-completition and even build macros for editing code; take a look at the PSPad-help-system)


If you want, you can have a python-file opened just beside the jscript one and study its code by the same means (all the programs parameters change immediately after clicking in another of the two windows). After examination, construction or adaption of the jscript-code, it goes back to the LE-window of ts via copy-paste and there the new code - after passing the caligari-parser - will hopefully work as intended.


Let's summarize: The complaints about the little feature-rich plug-ins in ts7.6/ws don’t help - the solution is to look ahead and build new, even more advanced „script-bricks“ for ts7.6/ws. Perhaps these ideas animate some scripting-cracks to build/convert interesting code to ts (I will try it, too) ...


So far my very first text in a forum at all :)

Post by robert // Feb 25, 2009, 12:48pm

robert
Total Posts: 609
pic
This thing is really cool, and helpful. :jumpy:


Thanks for sharing! :D


I don't have much to thank you with so here's a banana: :banana: :p

Post by Igor K Handel // Feb 27, 2009, 8:11am

Igor K Handel
Total Posts: 411
pic
Interesting info Theo, many thanks.


the solution is to look ahead and build new, even more advanced „script-bricks“ for ts7.6/ws.


Now you if you could just devote the rest of your free time to scripting a load of animation type functions/bricks for me, I would give you as many bananas as you could eat :D


Heres a deposit up front :banana:


IK Handel
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