Script command question

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.

Script command question // Tech Forum

1  |  

Post by J90 // Sep 22, 2008, 6:54pm

J90
Total Posts: 107
Is there a script command that returns what the current animation frame is set to in the Animation editor workspace side?

Post by trueBlue // Sep 22, 2008, 7:28pm

trueBlue
Total Posts: 1761
pic
In your jScript type RsTime.

Post by J90 // Sep 22, 2008, 8:14pm

J90
Total Posts: 107
In your jScript type RsTime.

Thanks :)

When trying to use this part in a script


// The LastPos attribute is used to store the last object's position.


LastPos = params.conValue("LastPos"); //This
params.conValue("LastPos") = NewWldMatrix; // And this must be eliminated

nx = NewWldMatrix.GetTransX(); //Get new position
ny = NewWldMatrix.GetTransY();
nz = NewWldMatrix.GetTransZ();

ox = LastPos.GetTransX(); // get old position
oy = LastPos.GetTransY();
oz = LastPos.GetTransZ();

I get an error saying the object is "Null" or not an object.
So what I am trying to figure out is how to store the last position without actually having use a matrix input to get the data.

I am confusing :(

I think I have to clone the matrix data after letting go of a mouse click. Is that possible?

Post by J90 // Sep 22, 2008, 8:25pm

J90
Total Posts: 107
Both matrix data outputs update at the same time. So even if it is cloned after it is changed they will be the same.

Post by trueBlue // Sep 22, 2008, 8:40pm

trueBlue
Total Posts: 1761
pic
The Interactive Replace Tool located in the Activities - My Activities library might help you out. Check out KeepOrient in the Replace One script.

Post by J90 // Sep 22, 2008, 8:53pm

J90
Total Posts: 107
That might work. The script runs in a command object and runs constantly. Not sure though.

Post by trueBlue // Sep 22, 2008, 9:00pm

trueBlue
Total Posts: 1761
pic
No it does not run constantly. It uses a Selection Change Event. It fires a pulse to the script which runs the jScript command once every time you select an object. The script remembers first selected and last selected.

Post by J90 // Sep 22, 2008, 9:05pm

J90
Total Posts: 107
No it does not run constantly. It uses a Selection Change Event. It fires a pluse to the script which runs the jScript command once everytime you select an object. The script remembers first selected and last selected.


I am sorry. I meant the script I am making runs constantly.

Post by Johny // Sep 23, 2008, 1:10am

Johny
Total Posts: 672
pic
Hello J90, maybe information on this link usefull for your case. ;)

http://forums1.caligari.com/truespace/showthread.php?t=5337

Post by J90 // Sep 23, 2008, 8:40am

J90
Total Posts: 107
Hello J90, maybe information on this link usefull for your case. ;)

http://forums1.caligari.com/truespace/showthread.php?t=5337

Johny, thanks for the link.
I got a script working on the selection change event for now.

It works!:)

How can this be done?: If a keyboard key is Held down.
The script won't fire and if it isn't held down the script fires via a selection change event.
I tried this but it wont work.


Basically What this script I am working on does is:
You set the number of frames you want between each keyframe.
Select a joint or bone you want keyframed.
Move or rotate the bone or joint.
Select another bone or select the same bone to set the final keyframe for that bone/joint so it keeps the changes.
Continue selecting or moving.
Scrub through the animation see what happens.
Currently it only keyframes the selected bone/joint. So you can't have the bones/joints moving simultaneously. unless you move the keyframes for that object manually.

If you disable the selection change event and move any joints/bones you want to move simultaneously. Then enable it again and select a bone/or joint then they will move at the same time.

That is where a Keyboard button comes in. so you don't have to go to the LE to disable it.

Perhaps this is the script command I need to use? :RsTool.GetAsyncKeyState()
However, I don't know the parameters for it

Post by Johny // Sep 24, 2008, 12:59am

Johny
Total Posts: 672
pic
For example about how to readkey with tS scripts, please download and learn cube box game jscripts RsObj on this link. ;)

http://forums1.caligari.com/truespace/showthread.php?t=1632

Post by J90 // Sep 24, 2008, 8:14am

J90
Total Posts: 107
For example about how to readkey with tS scripts, please download and learn cube box game jscripts RsObj on this link. ;)



http://forums1.caligari.com/truespace/showthread.php?t=1632


So it is as simple as this?:

if (RsTool.GetAsyncKeyState(0x020))

{

script goes here

}


Thanks Johny.

Post by frootee // Sep 24, 2008, 8:27am

frootee
Total Posts: 2667
pic
pretty much J90.

:D

Post by J90 // Sep 24, 2008, 1:45pm

J90
Total Posts: 107
Thanks everybody that helped me. :)


I basically got the concept of this script to work


It is an auto Key framer for the workspace side.(Well technically it isn't an auto keyframer. You still have to click on an object to keyframe something.)


Inside the node is the instructions(on a separate tab)

If you keep clicking on a rigged character such as crazy bob it will key it and eventually he will warp.That however, is a bug that Truespace has. It does that even if you don't use this. It just shortens the trouble it takes to do it.:D


That isn't the purpose though. I think the Instructions covers everything

If you have any questions or suggestions you know what to do. :) Yes please do


It uses Caps Lock because everything else has a function associated with truespace and doesn't interfere with work flow unless you have to capitalize a letter.


Thanks again for helping me


Edit: Added the same script with no error message if you select a node or object without a matrix.

Post by trueBlue // Sep 24, 2008, 2:34pm

trueBlue
Total Posts: 1761
pic
Cool an interactive Keyframer. Nice one! :)
Perhaps you could put:

//System.Error("Please Select an object with a Matrix")
params.ConValue("Current_selection") = Sel

So that you would not get the Error Message.

Post by J90 // Sep 24, 2008, 2:41pm

J90
Total Posts: 107
Cool a interactive Keyframer. Nice one! :)
Perhaps you could put:

//System.Error("Please Select an object with a Matrix")
params.ConValue("Current_selection") = Sel

So that you would not get the Error Message.


You don't like the error message?:(

I added one with no message.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn