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 


"customSound" for CT,CETRAINER,EXE [CE6.3 + ]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Jun 13, 2013 8:41 pm    Post subject: "customSound" for CT,CETRAINER,EXE [CE6.3 + ] Reply with quote

My first attempt here: http://forum.cheatengine.org/viewtopic.php?t=559298

With current CE6.3 we can make it even easier.

What to do:
1) add WAV file to table, as many as you want. Before, you can convert them to 22050Hz, mono format. (this is beep sound after all, not real music). For example you added two wave files: ON.wav and OFF.wav

2) add this at the end (or at the beginning) of your script:

soundTable = { "ON.wav", "OFF.wav" }
customSound.Init(soundTable)

3) to play first track use this:
customSound.PlaySound(1)

to play second, this
customSound.PlaySound(2)

example:
Code:
function onPostHotkey0(Hotkey)
  local memrec=memoryrecordhotkey_getOwner(Hotkey)
  local isActive=memoryrecord_isActive(memrec) --get the state after the hotkey got triggered
  cheatcomponent_setActive(CETrainer_CHEAT0, isActive)
  if gBeepOnAction then
    if isActive then customSound.PlaySound(1) end
    if not isActive then customSound.PlaySound(2) end
  end
end



4) move attached customSound.lua file into C:\Program Files (x86)\Cheat Engine 6.3\autorun dir
From now on, you can use CT, CETRAINER with custom Beep sound.



If you want to distribute CT, CETRAINER or EXE with your custom Beeps, just paste text from attached customSound.lua file.
Paste it at the beginning of your Lua script.




"example only" trainer (you don't need the game) http://www.mediafire.com/?agkv68ke66hhx8r
 



customSound_example.CT
 Description:
Example CT.
After executng Lua script press:
ctrl+shift+F2 or ctrl+shift+F3

Download
 Filename:  customSound_example.CT
 Filesize:  37.19 KB
 Downloaded:  1322 Time(s)


customSound.lua
 Description:

Download
 Filename:  customSound.lua
 Filesize:  2.61 KB
 Downloaded:  1061 Time(s)


_________________
Back to top
View user's profile Send private message MSN Messenger
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Tue Sep 17, 2013 4:11 pm    Post subject: Reply with quote

Time to change the beep sound :p
It gets annoying D: .

Thanks for sharing, I'll rep you soon (When I'll be able again).

P.S
Bump.

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
DTeCH
Newbie cheater
Reputation: 0

Joined: 19 Jul 2013
Posts: 23
Location: Cayman Islands

PostPosted: Thu Oct 03, 2013 4:32 am    Post subject: Reply with quote

Forgive my nooooobish ways Razz


I added the contents of the CustomSound LUA file just under the start of my Lua script...

Code:
--TRAINERGENERATORSTART--
--This is autogenerated code. Changing code in this block will
--get erased and rewritten if you regenerate the trainer code

--Uncomment the following line if this is a Cheat Table format trainer and you don't want CE to show (Tip, save as .CETRAINER alternatively)
--hideAllCEWindows()

RequiredCEVersion=6.3
if (getCEVersion==nil) or (getCEVersion()<RequiredCEVersion) then
  messageDialog('Please install Cheat Engine '..RequiredCEVersion, mtError, mbOK)
  closeCE()
end

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
customSound = {}
customSound.numberOfTracks = 0
customSound.everythingOK = false
customSound.by = 'mgr.inz.Player'

function customSound.Init(soundTable)
  if soundTable==nil or type(soundTable)~="table" then return false end

  customSound.numberOfTracks = 0
  local addresses=''
  for index,tableFile...



Then under that I added the soundTable thingy:

Code:
  ...onOpenProcess=old_onOpenProcess
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


soundTable = { "t1.wav", "t2.wav", "t3.wav", "t4.wav" }
customSound.Init(soundTable)



All locations of previous Beep() calls are now replaced with customSound.PlaySound(4)


It doesn't work. Now let me just explain what i DIDN'T do that might be my cause of it not working.

I don't know how to add the wav files to the table. (don't laugh lol) When making the EXE, I chose to try adding them from there (Extra Files)... doesn't work. Then I tried adding them from the main cheat engine window (Menu Button "Table">Add File). After doing that, every time I try to save to .CT, .CETrainer, or .EXE, I get an error "EDOMError in DOMDocument.CreateElement".

So I have no idea how to add the audio files to the table properly Sad

Instructions please? Very Happy

Oh... also I didn't convert them to 22050Hz because it's default windows wav files which may already be in the correct format. My $$$ Monster development machines are down right now due to lightening, & this stupid P4 P.O.S is just barely working so I won't be installing too much crap like audio convertors, or whatever on it.

Not sure if it matters, or not, but the form is not attached to any process yet until the user selects a "Browser... not stand-alone game", so If that's also a problem, then I guess I'm out of luck.

ps: CE 6.3

_________________
Hitler... When all else fails, you'll be in the right state of mind. Jesus Saves.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Oct 03, 2013 11:34 am    Post subject: Reply with quote

DTeCH wrote:
I added the contents of the CustomSound LUA file just under the start of my Lua script...


mgr.inz.Player wrote:
If you want to distribute CT, CETRAINER or EXE with your custom Beeps, just paste text from attached customSound.lua file.
Paste it at the beginning of your Lua script.






DTeCH wrote:
Then I tried adding them from the main cheat engine window (Menu Button "Table">Add File). After doing that, every time I try to save to .CT, .CETrainer, or .EXE, I get an error "EDOMError in DOMDocument.CreateElement".

Yes, you add them with "table"->"add file".

the error, I don't know. Could you upload those t1.wav t2.wav t3.wav t4.wav files (packed with winrar).

_________________
Back to top
View user's profile Send private message MSN Messenger
DTeCH
Newbie cheater
Reputation: 0

Joined: 19 Jul 2013
Posts: 23
Location: Cayman Islands

PostPosted: Thu Oct 03, 2013 2:06 pm    Post subject: Reply with quote

Thanks, it's working! Very Happy


I moved the CustomSound.lua file contents to the very top of my LUA script... also, right under that, I added:

soundTable = { "notify.wav", "chord.wav" }
customSound.Init(soundTable)


It fires as expected. Smile


Info on the Wav files tested:

[windows default wav files]

Location: C:\Windows\Media

Sample Rate: 44100Hz

Bits per Sample: 16

Bit Rate: 1411 Bp/s

Encoder/Decoder (Codec): PCM S16 LE (aRaw)

Channels: 2 (Stereo)



I'm going to take your advice, & convert any future .wav files I decide to use. Serious file size issues with Quality wav format.


Thanks for this script man! Awesome Job.

_________________
Hitler... When all else fails, you'll be in the right state of mind. Jesus Saves.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Oct 03, 2013 5:10 pm    Post subject: Reply with quote

Glad you could make it.
_________________
Back to top
View user's profile Send private message MSN Messenger
xXxShotzZxXx
How do I cheat?
Reputation: 0

Joined: 29 Jan 2015
Posts: 1

PostPosted: Thu Jan 29, 2015 4:21 pm    Post subject: Reply with quote

That trainer looks amazing,I wanna make something similar to that although I am new to it can you help?I want to make a trainer like you did Laughing
Back to top
View user's profile Send private message
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