 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Aziixz Cheater
Reputation: 0
Joined: 26 Oct 2021 Posts: 31 Location: Earth
|
Posted: Fri May 26, 2023 5:32 am Post subject: |
|
|
keeps looping the first sound sliding.wav without any input as soon as I turn on the script and hit F8 it starts looping the sound
Quote: |
LeFiXER wrote:
Yes, I did not spot the 2nd error also haha Very Happy. Nevermind, it's the heat ^^
No problem. Also, thanks for the fix and taking over the watch in case of need, mate.
Just in addition to the available options;
Code: |
Code:
[ENABLE]
{$lua}
if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
cycleTimer=createTimer() cycleTimer.Interval=50 cycleTimer.Enabled=false
local al = getAddressList()
myAddr1 = al.getMemoryRecordByDescription("xGun")
myAddr2 = al.getMemoryRecordByDescription("xBulletsFired")
myAddr3 = al.getMemoryRecordByDescription("xFoV")
--oldValue1 = 1 --readFloat(myAddr1.Address)
oldValue2 = readInteger(myAddr2.Address)
oldValue3 = readFloat(myAddr3.Address)
function checkValue()
myAddr1 = al.getMemoryRecordByDescription("xGun")
myAddr2 = al.getMemoryRecordByDescription("xBulletsFired")
myAddr3 = al.getMemoryRecordByDescription("xFoV")
if readFloat(myAddr1.Address) < 1 then -- If the value is below from xGun is below the value of (float) 1 then play sound sliding.wav?
playSound(findTableFile('sliding.wav'))
--oldValue1 = myAddr1.Value --> oldValue1=1
--writeFloat(myAddr1.Address,1) --> replace value 1
elseif readInteger(myAddr2.Address) ~= oldValue2 then
playSound(findTableFile('killmarker.wav')) -- Tried changing this
oldValue2 = readInteger(myAddr2.Address)
elseif readFloat(myAddr3.Address) ~= oldValue3 then
playSound(findTableFile('AK47.wav')) -- Tried changing this
oldValue3 = readFloat(myAddr3.Address)
end
end
cycleTimer.OnTimer = checkValue
if ExitKey then ExitKey.Destroy() ExitKey=nil end
ExitKey = createHotkey((function()
sleep(200)
if cycleTimer.Enabled==false then
cycleTimer.Enabled=true
else
cycleTimer.Enabled=false
end
end), VK_F8)
{$asm}
[DISABLE]
{$lua}
if ExitKey then ExitKey.Destroy() ExitKey=nil end
if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
|
Now edit these options according to your script and use whatever you want from them.
| [/code] |
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 26
Joined: 16 Feb 2017 Posts: 1064
|
Posted: Fri May 26, 2023 6:12 am Post subject: |
|
|
I set the timer to half a second.
I added a code that also prints the values reached by the addresses.
Also look at the codes I disabled and enable the code you want.
You should also check the "Float" and "Integer" reading and writing codes, script names, sound names.
Which type of value you expect from which address (Float, Integer, Double etc.)
Code: | [ENABLE]
{$lua}
if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
cycleTimer=createTimer() cycleTimer.Interval=500 cycleTimer.Enabled=false
local al = getAddressList()
myAddr1 = al.getMemoryRecordByDescription("xGun")
myAddr2 = al.getMemoryRecordByDescription("xBulletsFired")
myAddr3 = al.getMemoryRecordByDescription("xFoV")
--oldValue1 = 1 --readFloat(myAddr1.Address) -- Read (float) 1 from the address
-- save first value ( integer? float?)
oldValue2 = readInteger(myAddr2.Address)
oldValue3 = readInteger(myAddr3.Address)
function checkValue()
myAddr1 = al.getMemoryRecordByDescription("xGun")
myAddr2 = al.getMemoryRecordByDescription("xBulletsFired")
myAddr3 = al.getMemoryRecordByDescription("xFoV")
if readFloat(myAddr1.Address) < 1 then -- If the value is below from xGun is below the value of (float) 1 then play sound sliding.wav?
playSound(findTableFile('sliding.wav'))
--oldValue1 = myAddr1.Value --> oldValue1=1
--writeFloat(myAddr1.Address,1) --> replace value 1
print("Value1: "..readFloat(myAddr1.Address))
elseif readInteger(myAddr2.Address) ~= oldValue2 then
playSound(findTableFile('killmarker.wav')) -- Tried changing this
oldValue2 = readInteger(myAddr2.Address)
print("Value2: "..readInteger(myAddr2.Address))
elseif readFloat(myAddr3.Address) ~= oldValue3 then
playSound(findTableFile('AK47.wav')) -- Tried changing this
oldValue3 = readFloat(myAddr3.Address)
print("Value3: "..readFloat(myAddr3.Address))
end
end
cycleTimer.OnTimer = checkValue
if ExitKey then ExitKey.Destroy() ExitKey=nil end
ExitKey = createHotkey((function()
sleep(200)
if cycleTimer.Enabled==false then
cycleTimer.Enabled=true
else
cycleTimer.Enabled=false
end
end), VK_F8)
{$asm}
[DISABLE]
{$lua}
if ExitKey then ExitKey.Destroy() ExitKey=nil end
if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end |
_________________
|
|
Back to top |
|
 |
Aziixz Cheater
Reputation: 0
Joined: 26 Oct 2021 Posts: 31 Location: Earth
|
Posted: Fri May 26, 2023 6:44 am Post subject: |
|
|
trying to focus on just one line and sound to make it easier for me leads
me to this but again no sound plays
Code: |
[ENABLE]
{$lua}
if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
cycleTimer=createTimer() cycleTimer.Interval=50 cycleTimer.Enabled=false
local al = getAddressList()
myAddr1 = al.getMemoryRecordByDescription("xShield")
oldValue1 = 1
function checkValue()
myAddr1 = al.getMemoryRecordByDescription("xShield")
if readFloat(myAddr1.Address) < 1 then
playSound(findTableFile('Shieldz.wav'))
print("Value1: "..readFloat(myAddr1.Address))
end
end
cycleTimer.OnTimer = checkValue
if ExitKey then ExitKey.Destroy() ExitKey=nil end
ExitKey = createHotkey((function()
sleep(200)
if cycleTimer.Enabled==false then
cycleTimer.Enabled=true
else
cycleTimer.Enabled=false
end
end), VK_F8)
{$asm}
[DISABLE]
{$lua}
if ExitKey then ExitKey.Destroy() ExitKey=nil end
if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
|
|
|
Back to top |
|
 |
LeFiXER Grandmaster Cheater
Reputation: 15
Joined: 02 Sep 2011 Posts: 905 Location: 0x90
|
Posted: Fri May 26, 2023 6:52 am Post subject: |
|
|
Code: |
[ENABLE]
{$lua}
if cycleTimer then cycleTimer.Destroy(); cycleTimer = nil end
cycleTimer=createTimer()
cycleTimer.Interval = 50
cycleTimer.Enabled=false
local xShield = AddressList.getMemoryRecordByDescription('xShield')
oldValue1 = 1
function checkValue()
if xShield.value < 1 then
playSound(findTableFile('Shieldz.wav'), true) -- Second parameter is set to wait until the sound has finished playing before continuing execution
print("Value1: "..readFloat(xShield.Address))
end
end
cycleTimer.OnTimer = checkValue
if ExitKey then ExitKey.Destroy() ExitKey=nil end
ExitKey = createHotkey((function()
sleep(200)
if cycleTimer.Enabled==false then
cycleTimer.Enabled=true
else
cycleTimer.Enabled=false
end
end), VK_F8)
{$asm}
[DISABLE]
{$lua}
if ExitKey then ExitKey.Destroy() ExitKey=nil end
if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
|
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 26
Joined: 16 Feb 2017 Posts: 1064
|
Posted: Fri May 26, 2023 2:41 pm Post subject: |
|
|
If the value changes too often, the timer repeat time and sound duration may be affecting playback.
My advice is to try the "playMP3" option.
Thus adding "All Stop" function in replay state and start playback.
Yet it is fixed by experience;
In case of replay, the previous sound will play for the time (50 milliseconds) you allocated for the timer.
This will allow you to play shorter than a "beep".
You should focus the timer duration on the sound duration or use this option for an address that changes at less intervals.
I can give an example for that tomorrow. _________________
|
|
Back to top |
|
 |
Aziixz Cheater
Reputation: 0
Joined: 26 Oct 2021 Posts: 31 Location: Earth
|
Posted: Sat May 27, 2023 9:27 am Post subject: |
|
|
Error on line 11 |
|
Back to top |
|
 |
LeFiXER Grandmaster Cheater
Reputation: 15
Joined: 02 Sep 2011 Posts: 905 Location: 0x90
|
Posted: Sat May 27, 2023 9:35 am Post subject: |
|
|
The error is pretty straight forward. No need for a large screenshot. Just copy/paste the error into a code block.
I'm assuming this is the offending line, in which case just make the entry value a number.
Code: |
...
if tonumber(xShield.value) < 1 then
...
|
|
|
Back to top |
|
 |
Aziixz Cheater
Reputation: 0
Joined: 26 Oct 2021 Posts: 31 Location: Earth
|
Posted: Sat May 27, 2023 10:28 am Post subject: |
|
|
Apologies will do in the future. Thank you, came up with this and it works
but I am not able to play multiple sounds over each other so when shieldz
plays it plays fully but stops all other sounds playing whilst doing so and
keeps repeating, Is it possible to set it to loop once and not again until its
triggered? without messing with timer value as some sounds need to play
quickly like hitmarkers which can be triggered multiple times in a second
but when shield is triggered it keeps getting cut off due to the timer. If I
extend the length of the timer to play shield fully the killmarker sound
gets delayed and doesn't play fast enough. Thank you Aylin for I will
wait for your example tomorrow.
Code: |
{$lua}
if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
cycleTimer=createTimer() cycleTimer.Interval=50 cycleTimer.Enabled=false
oldValue1 = writeFloatLocal(0x17AB92D8,"1")
oldValue2 = writeFloatLocal(0x17AB92D8,"1")
oldValue3 = writeFloatLocal(0x17AB92D8,"1")
oldValue4 = writeFloatLocal(0x17AB92D8,"1")
function checkValue()
local al = getAddressList()
myAddr2 = al.getMemoryRecordByDescription("xEXP")
myAddr3 = al.getMemoryRecordByDescription("xKill")
if readFloat("[[Borderlands2.exe + 01609568] +198] +30") == tonumber (0) then
playSound(findTableFile('Crouch.wav'), false)
elseif readFloat("[[[Borderlands2.exe + 0164C458] +24] +3B8] +6C") == tonumber (0) then
playSound(findTableFile('Shieldz.wav'), true)
elseif myAddr2.Value ~= oldValue2 then
playSound(findTableFile('Level.wav'), false)
oldValue2 = myAddr2.Value
elseif myAddr3.Value ~= oldValue3 then
playSound(findTableFile('killmarker.wav'), true)
oldValue3 = myAddr3.Value
end
end
cycleTimer.OnTimer = checkValue
if ExitKey then ExitKey.Destroy() ExitKey=nil end
ExitKey = createHotkey((function()
sleep(200)
if cycleTimer.Enabled==false then
cycleTimer.Enabled=true
else
cycleTimer.Enabled=false
end
end), VK_F8)
{$asm}
[DISABLE]
{$lua}
if ExitKey then ExitKey.Destroy() ExitKey=nil end
if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
|
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 26
Joined: 16 Feb 2017 Posts: 1064
|
Posted: Sat May 27, 2023 4:54 pm Post subject: |
|
|
If you don't mind overlapping sounds, the code that plays 4 separate sounds at the same time would be:
This is the case integrated into your code;
I set it up for use in CE Lua Table instead of Address List (ASM) script.
You also need to format all audio formats (.wav) as MP3.
The names are the same but the code will play mp3 file.
( The PlayMP3 option is an excerpt from @mgr.inz.Player. )
Code: | --########################################
--########################################
-- The PlayMP3 option is an excerpt from @mgr.inz.Player.
function initializeMP3Player()
if initializeMP3Player_done then return true end
local script64bit=[[loadlibrary(winmm.dll)
alloc(SimpleMp3Player,4096)
registersymbol(SimpleMp3Player)
SimpleMp3Player:
lea rsp,[rsp-28]
lea rsi,[rcx+400]
lea rdx,[rcx+300]
mov r8d,80
xor r9d,r9d
call mciSendStringW
mov rcx,rax
mov rdx,rsi
mov r8,200
call mciGetErrorStringW
lea rsp,[rsp+28]
ret]]
local script32bit=[[loadlibrary(winmm.dll)
alloc(SimpleMp3Player,4096)
registersymbol(SimpleMp3Player)
SimpleMp3Player:
push ebp
mov ebp,esp
push ebx
mov ebx,[ebp+8]
sub esp,10
mov [esp],ebx
lea ebx,[ebx+300]
mov [esp+4],ebx
mov [esp+8],80
mov [esp+c],0
call mciSendStringW
mov ebx,[ebp+8]
lea ebx,[ebx+400]
sub esp,0c
mov [esp],eax
mov [esp+0x4],ebx
mov [esp+0x8],200
call mciGetErrorStringW
pop ebx
leave
ret 004]]
if cheatEngineIs64Bit() then script = script64bit else script = script32bit end
if autoAssemble(script,true)
then
initializeMP3Player_done = true
MP3PlayerCommandMS = createMemoryStream()
MP3PlayerCommandMS.Size = 2048
return true
else
return false
end
end
function MP3PlayerSendCommand(command)
writeStringLocal(MP3PlayerCommandMS.Memory, command, true)
writeBytesLocal (MP3PlayerCommandMS.Memory+2*#command, 0, 0)
executeCodeLocal('SimpleMp3Player',MP3PlayerCommandMS.Memory)
return readStringLocal(MP3PlayerCommandMS.Memory+1024,512,true),
readStringLocal(MP3PlayerCommandMS.Memory+768,128,true)
end
---------------------------------------------------
---------------------------------------------------
function play1(song1)
if not initializeMP3Player() then return end
MP3PlayerSendCommand("open "..song1.." type mpegvideo alias FirstSound", 0, 0, 0)
MP3PlayerSendCommand("play FirstSound", 0, 0, 0)
end
function play2(song2)
if not initializeMP3Player() then return end
MP3PlayerSendCommand("open "..song2.." type mpegvideo alias SecondSound", 0, 0, 0)
MP3PlayerSendCommand("play SecondSound", 0, 0, 0)
end
function play3(song3)
if not initializeMP3Player() then return end
MP3PlayerSendCommand("open "..song3.." type mpegvideo alias ThereSound", 0, 0, 0)
MP3PlayerSendCommand("play ThereSound", 0, 0, 0)
end
function play4(song4)
if not initializeMP3Player() then return end
MP3PlayerSendCommand("open "..song4.." type mpegvideo alias FortySound", 0, 0, 0)
MP3PlayerSendCommand("play FortySound", 0, 0, 0)
end
function stopMP3(mp3f)
if not initializeMP3Player() then return end
MP3PlayerSendCommand('close '..mp3f)
end
function stopAllMP3()
stopMP3("FirstSound")
stopMP3("SecondSound")
stopMP3("ThereSound")
stopMP3("FortySound")
end
function volumeMP3(vol)
if not initializeMP3Player() then return end
MP3PlayerSendCommand('setaudio FirstSound volume to '..vol)
end
stopAllMP3()
--###########################################################
--###########################################################--
if ExitKey then ExitKey.Destroy() ExitKey=nil end
if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
cycleTimer=createTimer() cycleTimer.Interval=1000 cycleTimer.Enabled=false
--save path and folder
local sf = os.getenv("TEMP")
--print("sf: "..sf)
pth = (sf.."\\SoundList")
-- delete folder
os.remove(pth)
if pth then
os.execute([[mkdir "]]..sf..[[\SoundList"]])
end
-- save path to sound file
mp3File1 = findTableFile('Crouch.mp3').Stream
sCrouch = pth..'\\Crouch.mp3'
mp3File1.saveToFile(sCrouch)
mp3File2 = findTableFile('Shieldz.mp3').Stream
sShieldz = pth..'\\Shieldz.mp3'
mp3File2.saveToFile(sShieldz)
mp3File3 = findTableFile('Level.mp3').Stream
sLevel = pth..'\\Level.mp3'
mp3File3.saveToFile(sLevel)
mp3File4 = findTableFile('killmarker.mp3').Stream
sKill = pth..'\\killmarker.mp3'
mp3File4.saveToFile(sKill)
-- playSound options
function playCrouch() stopMP3("FirstSound") play1(sLevel) end
function playShieldz() stopMP3("SecondSound") play1(sLevel) end
function playLevel() stopMP3("ThereSound") play1(sLevel) end
function playKill() stopMP3("FortySound") play1(sLevel) end
oldValue1 = writeFloatLocal(0x17AB92D8,"1")
oldValue2 = writeFloatLocal(0x17AB92D8,"1")
oldValue3 = writeFloatLocal(0x17AB92D8,"1")
oldValue4 = writeFloatLocal(0x17AB92D8,"1")
function checkValue()
local al = getAddressList()
myAddr2 = al.getMemoryRecordByDescription("xEXP")
myAddr3 = al.getMemoryRecordByDescription("xKill")
if readFloat("[[Borderlands2.exe + 01609568] +198] +30") == tonumber (0) then
playCrouch() --playSound(findTableFile('Crouch.wav'), false)
elseif readFloat("[[[Borderlands2.exe + 0164C458] +24] +3B8] +6C") == tonumber (0) then
playShieldz() --playSound(findTableFile('Shieldz.wav'), true)
elseif myAddr2.Value ~= oldValue2 then
playLevel() --playSound(findTableFile('Level.wav'), false)
oldValue2 = myAddr2.Value
elseif myAddr3.Value ~= oldValue3 then
playKill() --playSound(findTableFile('killmarker.wav'), true)
oldValue3 = myAddr3.Value
end
end
cycleTimer.OnTimer = checkValue
ExitKey = createHotkey((function()
sleep(200)
if cycleTimer.Enabled==false then
cycleTimer.Enabled=true
else
cycleTimer.Enabled=false
stopAllMP3()
end
end), VK_F8)
-- close Trainer function add code clear sound folder: os.remove(pth) closeCE() return cafree |
If you want to try it without any address codes, here is an example focused only on the timer, playing all the sounds at the same time;
Of course, the tracks must be in .mp3 format and added to the CE table.
Code: | --########################################
--########################################
function initializeMP3Player()
if initializeMP3Player_done then return true end
local script64bit=[[loadlibrary(winmm.dll)
alloc(SimpleMp3Player,4096)
registersymbol(SimpleMp3Player)
SimpleMp3Player:
lea rsp,[rsp-28]
lea rsi,[rcx+400]
lea rdx,[rcx+300]
mov r8d,80
xor r9d,r9d
call mciSendStringW
mov rcx,rax
mov rdx,rsi
mov r8,200
call mciGetErrorStringW
lea rsp,[rsp+28]
ret]]
local script32bit=[[loadlibrary(winmm.dll)
alloc(SimpleMp3Player,4096)
registersymbol(SimpleMp3Player)
SimpleMp3Player:
push ebp
mov ebp,esp
push ebx
mov ebx,[ebp+8]
sub esp,10
mov [esp],ebx
lea ebx,[ebx+300]
mov [esp+4],ebx
mov [esp+8],80
mov [esp+c],0
call mciSendStringW
mov ebx,[ebp+8]
lea ebx,[ebx+400]
sub esp,0c
mov [esp],eax
mov [esp+0x4],ebx
mov [esp+0x8],200
call mciGetErrorStringW
pop ebx
leave
ret 004]]
if cheatEngineIs64Bit() then script = script64bit else script = script32bit end
if autoAssemble(script,true)
then
initializeMP3Player_done = true
MP3PlayerCommandMS = createMemoryStream()
MP3PlayerCommandMS.Size = 2048
return true
else
return false
end
end
function MP3PlayerSendCommand(command)
writeStringLocal(MP3PlayerCommandMS.Memory, command, true)
writeBytesLocal (MP3PlayerCommandMS.Memory+2*#command, 0, 0)
executeCodeLocal('SimpleMp3Player',MP3PlayerCommandMS.Memory)
return readStringLocal(MP3PlayerCommandMS.Memory+1024,512,true),
readStringLocal(MP3PlayerCommandMS.Memory+768,128,true)
end
---------------------------------------------------
---------------------------------------------------
function play1(song1)
if not initializeMP3Player() then return end
MP3PlayerSendCommand("open "..song1.." type mpegvideo alias FirstSound", 0, 0, 0)
MP3PlayerSendCommand("play FirstSound", 0, 0, 0)
end
function play2(song2)
if not initializeMP3Player() then return end
MP3PlayerSendCommand("open "..song2.." type mpegvideo alias SecondSound", 0, 0, 0)
MP3PlayerSendCommand("play SecondSound", 0, 0, 0)
end
function play3(song3)
if not initializeMP3Player() then return end
MP3PlayerSendCommand("open "..song3.." type mpegvideo alias ThereSound", 0, 0, 0)
MP3PlayerSendCommand("play ThereSound", 0, 0, 0)
end
function play4(song4)
if not initializeMP3Player() then return end
MP3PlayerSendCommand("open "..song4.." type mpegvideo alias FortySound", 0, 0, 0)
MP3PlayerSendCommand("play FortySound", 0, 0, 0)
end
function stopMP3(mp3f)
if not initializeMP3Player() then return end
MP3PlayerSendCommand('close '..mp3f)
end
function stopAllMP3()
stopMP3("FirstSound")
stopMP3("SecondSound")
stopMP3("ThereSound")
stopMP3("FortySound")
end
function volumeMP3(vol)
if not initializeMP3Player() then return end
MP3PlayerSendCommand('setaudio FirstSound volume to '..vol)
end
stopAllMP3()
--###########################################################
--###########################################################--
if ExitKey then ExitKey.Destroy() ExitKey=nil end
if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
cycleTimer=createTimer() cycleTimer.Interval=200 cycleTimer.Enabled=false
--save path and folder
local sf = os.getenv("TEMP")
--print("sf: "..sf)
pth = (sf.."\\SoundList")
os.remove(pth)
if pth then
os.execute([[mkdir "]]..sf..[[\SoundList"]])
end
-- save path to sound file
mp3File1 = findTableFile('Crouch.mp3').Stream
sCrouch = pth..'\\Crouch.mp3'
mp3File1.saveToFile(sCrouch)
mp3File2 = findTableFile('Shieldz.mp3').Stream
sShieldz = pth..'\\Shieldz.mp3'
mp3File2.saveToFile(sShieldz)
mp3File3 = findTableFile('Level.mp3').Stream
sLevel = pth..'\\Level.mp3'
mp3File3.saveToFile(sLevel)
mp3File4 = findTableFile('killmarker.mp3').Stream
sKill = pth..'\\killmarker.mp3'
mp3File4.saveToFile(sKill)
-- playSound options
function playCrouch() stopMP3("FirstSound") play1(sCrouch) end
function playShieldz() stopMP3("SecondSound") play2(sShieldz) end
function playLevel() stopMP3("ThereSound") play3(sLevel) end
function playKill() stopMP3("FortySound") play4(sKill) end
local s1 = 0
function checkValue()
s1=tonumber(s1) + 1
if s1==1 then
playKill()
end
if s1==2 then
playLevel()
end
if s1==3 then
playShieldz()
end
if s1==4 then
playCrouch()
s1=0
end
print(s1)
end
cycleTimer.OnTimer = checkValue
ExitKey = createHotkey((function()
sleep(200)
if cycleTimer.Enabled==false then
stopAllMP3()
s1 = 0
cycleTimer.Enabled=true
else
cycleTimer.Enabled=false
stopAllMP3()
end
end), VK_F8)
-- close Trainer function add code clear sound folder: os.remove(pth) closeCE() return cafree |
And the answer to the specific question;
Run two timers at the same time!
Code: | --Make sure you kill them before rebuilding during the testing phase!
if ExitKey1 then ExitKey1.Destroy() ExitKey1=nil end
if ExitKey2 then ExitKey2.Destroy() ExitKey2=nil end
if cycleTimer1 then cycleTimer1.Destroy() cycleTimer1=nil end
if cycleTimer2 then cycleTimer2.Destroy() cycleTimer2=nil end
cycleTimer1=createTimer() cycleTimer1.Interval=200 cycleTimer1.Enabled=false
cycleTimer2=createTimer() cycleTimer2.Interval=200 cycleTimer2.Enabled=false
function checkValue1()
-- codes
end
function checkValue2()
-- codes
end
cycleTimer1.OnTimer=checkValue1
cycleTimer2.OnTimer=checkValue2
ExitKey1 = createHotkey((function()
sleep(200)
if cycleTimer1.Enabled==false then
cycleTimer1.Enabled=true
else
cycleTimer1.Enabled=false
end
end), VK_F8) -- key F8
ExitKey2 = createHotkey((function()
sleep(200)
if cycleTimer2.Enabled==false then
cycleTimer2.Enabled=true
else
cycleTimer2.Enabled=false
end
end), VK_F9) -- key F9 |
CT File all codes; https://www.mediafire.com/file/zqqdmukg2pwgj0k/playMP3V1.CT/file
The codes have been tested and are working.
You just have to make sure that you get the correct reading address values.
Also, remember that the sounds will play for the time you set aside for the timer.
Or, if the frequently changing address values occur before the sound durations, the sound will be stopped and restarted from the beginning. _________________
|
|
Back to top |
|
 |
Aziixz Cheater
Reputation: 0
Joined: 26 Oct 2021 Posts: 31 Location: Earth
|
Posted: Mon May 29, 2023 3:48 am Post subject: |
|
|
Hitting execute on either Mp3 script freezes my cheat engine until I close and restart it |
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 26
Joined: 16 Feb 2017 Posts: 1064
|
Posted: Mon May 29, 2023 6:16 am Post subject: |
|
|
Aziixz wrote: | Hitting execute on either Mp3 script freezes my cheat engine until I close and restart it |
Download the CT file from the link I gave and try it.
Open CT, open Table >> Show Cheat Table Lua Script from the menu.
Also write what script you are using. (With game addresses in it? Or just a timer triggered playback script?)
I hope it's not a problem with Windows "winmm.dll". _________________
|
|
Back to top |
|
 |
Aziixz Cheater
Reputation: 0
Joined: 26 Oct 2021 Posts: 31 Location: Earth
|
Posted: Tue May 30, 2023 4:48 am Post subject: |
|
|
Quote: |
Aziixz wrote:
Hitting execute on either Mp3 script freezes my cheat engine until I close and restart it
Download the CT file from the link I gave and try it.
Open CT, open Table >> Show Cheat Table Lua Script from the menu.
Also write what script you are using. (With game addresses in it? Or just a timer triggered playback script?)
I hope it's not a problem with Windows "winmm.dll".
|
I downloaded your MP3Script and tired it same problem, also tried
Memory Viewer -> Tools -> LUA Engine aswell and pasted code still no
luck, With the 2 timers option the next sound still cancels out the first one
so I cant actually have 2 sounds playing at the exact same time. if one
starts and I trigger another one the current one cuts out, Is this not
possible or a limitation of playsound? Does an and if exist in LUA so I can
use it instead of else if to combine?. |
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 26
Joined: 16 Feb 2017 Posts: 1064
|
Posted: Sun Jun 04, 2023 11:14 am Post subject: |
|
|
When the timer test time is too short, the playing and stopping time of the sound will be as short as a "beep".
This may not be an option that works for you.
On the other hand, you stated that you could not use the MP3 samples I gave you.
Here are 2 options for you;
a) Assuming you have 3 test codes, you should have the following .wav playlist.
1) Crouch.wav
2) Shieldz.wav
3) killmarker.wav
4) Crouch_Shieldz.wav (Requires format. Overlay both audios and format as one audio. )
And use it in code like this:
Code: | function checkValue()
local al = getAddressList()
myAddr3 = al.getMemoryRecordByDescription("xKill")
if readFloat("[[Borderlands2.exe + 01609568] +198] +30") == tonumber(0) and
readFloat("[[[Borderlands2.exe + 0164C458] +24] +3B8] +6C") == tonumber(0) then
playSound(findTableFile('Crouch_Shieldz.wav')) -- format double sound!
else
if readFloat("[[Borderlands2.exe + 01609568] +198] +30") == tonumber(0) then
playSound(findTableFile('Crouch.wav'))
end
if readFloat("[[[Borderlands2.exe + 0164C458] +24] +3B8] +6C") == tonumber (0) then
playSound(findTableFile('Shieldz.wav'))
end
if myAddr3.Value ~= oldValue3 then
--playSound(findTableFile('Crouch_Shieldz.wav'),false)
--playSound(findTableFile('Crouch.wav'),false)
--playSound(findTableFile('Shieldz.wav'),false)
playSound(findTableFile('killmarker.wav'))
oldValue3 = myAddr3.Value
end
end
end |
------------
b) Making the MP3 script available to you.
The script I gave can play 4 sounds at the same time and if you give enough test time intervals, you can hear all of these sounds.
The test time interval you defined is 200 ms, but the size of the sound you play is 1-2 seconds. (1000-2000 ms)
Accordingly, you should reconsider the playing time of the sounds.
Here is a known error procedure for MP3 script:
Here's a test that differs depending on different versions of Windows or the user's system folder:
Correct the Windows "winmm.dll" folder path.
Corroder wrote: | Yes, I know the scripts. But you need to warn the users for this line:
Code: | local script64bit=[[loadlibrary(winmm.dll) |
The above code will work on some computers. Not all.
Each user have different windows configurations, so if you want your project able to use your app. then need to fix something like this:
Code: | -- 64 bit
script64bit=[[loadlibrary(C:\Windows\SysWOW64\winmm.dll)... -- or loadlibrary(C:\Windows\System32\winmm.dll)
-- and for 32bit
script32bit=[[loadlibrary(C:\Windows\System32\winmm.dll)...
|
|
edit code:
Code: | function initializeMP3Player()
if initializeMP3Player_done then return true end
--loadlibrary(C:\Windows\System32\winmm.dll) = your path?
local script64bit=[[loadlibrary(winmm.dll)
alloc(SimpleMp3Player,4096)
registersymbol(SimpleMp3Player)
SimpleMp3Player:
lea rsp,[rsp-28]
lea rsi,[rcx+400]
lea rdx,[rcx+300]
mov r8d,80
xor r9d,r9d
call mciSendStringW
mov rcx,rax
mov rdx,rsi
mov r8,200
call mciGetErrorStringW
lea rsp,[rsp+28]
ret]]
--loadlibrary(C:\Windows\System32\winmm.dll)
local script32bit=[[loadlibrary(winmm.dll)
alloc(SimpleMp3Player,4096)
registersymbol(SimpleMp3Player)
SimpleMp3Player:
push ebp
mov ebp,esp
push ebx
mov ebx,[ebp+8]
sub esp,10
mov [esp],ebx
lea ebx,[ebx+300]
mov [esp+4],ebx
mov [esp+8],80
mov [esp+c],0
call mciSendStringW
mov ebx,[ebp+8]
lea ebx,[ebx+400]
sub esp,0c
mov [esp],eax
mov [esp+0x4],ebx
mov [esp+0x8],200
call mciGetErrorStringW
pop ebx
leave
ret 004]]
if cheatEngineIs64Bit() then script = script64bit else script = script32bit end
if autoAssemble(script,true)
then
initializeMP3Player_done = true
MP3PlayerCommandMS = createMemoryStream()
MP3PlayerCommandMS.Size = 2048
return true
else
return false
end
end |
_________________
|
|
Back to top |
|
 |
|
|
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
|
|