Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


simultaneously calling two or more functions

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
HexaG0n
Advanced Cheater
Reputation: 0

Joined: 29 Mar 2021
Posts: 64

PostPosted: Thu Dec 16, 2021 11:30 pm    Post subject: simultaneously calling two or more functions Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Fri Dec 17, 2021 2:11 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
HexaG0n
Advanced Cheater
Reputation: 0

Joined: 29 Mar 2021
Posts: 64

PostPosted: Fri Dec 17, 2021 2:36 am    Post subject: Reply with quote

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
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat Dec 18, 2021 8:54 pm    Post subject: Reply with quote

To play sounds at same time, this is an example :

https://forum.cheatengine.org/viewtopic.php?p=5770763

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sat Dec 18, 2021 9:19 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites