Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- * notes * --
- -- this script allows you to setup a variable based live fully animated countdown timer display!
- -- currently you can set up to a maximum of 59 minutes & 59 seconds ...
- -- it wouldn't be to hard to add a couple of extra functions for displaying 24 hours & an extra one to count day 1,2,3 etc.
- -- how to use: execute a script > startCountdown(minute[tens], minute[singular], seconds[tens], seconds[singular])
- -- example: "startCountdown(0, 1, 3, 0)" ='s 1 minute & 30 seconds.
- -- * local variable defaults for timer display value * --
- local sec_sin_val = 0
- local sec_dbl_val = 0
- local min_sin_val = 0
- local min_dbl_val = 0
- -- * local variables for getting single second digit animations * --
- local ss = getObject('Scenes[Scene_001].SceneObjects[single_sec_digit]')
- local ss0 = ss:getObject('.ObjectAnimations[single_0]')
- local ss1 = ss:getObject('.ObjectAnimations[single_1]')
- local ss2 = ss:getObject('.ObjectAnimations[single_2]')
- local ss3 = ss:getObject('.ObjectAnimations[single_3]')
- local ss4 = ss:getObject('.ObjectAnimations[single_4]')
- local ss5 = ss:getObject('.ObjectAnimations[single_5]')
- local ss6 = ss:getObject('.ObjectAnimations[single_6]')
- local ss7 = ss:getObject('.ObjectAnimations[single_7]')
- local ss8 = ss:getObject('.ObjectAnimations[single_8]')
- local ss9 = ss:getObject('.ObjectAnimations[single_9]')
- -- * local variables for getting double second digit animations * --
- local ds = getObject('Scenes[Scene_001].SceneObjects[double_sec_digit]')
- local ds0 = ds:getObject('.ObjectAnimations[double_0]')
- local ds1 = ds:getObject('.ObjectAnimations[double_1]')
- local ds2 = ds:getObject('.ObjectAnimations[double_2]')
- local ds3 = ds:getObject('.ObjectAnimations[double_3]')
- local ds4 = ds:getObject('.ObjectAnimations[double_4]')
- local ds5 = ds:getObject('.ObjectAnimations[double_5]')
- -- * local variables for getting single minute digit animations * --
- local sm = getObject('Scenes[Scene_001].SceneObjects[single_min_digit]')
- local sm0 = sm:getObject('.ObjectAnimations[single_0]')
- local sm1 = sm:getObject('.ObjectAnimations[single_1]')
- local sm2 = sm:getObject('.ObjectAnimations[single_2]')
- local sm3 = sm:getObject('.ObjectAnimations[single_3]')
- local sm4 = sm:getObject('.ObjectAnimations[single_4]')
- local sm5 = sm:getObject('.ObjectAnimations[single_5]')
- local sm6 = sm:getObject('.ObjectAnimations[single_6]')
- local sm7 = sm:getObject('.ObjectAnimations[single_7]')
- local sm8 = sm:getObject('.ObjectAnimations[single_8]')
- local sm9 = sm:getObject('.ObjectAnimations[single_9]')
- -- * local variables for getting double minute digit animations * --
- local dm = getObject('Scenes[Scene_001].SceneObjects[double_min_digit]')
- local dm0 = dm:getObject('.ObjectAnimations[double_0]')
- local dm1 = dm:getObject('.ObjectAnimations[double_1]')
- local dm2 = dm:getObject('.ObjectAnimations[double_2]')
- local dm3 = dm:getObject('.ObjectAnimations[double_3]')
- local dm4 = dm:getObject('.ObjectAnimations[double_4]')
- local dm5 = dm:getObject('.ObjectAnimations[double_5]')
- -- * local variable which contains the condition for timer_is_on? * --
- local cond = getObject('Scenes[Scene_001].SceneConditions[timer_is_on?]')
- -- * local variable which contains the action to check the current time! * --
- local act = getObject('Characters[Protagonist].CharacterActions[check_time]')
- -- * start variable countdown * --
- function startCountdown(mdv, msv, sdv, ssv)
- if ssv > 9 then ssv = 9 end
- if sdv > 5 then sdv = 5 end
- if msv > 9 then msv = 9 end
- if mdv > 5 then mdv = 5 end
- -- * --
- local sec_sin = ss:getObject('.ObjectAnimations[single_' .. ssv .. ']')
- local sec_dbl = ds:getObject('.ObjectAnimations[double_' .. sdv .. ']')
- local min_sin = sm:getObject('.ObjectAnimations[single_' .. msv .. ']')
- local min_dbl = dm:getObject('.ObjectAnimations[double_' .. mdv .. ']')
- -- * --
- sec_sin_val = ssv
- sec_dbl_val = sdv
- min_sin_val = msv
- min_dbl_val = mdv
- -- * --
- stopAnimation(ss0)
- stopAnimation(ds0)
- stopAnimation(sm0)
- stopAnimation(dm0)
- -- * --
- startAnimation(sec_sin)
- startAnimation(sec_dbl)
- startAnimation(min_sin)
- startAnimation(min_dbl)
- -- * --
- startAction(act)
- -- * --
- print('timer has been set to ' .. mdv .. msv .. ':' .. sdv .. ssv .. '!')
- print('timer has been started!')
- end
- -- * check single second digit * --
- function check_ssd_val()
- if sec_sin_val >= 9 then
- sec_sin_val = 8
- stopAnimation(ss9)
- startAnimation(ss8)
- else
- if sec_sin_val == 8 then
- sec_sin_val = 7
- stopAnimation(ss8)
- startAnimation(ss7)
- else
- if sec_sin_val == 7 then
- sec_sin_val = 6
- stopAnimation(ss7)
- startAnimation(ss6)
- else
- if sec_sin_val == 6 then
- sec_sin_val = 5
- stopAnimation(ss6)
- startAnimation(ss5)
- else
- if sec_sin_val == 5 then
- sec_sin_val = 4
- stopAnimation(ss5)
- startAnimation(ss4)
- else
- if sec_sin_val == 4 then
- sec_sin_val = 3
- stopAnimation(ss4)
- startAnimation(ss3)
- else
- if sec_sin_val == 3 then
- sec_sin_val = 2
- stopAnimation(ss3)
- startAnimation(ss2)
- else
- if sec_sin_val == 2 then
- sec_sin_val = 1
- stopAnimation(ss2)
- startAnimation(ss1)
- else
- if sec_sin_val == 1 then
- sec_sin_val = 0
- stopAnimation(ss1)
- startAnimation(ss0)
- else
- if sec_sin_val == 0 then
- if sec_dbl_val + min_dbl_val + min_sin_val > 0 then
- sec_sin_val = 9
- stopAnimation(ss0)
- startAnimation(ss9)
- check_dsd_val()
- else
- cond:setValue(VConditionValue, false)
- print('timer has finished counting down!')
- end
- end end end end end end end end end end
- end
- -- * check double second digit * --
- function check_dsd_val()
- if sec_dbl_val >= 5 then
- sec_dbl_val = 4
- stopAnimation(ds5)
- startAnimation(ds4)
- else
- if sec_dbl_val == 4 then
- sec_dbl_val = 3
- stopAnimation(ds4)
- startAnimation(ds3)
- else
- if sec_dbl_val == 3 then
- sec_dbl_val = 2
- stopAnimation(ds3)
- startAnimation(ds2)
- else
- if sec_dbl_val == 2 then
- sec_dbl_val = 1
- stopAnimation(ds2)
- startAnimation(ds1)
- else
- if sec_dbl_val == 1 then
- sec_dbl_val = 0
- stopAnimation(ds1)
- startAnimation(ds0)
- else
- if sec_dbl_val == 0 then
- if min_dbl_val + min_sin_val > 0 then
- sec_dbl_val = 5
- stopAnimation(ds0)
- startAnimation(ds5)
- check_smd_val()
- end
- end end end end end end
- end
- -- * check single minute digit * --
- function check_smd_val()
- if min_sin_val >= 9 then
- min_sin_val = 8
- stopAnimation(sm9)
- startAnimation(sm8)
- else
- if min_sin_val == 8 then
- min_sin_val = 7
- stopAnimation(sm8)
- startAnimation(sm7)
- else
- if min_sin_val == 7 then
- min_sin_val = 6
- stopAnimation(sm7)
- startAnimation(sm6)
- else
- if min_sin_val == 6 then
- min_sin_val = 5
- stopAnimation(sm6)
- startAnimation(sm5)
- else
- if min_sin_val == 5 then
- min_sin_val = 4
- stopAnimation(sm5)
- startAnimation(sm4)
- else
- if min_sin_val == 4 then
- min_sin_val = 3
- stopAnimation(sm4)
- startAnimation(sm3)
- else
- if min_sin_val == 3 then
- min_sin_val = 2
- stopAnimation(sm3)
- startAnimation(sm2)
- else
- if min_sin_val == 2 then
- min_sin_val = 1
- stopAnimation(sm2)
- startAnimation(sm1)
- else
- if min_sin_val == 1 then
- min_sin_val = 0
- stopAnimation(sm1)
- startAnimation(sm0)
- else
- if min_sin_val == 0 then
- if min_dbl_val > 0 then
- min_sin_val = 9
- stopAnimation(sm0)
- startAnimation(sm9)
- check_dmd_val()
- end
- end end end end end end end end end end
- end
- -- * check double minute digit * --
- function check_dmd_val()
- if min_dbl_val >= 5 then
- min_dbl_val = 4
- stopAnimation(dm5)
- startAnimation(dm4)
- else
- if min_dbl_val == 4 then
- min_dbl_val = 3
- stopAnimation(dm4)
- startAnimation(dm3)
- else
- if min_dbl_val == 3 then
- min_dbl_val = 2
- stopAnimation(dm3)
- startAnimation(dm2)
- else
- if min_dbl_val == 2 then
- min_dbl_val = 1
- stopAnimation(dm2)
- startAnimation(dm1)
- else
- if min_dbl_val == 1 then
- min_dbl_val = 0
- stopAnimation(dm1)
- startAnimation(dm0)
- end end end end end
- end
Advertisement
Add Comment
Please, Sign In to add comment