ScriptSpot

Forum topic · General Scripting

why does the timer not work ???

By Any · 2021-04-18

Description

Hello !!!
There is a camera in the scene -- PhysCamera001.
I'm trying to change her parameter

try (DestroyDialog Dist) catch()
rollout Dist "Dist" width:90 height:50
(
local CamPar = $PhysCamera001.clip_near
checkbutton cbn_Plus "+" checked:false tooltip:"Far from Camera"
timer MC "P" interval:10 active:false

on Dist open do
(
$PhysCamera001.clip_on = true
)
on cbn_Plus changed theState do
(
if ( cbn_Plus.checked == true ) then
(
MC.active = true
)
else
(
MC.active = false
)
)
on MC tick do
(
CamPar += 1
)
on Dist close do
(
$PhysCamera001.clip_on = off
)
)
createDialog Dist

why does the timer not work ???

Comments (1)

.

miauu · 2021-04-18

The timer works:



try (DestroyDialog Dist) catch()
rollout Dist "Dist" width:90 height:50
(
	local CamPar = $PhysCamera001.clip_near
	checkbutton cbn_Plus "+" checked:false tooltip:"Far from Camera"
	timer MC "P" interval:1000 active:false

	on Dist open do
	(
		$PhysCamera001.clip_on = true
	)
	
	on cbn_Plus changed theState do
	(
		if ( cbn_Plus.checked == true ) then
		(
			MC.active = true
		)
		else
		(
			MC.active = false
		)
	)
	
	on MC tick do
	(
-- 		CamPar += 1
		$PhysCamera001.clip_near += 1
		format "nc: % \n" $PhysCamera001.clip_near
	)
	
	on Dist close do
	(
		$PhysCamera001.clip_on = off
		MC.active = false
	)
)
createDialog Dist