time/frame !

Discuss problems and solutions.
Post Reply
rotallicso
Newbie
Posts: 16
Joined: 03 Jan 2012 17:15

time/frame !

Post by rotallicso »

tearing my hair out

i want to control a fader that is driven by a script involving time
it means i need to use an On Frame execution - i think - but this
creates all sorts of secondary problems with my switch to enable/disable the fader movement

so i've reduced it to something very simple - i think i'm missing something conceptually
i've tried a hundred strategies all with varying and surprising outcomes
usually resulting in my switch being ineffective or the movement only occurring at the instant i press the switch (like a sample and hold)

try this and tell me the missing concept to save my hair, not much left

One fader One switch
Script as follows (in Fader)
Fader.x = time % 1;

No matter what i try with the Switch.x value i cannot control the Fader or Script to play nice

i just want to use the switch to turn of the motion, how do you do it, it MUST be simple simple simple

things are a bit more complicated in my real world example, but this example reveals my roadblock just as well

any hints ?!

cheers
Joe Soap
Regular
Posts: 462
Joined: 07 Jul 2012 15:04

Re: time/frame !

Post by Joe Soap »

This will configure the switch to turn your script on / off - script attached to Fader, exec onframe:

if(Switches.x){
x = time % 1;
}




Script attached to Switches, exec onframe:

if(x){
Fader.x = time % 1;
}
rotallicso
Newbie
Posts: 16
Joined: 03 Jan 2012 17:15

Re: time/frame !

Post by rotallicso »

Perfect thanks, that should be an easy approach to incorporate. I wish I fully understood why the seemingly logical strategies I tried didn't give me such a responsive UX, but grateful to have an example of how to organise the scripts. Thanks again : - )
Joe Soap
Regular
Posts: 462
Joined: 07 Jul 2012 15:04

Re: time/frame !

Post by Joe Soap »

It might be a good idea to post a couple of examples of your previous attempts so we* can walk through the logic - though the basics of what I posted are covered in the manual:

Chapter 11 - Advanced Scripting
11.1 Conditional statements
• if
When the parser finds an if in the Script panel, it expects a boolean condition, that is, a logical proposition having one of two values: true (non-zero) or false (zero). If the condition is true, the parser executes the single line or block of code immediately after the condition, which, in the case of a block of code, will be enclosed within braces {}. If the condition is false, the statement in the single line or block of code is ignored.

* Not necessarily me, I'm crap at this!
Post Reply