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 


How to change the music volume on the trainer?
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Aylin
Expert Cheater
Reputation: 2

Joined: 16 Feb 2017
Posts: 154

PostPosted: Tue Feb 20, 2018 7:25 pm    Post subject: Reply with quote

FreeER wrote:
@mgrinzPlayer you know, pause is a bit pointless if play causes it to restart from the beginning all the time... Smile

@aylin CETimer23Timer is constantly calling stopMP3...



Shocked Thanks Masters Smile

Error Code:

Code:
function CETimer22Timer(sender)
UDF1.CETimer21.enabled = false
UDF1.CEImage29.visible = true
UDF1.CETimer23.enabled = true
end
function CETimer23Timer(sender)
UDF1.CEImage22.enabled = false -- No Image and Timer Stop! :)
UDF1.CETimer23.enabled = false
stopMP3()
end


and Code

Code:
function CETimer22Timer(sender)
UDF1.CETimer21.enabled = false
UDF1.CEImage29.visible = true
UDF1.CETimer23.enabled = true
end
function CETimer23Timer(sender)
UDF1.CETimer22.enabled = false --Timer Stop
UDF1.CETimer23.enabled = false
stopMP3()
end


Thanks FreeER Smile
CT and Trainer work in the folder where the music files are located!
Can we encode these in CT locally? Rolling Eyes
Pretty complicated coding.
Your music needs to be executed from within the trainer Rolling Eyes


And Finish Smile
https://www.dropbox.com/s/4mnmjcuv53tyueg/PLAY_MP3_INTRO.rar?dl=0

_________________
See Hitler ! This Trainer is for you!
http://forum.cheatengine.org/viewtopic.php?t=606786
Enthusiastic people: Always one step ahead!
Do not underestimate me Master: You were a beginner in the past!
Back to top
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater
Reputation: 17

Joined: 10 Apr 2015
Posts: 619

PostPosted: Tue Feb 20, 2018 9:56 pm    Post subject: Reply with quote

Quote:
And Finish
https://www.dropbox.com/s/4mnmjcuv53tyueg/PLAY_MP3_INTRO.rar?dl=0


your timer still contains error.

_________________
Singapore Sling + Johnnie Walker + Some Peanuts....
Back to top
View user's profile Send private message
Aylin
Expert Cheater
Reputation: 2

Joined: 16 Feb 2017
Posts: 154

PostPosted: Wed Feb 21, 2018 5:05 am    Post subject: Reply with quote

Corroder wrote:
Quote:
And Finish
https://www.dropbox.com/s/4mnmjcuv53tyueg/PLAY_MP3_INTRO.rar?dl=0


your timer still contains error.


Initially onTimer is on. (Timer25)
Open CT file..
Lua Engine 'Error..' On = View and show on 'print' false..
and Table>> Show Cheat Table Lua Script..
and Execute Script show..


A detail; mp3 and Ct or Trainer should be in the same file.
The good side: People can listen to their favorite song by giving it a name.
For example: We have 3 song commands
1) music111.mp3
2) music122.mp3
3) music13.mp3
If their favorite songs are played by these names, they can listen to MP3 Player as well. Wink

_________________
See Hitler ! This Trainer is for you!
http://forum.cheatengine.org/viewtopic.php?t=606786
Enthusiastic people: Always one step ahead!
Do not underestimate me Master: You were a beginner in the past!
Back to top
View user's profile Send private message MSN Messenger
Aylin
Expert Cheater
Reputation: 2

Joined: 16 Feb 2017
Posts: 154

PostPosted: Wed Feb 21, 2018 4:53 pm    Post subject: Reply with quote

Please watch the video.
Also check out the CT file.
How do I view the MyList folder with ComboBax? Rolling Eyes
I can shoot into the folder.
but I can not see what's in it with the ComboBox.
If you have an opinion, I would like you to correct it.
Thank you.

Video: Rolling Eyes
https://www.youtube.com/watch?v=Vq00HcmXh_c&feature=youtu.be

CT:
https://www.dropbox.com/s/t13aqqz8gvieusx/MyList.rar?dl=0

In fact, in one step, we have entered into multiple details!
But more is growing with every advance. Wink

_________________
See Hitler ! This Trainer is for you!
http://forum.cheatengine.org/viewtopic.php?t=606786
Enthusiastic people: Always one step ahead!
Do not underestimate me Master: You were a beginner in the past!
Back to top
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater
Reputation: 17

Joined: 10 Apr 2015
Posts: 619

PostPosted: Wed Feb 21, 2018 6:37 pm    Post subject: Reply with quote

mgr.inz.Player
Quote:
EDIT:
UPDATE

- added 32bit CE version support
- added unicode characters support (e.g. mp3 path can be C:\Users\username\Desktop\zażłćПрипять\DeusExM00Title.mp3)
- length, position


Suggestion :
- Add media file duration length represent in time format, maybe something like :

Code:
MP3PlayerSendCommand("status MediaFile length", buff, buff.Capacity, 0)


_________________
Singapore Sling + Johnnie Walker + Some Peanuts....
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater
Reputation: 31

Joined: 09 Aug 2013
Posts: 768

PostPosted: Wed Feb 21, 2018 6:51 pm    Post subject: Reply with quote

so... what? you want to fill a combobox with the files in the folder so the user can pick from them? If so I don't need to watch a 9 minute video to figure that out and start looking up what I can to answer the question.

Also, you should have a way to skip the long intro when asking for help (or just in general imo). There's a reason examples given to answer a question tend to only have the required items to answer the question, no one wants to sort through code for 30 other things and wait even 10 seconds longer than they have to before they get to see/do anything meaningful. To fill a combobox with files in a directory all you need is a combobox and some files, not a long animation with a dozen other things...

anyways if you look in the celua.txt file you'll find
Code:
getFileList(Path:string, searchMask:string OPTIONAL, SearchSubDirs: boolean OPTIONAL, DirAttrib: integer OPTIONAL): Returns an indexed table with filenames
getDirectoryList(Path:string, SearchSubDirs: boolean OPTIONAL): Returns an indexed table with directory names


If you launch CE and run
Code:
return getFileList('')
in the lua engine window you'll get either a listing of CE's files in the Program Files folder, or if you launched it from a table the files in the same directory as the table, depending on how windows set the working directory of the program (the "start in" option for shortcuts).

To be more explicit you can use
Code:
return getFileList(TrainerOrigin
(set for trainers and tables). At this point you'll have something like
Code:
:table
[
   1 = C:\Users\HJP19\Desktop\MyList\Favori1.mp3
   2 = C:\Users\HJP19\Desktop\MyList\Favori5.mp3
   3 = C:\Users\HJP19\Desktop\MyList\music111.mp3
   4 = C:\Users\HJP19\Desktop\MyList\music122.mp3
   5 = C:\Users\HJP19\Desktop\MyList\music13.mp3
   6 = C:\Users\HJP19\Desktop\MyList\MyList.rar
   7 = C:\Users\HJP19\Desktop\MyList\PLAY_MP3-INTRO.CT
   8 = C:\Users\HJP19\Desktop\MyList\simple.CT
]


so you just have to extract the names out of it. match will let you pattern match, obviously the first part is going to be the path you gave getFileList, TrainerOrigin. The next part is some filename followed by .mp3, which gives you a pattern of
Code:
TrainerOrigin..'(.*)%.mp3'
the ()s are there to capture just the name and the %. is because . is a wilcard that matches any character and we want it to explicitly match the . in the extension.

Now you have the name, or nil if its not an mp3, you just need to fill the combolist with it. by doing formname.comboboxname.Items.add(name).

So the code so far is
Code:
-- get the list of files
local files = getFileList(TrainerOrigin)
-- just in case it gets run multiple times, clear the combobox list
UDF1.CEComboBox1.Items.clear()
-- loop through the found files
for i,f in ipairs(files) do
  -- get the name, if it's an mp3
  local name = f:match(TrainerOrigin..'(.*)%.mp3')
  if name then -- if it was an mp3
    UDF1.CEComboBox1.Items.add(name) -- add it
  end
end


Now, to do something when the combobox is changed you have to get the selected name

Code:
UDF1.CEComboBox1.OnChange = function(thecombobox)
  local name = thecombobox.Items[thecombobox.ItemIndex]
end


Now to get the full path again you just need to add back TrainerOrigin and .mp3

Code:
UDF1.CEComboBox1.OnChange = function(thecombobox)
  local name = thecombobox.Items[thecombobox.ItemIndex] 
  local path = TrainerOrigin .. name .. '.mp3'
  print(path) -- simple test
end


Alternatively you could use the ItemIndex and the original files list.

And at this point you can pass the full filepath to anything you like.

Leaving the full example code as
Code:
local files = getFileList(TrainerOrigin)
UDF1.CEComboBox1.Items.clear()
for i,f in ipairs(files) do
  local name = f:match(TrainerOrigin..'(.*)%.mp3')
  if name then
    UDF1.CEComboBox1.Items.add(name)
  end
end
UDF1.CEComboBox1.ItemIndex = -1

UDF1.CEComboBox1.OnChange = function(thecombobox)
  local name = thecombobox.Items[thecombobox.ItemIndex]
  local path = TrainerOrigin .. name .. '.mp3'
  print(path)
end
combined with a form and combobox which is so small it's not even worth sharing a CT for. You can even add some code so that the user doesn't need to create the form theirselves just to test
Code:
-- code to create form and combobox for standalone example
if not UDF1 then
  UDF1 = createForm()
end
if not UDF1.CEComboBox1 then
  UDF1.CEComboBox1 = createComboBox(UDF1)
end
UDF1.show()


It's not pretty, but it's the minimum viable product. There's no time wasted on anyone's part (creating, sharing, downloading, looking for what's relevant, waiting before you can do anything etc).

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Aylin
Expert Cheater
Reputation: 2

Joined: 16 Feb 2017
Posts: 154

PostPosted: Wed Feb 21, 2018 7:21 pm    Post subject: Reply with quote

I know this was the last question and thank you.
If you did not have your help, I would give up at the beginning.
I apologize, you've been helping me every step of the way.
I boast with the products,
By sharing, I know it will multiply.
Thousands of thanks.
It is an honor to work with you to save distance.

_________________
See Hitler ! This Trainer is for you!
http://forum.cheatengine.org/viewtopic.php?t=606786
Enthusiastic people: Always one step ahead!
Do not underestimate me Master: You were a beginner in the past!
Back to top
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater
Reputation: 17

Joined: 10 Apr 2015
Posts: 619

PostPosted: Wed Feb 21, 2018 7:29 pm    Post subject: This post has 1 review(s) Reply with quote

Ths topic :

http://cheatengine.org/forum/viewtopic.php?t=603646&view=previous&sid=d015a1714c70004e1757766df057a52a

I more like using :
Code:
 load_dialog = createOpenDialog(self)
 load_dialog.InitalDir = os.getenv('%USERPROFILE%')
 load_dialog.execute()
 file = load_dialog.FileName


and let user choose their own mp3 file songs... considering by size of the trainer.

EDIT for my other post on this topic :

Suggestion :
- Add media file duration length represent in time format, maybe something like :

Code:
MP3PlayerSendCommand("status MediaFile length", buff, buff.Capacity, 0)


I've done to modified MP3 Player :
1. Add Elapse Time for media playing
2. Custom progress bar using CEPanel, so able to using custom color for progress bar face



Capture.JPG
 Description:
 Filesize:  24.6 KB
 Viewed:  3308 Time(s)

Capture.JPG



_________________
Singapore Sling + Johnnie Walker + Some Peanuts....
Back to top
View user's profile Send private message
Aylin
Expert Cheater
Reputation: 2

Joined: 16 Feb 2017
Posts: 154

PostPosted: Thu Feb 22, 2018 10:11 am    Post subject: Reply with quote

@FreeER Will get mad at me! Smile

Your coding, point shot, exactly as I desire.
But at the command of every song play,
an error message occurs. Always the same text: file path!
I installed a simple CT on the subject (I was scolded for other CT, I smell Smile )

-------
@Corroder, I'm a novice designer. I know that. Wink
But I do not have the experience to combine complex codes.
I can translate simple narratives into visual jigsaws.
Perhaps you can select the file with a Button and
The selected file is automatically listed in the ComboBox. Rolling Eyes
-------
In the last one month, I quit games,
Visual Trainer began ambition to do!
This will be completed when the final project is resolved.

-------
Again Thanks..
https://www.dropbox.com/s/vum2v6fxa0zmkzq/simpleMP3_1.CT?dl=0

_________________
See Hitler ! This Trainer is for you!
http://forum.cheatengine.org/viewtopic.php?t=606786
Enthusiastic people: Always one step ahead!
Do not underestimate me Master: You were a beginner in the past!
Back to top
View user's profile Send private message MSN Messenger
FreeER
Grandmaster Cheater
Reputation: 31

Joined: 09 Aug 2013
Posts: 768

PostPosted: Thu Feb 22, 2018 10:32 am    Post subject: Reply with quote

That's a bit better Smile certainly faster to test with, though none of the music code really seems necessary, it's just more stuff to scroll though to look at the relevant code near the end of the lua script Smile

However, it's working fine for me... it does print the file path but that's because of the print(path) on line 158. That's not an error it's just doing what it was told to do Smile

As for loading their own files into the combobox from a dialog, you could easily enough just do
Code:
--Corroder's code
load_dialog = createOpenDialog(self)
load_dialog.InitalDir = os.getenv('%USERPROFILE%')
load_dialog.execute()
file = load_dialog.FileName
-- add to list
if file then
  local path, name = file:match('(.*\\)(.*)%.mp3')
  if name then -- might not be mp3 since it was not forced in dialog
    UDF1.CEComboBox1.Items.add(name)
  end
end


but the problem is that the path is (probably) going to be different for it so you can't just use the simple TrainerOrigin .. selectedName .. '.mp3' in the on change function anymore. You'd have to instead keep the list of found files around somewhere and when adding a file name to the combo list you'd also add the full path to the end of that table, and then onchange get the path from that table using the ItemIndex (because they are in the same order, if they weren't you'd have to do a more complicated check to see if the filenames match).

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Aylin
Expert Cheater
Reputation: 2

Joined: 16 Feb 2017
Posts: 154

PostPosted: Thu Feb 22, 2018 1:19 pm    Post subject: Reply with quote

No complaints this time! Thank you. Smile
But this latest code selects the files one by one.
There is no list selection similar to Ctrl + a.
Thanks for everything.
Now we can combine all these studies,
It's time to build the trainer.
Of course I will follow the forums. Thanks again.
Note: Corrod, latest CT I gave Label color, you should look at. Wink


Thanks Masters..

https://www.dropbox.com/s/3usg4wcpfocnar2/simpleMP3_2.CT?dl=0

_________________
See Hitler ! This Trainer is for you!
http://forum.cheatengine.org/viewtopic.php?t=606786
Enthusiastic people: Always one step ahead!
Do not underestimate me Master: You were a beginner in the past!
Back to top
View user's profile Send private message MSN Messenger
FreeER
Grandmaster Cheater
Reputation: 31

Joined: 09 Aug 2013
Posts: 768

PostPosted: Thu Feb 22, 2018 7:14 pm    Post subject: Reply with quote

Quote:
But this latest code selects the files one by one.

It looks like the dialog does have a

Code:
Files: Strings - Stringlist containing all selected files if multiple files are selected


So you'd just loop over that and do the same thing for each of them instead of only using File

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater
Reputation: 17

Joined: 10 Apr 2015
Posts: 619

PostPosted: Fri Feb 23, 2018 10:28 am    Post subject: Reply with quote

FreeER wrote:
Quote:
But this latest code selects the files one by one.

It looks like the dialog does have a

Code:
Files: Strings - Stringlist containing all selected files if multiple files are selected



and to filtering files when browsing in a directory :

Code:
// ............
load_dialog.InitalDir = os.getenv('%USERPROFILE%')
 load_dialog.Filter = 'MP3 files|*.mp3|*'    ------------------ add this code
 load_dialog.execute()
// ............

_________________
Singapore Sling + Johnnie Walker + Some Peanuts....
Back to top
View user's profile Send private message
Aylin
Expert Cheater
Reputation: 2

Joined: 16 Feb 2017
Posts: 154

PostPosted: Fri Feb 23, 2018 1:46 pm    Post subject: Reply with quote

Corroder wrote:
FreeER wrote:
Quote:
But this latest code selects the files one by one.

It looks like the dialog does have a

Code:
Files: Strings - Stringlist containing all selected files if multiple files are selected



and to filtering files when browsing in a directory :

Code:
// ............
load_dialog.InitalDir = os.getenv('%USERPROFILE%')
 load_dialog.Filter = 'MP3 files|*.mp3|*'    ------------------ add this code
 load_dialog.execute()
// ............


-------------------------------
Maybe Freeer is right. Rolling Eyes
When you open the subject within the subject, the results are mixed.
Still codes for playback Trainer lives in its own file.
Trainer opened outside the file, does not play music.
there was a lot of code change.
As the demand rises, the code is added and the result is complex.
Functional roundup:
1) Upload file button: Must be able to select multiple files.
2) ComboBox function: List selected multiple files.
3) ComboBox function: Play the selected file from the list.

This should be the topic and coding.
Videos of the current operating results.
to collate the last codes
Adapting the trainers does not seem possible for me. Sad

I have to go back and re-blend all the codes. Smile
Video:
https://www.youtube.com/watch?v=iouIQSQAXFg&feature=youtu.be

_________________
See Hitler ! This Trainer is for you!
http://forum.cheatengine.org/viewtopic.php?t=606786
Enthusiastic people: Always one step ahead!
Do not underestimate me Master: You were a beginner in the past!
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
Goto page Previous  1, 2, 3
Page 3 of 3

 
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