Timer Basics CodeBlocks for Meta Horizon Worlds

Post Reply
darknkreepy3#
Site Admin
Posts: 254
Joined: Tue Oct 27, 2009 9:33 pm

Timer Basics CodeBlocks for Meta Horizon Worlds

Post by darknkreepy3# »

timer original video by Vidyuu Tutorials
https://www.youtube.com/watch?v=baA_aA9zBOg
by Kristoffe Brodeur
07-01-2025

An indented text version of this phpBB3 output which is flat (easier to read in the txt file)
http://supercala.net/sites/meta_horizon ... 3-2025.txt

Tutorial text by kristoffe

script and text gizmo

Script Gizmo instance
name (top left side of properties panel)
[LaexTimer] without [ ]
Text Gizmo instance
bottom right of properties panel
Attached Script
drop down and choose
[LaexTimer]

when +event is receieved +event call it loop
send event with delay
send loop to self after [#1] seconds with
thumbstick right - select loop line and thumbstick right to paste a new one in global start


=actions tab=
display text [T]s on self

new [variable]
[string]
DisplayMe
drag to [T]s

display DisplayMe on self

+
=Values tab=
set to, drag on top of display text
select DisplayMe, thumbstick to the right move it, and let go top duplicate
new [variable]
[number] (used as an iterator) named iterator
set DisplayMe to [#iterator]
!error num and string!

=values tab=
[variable as string]
drag into set DisplayMe to (string) as string
set DisplayMe to [#iterator] as string

=values tab=
set to, drag above set DisplayMe
set [#iterator] to values
operators tab
[+] to values
set [#iterator] to [a] +
dupolicate [#iterator] into [a]
values tab
[number input]
set [#iterator] to [#iterator] + [#1]
*drag this to the bottom so it starts at 0, not +1 twice, starting at 1.

seconds to minutes (minutes first)

set DisplayMe to [#iterator] as string
delete #iterator
=Operators tab=
[/] divide symbol
drag [#iterator] into [a]
drag [#1] into slot and change [#1] to [#60] (seconds per minute)

delete #iterator
=Operators tab=
[floor]
[floor to string]
[/]
#iterator in [a]
[#1] to , change to [#60]

add seconds

select DisplayMe to floor ( [#iterator] / [#60] ) as string
duplicate itself and drop it under it
delete the floor section
DisplayMe to (value)
=Operators tab=
[+]
[a] +
duplicate drag [DisplayMe] to [a]

*now combine, concantenate
=Operators tab=
[+]
[a] +
Values tab
[string input]
" : " {space}{colon}{space}

(string input) +
*seconds will be Modulus (%) symbol
*68%60 would be 68=60*1 + 8 left over
*the modulus is 8

=Operators tab=
[%]

(string input) + (%)
*value as string
=Values tab=
[variable as string]
(string input) + (variable as string)
=Operators tab=
[%]
(string input) + ([a]%) as string)
(string input) + (#iterator%#60) as string)

padding for 0-9 with a 0 for alignment of seconds and minutes in columns

events tab
[if]
place between minutes and seconds with the DisplayMe codeBlocks
if condition
events tab
[else]
place under the if on the left, not indented as in IF || ELSE nested
operators tab
[<] less than
if [<]
if [a] <
drag [%] modulus block to the [a]
if ( [#iterator] % [#60] )
duplicate [#60] to
change [#60] to [#10]
move the DisplayMe + T " : " + [#iterator] % [#60] as string to the [else]
nest into it to the right
duplicate DisplayMe + T " : " + [#iterator] % [#60] as string to the [if]
nest into it to the right
change " : " to " :0" {space}{colon}{zero}
*this adds a text string " :0"
so {0-9} looks like
00 01 02 03 04 05 06 07 08 09
Post Reply