naming convention in scripts

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.

naming convention in scripts // Archive: Tech Forum

1  2  3  |  

Post by Alien // Sep 12, 2006, 2:02pm

Alien
Total Posts: 1231
pic
If tS supported the use of a 3rd party/external editor for the code [e.g. Notepad or PSPad (http://www.pspad.com/en/)] then you could work in that & if something happened in tS you'd still have your code in the other app. You could always copy'n'paste [from/to tS] it though, I suppose.

Post by frootee // Sep 12, 2006, 5:26pm

frootee
Total Posts: 2667
pic
well, Alien, I suppose it's possible to use a jscript command that opens a notepad text file. That's one way of ensuring the script doesn't get blown away.
Not sure of the exact syntax (YET), but I would suspect it is something like:

System.load("C:\myscripts\easybutton.js", read)

but you also may need to close it / release the file handle when done:

System.close("C:\myscripts\easybutton.js")

That depends on whether jscript automatically closes files at the end of the script (I would not count on that! )


Here's a link to an example:

http://ns7.webmasters.com/caspdoc/html/jscript_file_object_openastextstream_method.htm

Frootee

Post by Alien // Sep 12, 2006, 10:03pm

Alien
Total Posts: 1231
pic
PSPad has some scripting capabilities, which might come in handy [possibly to send the data back to tS? such things are WAY beyond me], but I was thinking that PSPad might interest the programmers/scripters on here with it's highlighting abilities. Although by default it isn't set up to highlight the different elements of a js/vb script, you could create a multi-highlighter profile [the only multi-highlight profile it comes with is for HTML].


http://homepage.ntlworld.com/alien42/images_for_caligari_forum/multi-highlighter.jpg

Post by stan // Sep 13, 2006, 3:40am

stan
Total Posts: 1240
pic
Alien, not sure that would be too handy to learn..you can check your script with commit..which points out errors..then as a scripting newbie you need to test them as you go..[at least I do]
one issue is once you leave the script editor to test it, you lose your undo..which is already not very good..poor at best..
I can write them in visual studio where the undo works, but the import to ts7 hassle and the pop up list of functions in SE when you type might not be there..the attributes..
it would be great using an external editor, then I could enlarge the font which is way too small for me to work easily..:D

but lets get back to the script..pun intended :)

Post by Alien // Sep 14, 2006, 3:02pm

Alien
Total Posts: 1231
pic
Alien, not sure that would be too handy to learn..you can check your script with commit..which points out errors..then as a scripting newbie you need to test them as you go..[at least I do]

It was just an idea. :) It makes for a very nice alternative to Notepad for anything you might use a text editor for [except word processing, as it's not intended for that, though it does have a spell check function]. I mostly use it for .ini files & looking at html source code [for blocking ads, etc].


one issue is once you leave the script editor to test it, you lose your undo..which is already not very good..poor at best..

Oh? I would have thought it would be tied to the Player undo, which is meant to be significantly improved over that of the Modeler. PSPad's is not bad, though basic - you can't skip steps &/or undo something several steps ago without undoing everything between where you are & where you want to go back to as well, like you can with Paint Shop Pro [I mean the image handling side of PSP, not really done anything with it's scripting (Python) capability].


I can write them in visual studio where the undo works, but the import to ts7 hassle and the pop up list of functions in SE when you type might not be there..the attributes..

I haven't tried scripting in tS yet, but I get your point.


it would be great using an external editor, then I could enlarge the font which is way too small for me to work easily..:D

I have looked at it, & the text is too damned small period! Nevermind just for you. :(

Post by peterma // Sep 15, 2006, 12:15am

peterma
Total Posts: 48
This should be close to 'scene render attributes settings', but most likely need to be polished more.

Just place the object to the scene and press the first or second button. Best if you are in Default layout. If you get an error message, go inside the object and execute 'RA Seeker' command manually (by its green button).

Post by Cayenne // Sep 15, 2006, 3:57am

Cayenne
Total Posts: 144
pic
Hi Peter,


here when I run the object ,you are correct an error is displayed if the outside buttons are used in a custom layout or other than default, entering the object and manually running RA seeker then allows for the buttons to be used from outside of the object.

Post by peterma // Sep 15, 2006, 5:02am

peterma
Total Posts: 48
This one works much better here - it can change scene render attributes for majority of standard layouts (Defaul, Dual, Wide, 4View, ....). Several layouts (like Developer) seems to not have render attribute object included by default, so my command cannot locate it.

I hope someone can improve this small demo and make really nice render attribute presets.

Post by stan // Sep 15, 2006, 7:10am

stan
Total Posts: 1240
pic
Thank you Peterma..this script even works in my stripped down custom layout [based on floating] :banana:

thanks again for taking the time, I know it will help me and others understand scripting a bit better..:D :D

now to see if I can get an icon to run your scripts..woohoo:jumpy:
Gord :cool:

Post by stan // Sep 15, 2006, 9:12am

stan
Total Posts: 1240
pic
well I created a set of render settings icons that work, but only in my custom layout..:rolleyes:

well I will try and figure out why they won't work in other layouts


I created an encapsulated node in system called "Render Attributes" with all the jscript nodes in it..

one of the icon commands are "Activity.Run("/Render Attributes/SetWire" ) "

Post by stan // Sep 15, 2006, 9:48am

stan
Total Posts: 1240
pic
here is what I've done so far..:D they works in my custom layout based on floating..maybe someone can help me figure out why it doesn't work in the other layouts.

import the RenderAttribute.RsLibBtn to button library [it's a library not a button, use import library]..then load into workspace
import RenderAttributes.RsObj into script objects library then put it in the LE in /System..

Post by stan // Sep 15, 2006, 3:11pm

stan
Total Posts: 1240
pic
I noticed the scripts work fine in my three window custom layout [stack ,LE, one workspace {no layout tabs window}]..I can open extra player views but their render setting don't change with my render icons :confused: ..adding command prompt windows etc. don't effect it..it all still works in my original workspace..

but if I hold ctrl and drag a toolbar to dock it outside the workspace it creates the extra window around my workspace with the layout tabs and a white space where there are no icons, then the render icons[& scripts] stop working..
it seems to have a problem with "Border docking"..

I didn't change Peterma's scripts..just how to activate them is different, I did it by using an icon..:D

any ideas guys?? :confused: :confused:

Gord :cool:

Post by peterma // Sep 15, 2006, 10:29pm

peterma
Total Posts: 48
script itself is limited a bit - it changes the first RAs that it find - so if you have more player views, it only affect one of them, at it can happen that it changes RA of 2d view if it has been formerly an 3d view, so you see no visual change when you execute the command. I'll try to improve it later.

Post by stan // Sep 16, 2006, 1:38pm

stan
Total Posts: 1240
pic
Thanks Peterma..:banana:

I noticed you can get it to work in default :banana:
..you can try a few ways..use the Render Attributes node posted here instead of the one in the zip back a few posts..you might have to get it kick started :D by clicking the grey button on this node, or try just going into the original Render Attributes node [from the zip] and click start on the RA Seeker node..:)

changing layouts seems to effect it, the icons stop working ..so it needs coaxing

Gord :cool:

Post by stan // Sep 16, 2006, 2:20pm

stan
Total Posts: 1240
pic
some one try this full layout:) ..unzip and import it to your layout library and give it a try..the layout needed a "Player Rendering" node added to the Windows Manager Space so I thought this would be easier..it should have the render settings icons already to go..although it may need a kick start by clicking start on the RA Seeker node.. System /Render Attributes /RA Seeker

Post by stan // Sep 17, 2006, 12:09pm

stan
Total Posts: 1240
pic
this version works in every layout except developer..just load icons in each layout..save your layout..
you can switch layouts and they keep working :)

it can in "floating" layout if a player rendering node is added in the Windows Manager Space..I will up load the modified layout if requested :)

it will work in FullRA [from last post] version of Full layout

INSTALL:
import the RenderAttribute.RsLibBtn to button library [it's a library not a button, use import library]..then load into workspace
import RenderAttributes.RsObj into script objects library then put it in the LE in /System..

ISSUES:
in dual or 4 view it only works in one 3d player window

there is an error message when closing ts7..maybe Peterma can shed some light on why that happens :confused:

Gord :cool:

Post by GraySho // Sep 17, 2006, 12:30pm

GraySho
Total Posts: 695
pic
I haven't tried your full layout yet, but it seems you found a way to save a layout without stackview (library)?

Post by stan // Sep 17, 2006, 12:37pm

stan
Total Posts: 1240
pic
GraySho..no as is the LE and stack are open behind the main workspace..just close them and resave..I think you would need a script & icon so you could save the Full layout without the layout library in view..:D I'll see what I can do about that..

Post by trueBlue // Sep 17, 2006, 2:12pm

trueBlue
Total Posts: 1761
pic
Hey Stan,
In Full view you can call
D3DView.ShowRenderAttribsForLayer('{00FB4B51-4BBF-4C20-AABB-09A6F7779899}')
and this will show Layer Render Attributes panel on the desktop. Then maybe you can change the Values you want from /Desktop/Player - Rendering or try this path after you run the above command:
"/Project/Windows Manager Space/Frame Window/Border Docking Place/Frame Window, 2/Layer Render Attributes",
Hope this helps.

Post by stan // Sep 17, 2006, 4:12pm

stan
Total Posts: 1240
pic
Thanks trueBlue.. in the Full layout when I added the player rendering node
the RA Seeker could find it..[ I think it's because all the layouts are not built from the same one, some things are missing, or are an old setup]..
the idea is not to have to open the panels..

I figured out how to use the commands in the xml docs..like
WindowsManager.LoadLayout('\\RS Configurations\\full2 Layout.rsl');
you just need to find the class name WindowsManager. type the period and a drop list of those commands appears..but no save layout in the lot..:D

Post by stan // Sep 19, 2006, 7:42am

stan
Total Posts: 1240
pic
here is another simple icon for turning the player ground on or off..works in most layouts

INSTALL:
import the Ground.RsBtn to a button library, then load into workspace
import GroundAttributes.RsObj into script objects library then put it in the LE in /System..

Post by stan // Sep 19, 2006, 11:03am

stan
Total Posts: 1240
pic
here's one that replaces the ground with a grid (object)

INSTALL:
import the Ground.RsBtn to a button library, then load into workspace
import GroundAttributes.RsObj into script objects library then put it in the LE in /System..
import the Grid.RsLibObj ( use import library) into the Objects library

Post by b_scotty // Sep 19, 2006, 12:01pm

b_scotty
Total Posts: 176
pic
Stan, you are like a machine! :)
Go, Stan, GO!! :banana::banana::banana:

Post by Steinie // Sep 19, 2006, 12:05pm

Steinie
Total Posts: 3667
pic
Stan,
You might consider putting all your work here too.
http://www.truespacelibrary.com/tl/

Post by trueBlue // Sep 19, 2006, 1:00pm

trueBlue
Total Posts: 1761
pic
Very cool Stan!

If you go into your Library Item/gridmodel/Transform and remove the wire that is exported from the WldMatrix, the widget will not show when you click on your gridmodel.

Thank you!

Post by stan // Sep 19, 2006, 1:46pm

stan
Total Posts: 1240
pic
guys there is a new version with a no select grid replacing the original zip in my last post:banana:

thanks trueBlue
I figured out a method before I read your post..posted a sample below

thanks Steinie..I keep forgetting about that place :D

thanks b_scotty..glad you like them..:)

Post by stan // Sep 21, 2006, 11:13am

stan
Total Posts: 1240
pic
got side tracked..I have been creating object render icons, trying to get them hooked up to the widget..:D

the side track was getting the mouse wheel to rotate the view as well as zoom..
here it is
INSTALL:
import the Background..RsObj into UI/ Mouse library..
go to System /Widgets /Tools [save a copy of the original Background in UI/ Mouse library] delete Background replace it with the one that you imported..

now you should have scrollwheel rotate when you click and [hold] drag the scroll wheel.. :banana:

Post by GraySho // Sep 21, 2006, 1:20pm

GraySho
Total Posts: 695
pic
Excellent, I think that's something a lot of people have been looking for. It deserves a thread on it's own. Amazing what you are cranking out recently.

Post by b_scotty // Sep 21, 2006, 3:13pm

b_scotty
Total Posts: 176
pic
Very cool Stan!
I think its amazing that users are able to change the functionality of the program to suit their own tastes. I don't know of too many other apps that allow the user such freedom. Kudos to Caligari for this! :) :banana::banana::banana:

Post by stan // Sep 22, 2006, 9:10am

stan
Total Posts: 1240
pic
is anyone having trouble getting the scrollwheel rotate to work?? I noticed it needs coaxing when you first install
..it works in every layout and multiple windows..
if you need help to get it working just ask..


ok guys, here is the first version of Object render presets..I haven't got them working with the obj widget properly yet..:D

INSTALL:
import the Object Render Tools.RsLibBtn to the button library[it's a library], then load the button into workspace
import HideObjectss.RsObj into script objects library then put it in the LE in /System..
[don't forget to "save state" to default.ctx and backup_default.ctx so you don't lose your setup]
ISSUES:
the alert message doesn't always show when there is no object selected, some times you get a script error..:confused: ....
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