[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AW: to activate different timer per script



andrea hi -

maybe just the simple bug in your code (?) second and third if statements
test same value, so your condition tests will never loop. if you're seeing
tow clicks working, then the code locking, it could simply be that...

if this isn't the bug you could just use the same technique i mentioned, and
rather than using three diff SFNode fields (as in your script below) just
use three different SFTime -> startTime routes.

btw I think the mustEvaluate and directOutput fields re ignored by all
browsers in the market right now. Your script shouldn't break; all events
are evaluated, these fields are really for optimisation, but good to leave
in the code as you have for forward compatibility.

dc

At 09:27 PM 10/26/97 +0100, Andrea wrote:
>
>> can't see a problem with your code, but areas where you're accessing
>> the
>> properties of nodes from within scripts have been a bit buggy in the
>> past.
>> couldn't you route the timestamp from the function directly to the
>> timer?
>> 
>> 
>>         eventOut SFTime startTime;
>> 
>>         function activate(value, ts) {
>>                 startTime = ts;
>>         }
>> 
>>         ...
>> 
>>         ROUTE ani.startTime TO TIMER_start.startTime
>> 
>hi david,
>
>thank you for your answer ! I'm glad to get feedback from construct !
>	:-)))
>(its not easy to make compliments with my little english vocabulary)
>Now problem is:
>I have to decide inside the script to which timer the TimeEvent should
>be sent.
>My whole programm is more complex,
>here I've the ani Script more detailed:
>
>Regards
>andrea
>
>
>
>> DEF TIMER_A-B TimeSensor { loop FALSE cycleInterval 5 },
>> DEF TIMER_B-C TimeSensor { loop FALSE cycleInterval 5 },
>> DEF TIMER_C-A TimeSensor { loop FALSE cycleInterval 5 },
>> 
>> DEF ani Script {
>> 	directOutput TRUE
>> 	mustEvaluate TRUE
>		eventIn SFBool activate_8-15	
>		field SFNode timerA-B USE TIMER_A-B
>		field SFNode timerB-C USE TIMER_B-C
>		field SFNode timerC-A USE TIMER_C-A
>		field SFInt32 status 
>		url [ "javascript:
>> 	       function activate_8-15(value, ts) {
>> 		if (value == TRUE && status == 0) {
>> 			timerA-B.set_startTime = ts;
>			status = 1;
>> 		} 
>			else if (value == TRUE && status == 1) {
>> 			timerB-C.set_startTime = ts;
>			status = 2;
>> 		}
>			else if (value == TRUE && status == 1) {
>> 			timerC-A.set_startTime = ts;
>			status = 0;
>> 		}
>> 	        }
>> 	",]
>> }
>> ROUTE cylTouch.isActive TO ani.activate_8-15	
>> 
>> 
>
_______________________________
          david collier              creative director
          dc@construct.net           www.construct.net

-------------------------------------------------------------------
*** Please send administrative requests to <majordomo@sdsc.edu> ***
-------------------------------------------------------------------