View previous topic :: View next topic |
Author |
Message |
HexaG0n Advanced Cheater Reputation: 0
Joined: 29 Mar 2021 Posts: 64
|
Posted: Thu Dec 16, 2021 11:30 pm Post subject: simultaneously calling two or more functions |
|
|
Is it possible to call two or more functions at the same time?
Im trying to make a music maker that plays a lot of notes at the same time, but I cant seem to call the notes to play simultaneously [ im using a loop so ofc, it wont.. but idk any other way ]
for example, functions in a table or a specific function like
callFuncSimul(func1, func2, ...), you know...
Thanks in advance...
my code:
Code: | for _,xTile in pairs(music_notes) do
local notesToPlay = {}
for _,note in pairs(xTile) do
local noteIndex = tonumber(note:match('(%d+)'))
local note = notes[note:sub(1, 2)]
if note and noteIndex and noteIndex > -1 then
local isValid = type(note[2]) == 'table' and isInTable(note[2], noteIndex) or
type(note[2]) == 'number' and noteIndex <= note[2]
if isValid then
table.insert(notesToPlay, note[1] .. noteIndex .. '.wav')
end
end
end
for _,file in pairs(notesToPlay) do
playSound(file) -- its custom playsound function by mgr.inz.Player
end
sleep(bpm)
end |
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Fri Dec 17, 2021 2:11 am Post subject: |
|
|
try using the built in playSound of CE instead. It plays imeadiately and won't wait till the sound is done
it takes a stream or tablefile
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
HexaG0n Advanced Cheater Reputation: 0
Joined: 29 Mar 2021 Posts: 64
|
Posted: Fri Dec 17, 2021 2:36 am Post subject: |
|
|
well, the reason im using this other function is because it can play multiple files at once, which doesnt wait for the last sound played to end first [ like the built-in playSound ]. I made a thread before where I was trying to find something like it, and well I did.
The thing is, I want to call multiple functions [ not only playSound, I could use it for different uses ] at the same time like threading but I dont really know how.
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Sat Dec 18, 2021 9:19 pm Post subject: |
|
|
use createThread
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
|