1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
bpm = 100 -- only bpms divisible by 2400 into whole numbers
sixteenth = {}
bpmBar = 240000/bpm -- one bar = 2400ms
bpmSixteenth = bpmBar/16
for position = 1,16 do
sixteenth[position] = bpmSixteenth*(position-1)
parse("sv_msg "..sixteenth[position].."") -- prints out correct times for each 16th note
end
addhook("join","start")
function start(id)
	if player(id,"bot") == false then
	timer(sixteenth[1], "loopKickOne") -- trigger kick at 0 ms (it does)
	timer(sixteenth[9], "loopKickTwo") -- trigger second kick at 1200 ms (it does)
	timer(sixteenth[5], "loopSnareOne") -- trigger snare at 600ms (it doesn't)
	timer(sixteenth[13], "loopSnareTwo") -- trigger snare at 1800ms (it does)
	end
end
function loopKickOne()
parse("sv_sound /machette_madness_sounds/kick.ogg")
timer(bpmBar,"loopKickOne") -- wait 2400ms (a bar) and repeat
end
function loopKickTwo()
parse("sv_sound /machette_madness_sounds/kick.ogg")
timer(bpmBar,"loopKickTwo")
end
function loopSnareOne()
parse("sv_sound /machette_madness_sounds/Snare.ogg")
timer(bpmBar,"loopSnareOne")
end
function loopSnareTwo()
parse("sv_sound /machette_madness_sounds/Snare.ogg")
timer(bpmBar,"loopSnareTwo")
end
It's staying in time as it's repeating but the sound triggers aren't in the correct places to begin with.
I replaced the table values in the timers with the actual values that it should be and got the same result.
Added 1000 to each value and it fixed it. Do the timers not handle values below 1000?
Last update, for anyone wondering, even with it working, no it doesn't keep in time very well. Noticeably sounds like someone who has just learnt the drums playing badly.
edited 8×, last 02.12.17 08:54:31 pm
Music script mistake or timers not working
1 
Offline