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 


LUA script error
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Branimir
Advanced Cheater
Reputation: 0

Joined: 12 May 2015
Posts: 58

PostPosted: Tue May 12, 2015 11:28 pm    Post subject: LUA script error Reply with quote

Can someone tell me what went wrong with my trainer?
I added a .xm music file to it (Beautiful Insanity.xm) and then all hell broke loose... (Works like a charm without the .xm file).
(Yes, if it wasn't obvious enough already, I'm a complete noob when it comes to LUA).

OS: Windows 7 Home Premium 64-bit
Cheat Engine version 6.4

I will attach a picture of the problem to this post.

If anyone can help, I'd be grateful.

Edit:

Okay, so I found this LUA script when Googling for the .xm error:

methods
playXM(filename, OPTIONAL noloop)
playXM(tablefile, OPTIONAL noloop)
playXM(Stream, OPTIONAL noloop)
pause()
resume()
stop()

But, what do I do with it?



Error.png
 Description:
 Filesize:  242.71 KB
 Viewed:  23926 Time(s)

Error.png




Last edited by Branimir on Tue May 12, 2015 11:38 pm; edited 1 time in total
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Tue May 12, 2015 11:38 pm    Post subject: Reply with quote

You're attempting to call field 'isPlayer' (a boolean value)

Don't do that.

Bad:
Code:
isPlayer()


Good:
Code:
if isPlayer then
Back to top
View user's profile Send private message
Branimir
Advanced Cheater
Reputation: 0

Joined: 12 May 2015
Posts: 58

PostPosted: Tue May 12, 2015 11:40 pm    Post subject: Reply with quote

Zanzer wrote:
You're attempting to call field 'isPlayer' (a boolean value)

Don't do that.

Bad:
Code:
isPlayer()


Good:
Code:
if isPlayer then



Thanks for replying. I'll try your tip now.

Edit:

I tried your code/script, but now I got a different error:



Error2.png
 Description:
 Filesize:  233.32 KB
 Viewed:  23910 Time(s)

Error2.png


Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed May 13, 2015 12:08 am    Post subject: Reply with quote

Perhaps if you would post the code you're trying to modify, we can help. Smile
Back to top
View user's profile Send private message
Branimir
Advanced Cheater
Reputation: 0

Joined: 12 May 2015
Posts: 58

PostPosted: Wed May 13, 2015 12:09 am    Post subject: Reply with quote

Zanzer wrote:
Perhaps if you would post the code you're trying to modify, we can help. Smile


...What do you mean by that?
I'm not trying to modify anything.
I just want to put a .xm file into my trainer.
Back to top
View user's profile Send private message
Fluffer_Nutter
Advanced Cheater
Reputation: 0

Joined: 26 Feb 2015
Posts: 67

PostPosted: Wed May 13, 2015 12:11 am    Post subject: Reply with quote

Branimir wrote:
Zanzer wrote:
Perhaps if you would post the code you're trying to modify, we can help. Smile


...What do you mean by that?
I'm not trying to modify anything.
I just want to put a .xm file into my trainer.



He means post the CT file so the error can be seen and corrected. Cant help what you cant see.
Back to top
View user's profile Send private message
Branimir
Advanced Cheater
Reputation: 0

Joined: 12 May 2015
Posts: 58

PostPosted: Wed May 13, 2015 12:20 am    Post subject: Reply with quote

Fluffer_Nutter wrote:
Branimir wrote:
Zanzer wrote:
Perhaps if you would post the code you're trying to modify, we can help. Smile


...What do you mean by that?
I'm not trying to modify anything.
I just want to put a .xm file into my trainer.



He means post the CT file so the error can be seen and corrected. Cant help what you cant see.



I don't have the source files for the trainer
(only the .exe for the one without music (The one that works).
I have created a .ct file just for testing purposes with the .xm file.

I'll attach it in this post.
(Check the LUA script table)



Neighbours From Hell.CT
 Description:

Download
 Filename:  Neighbours From Hell.CT
 Filesize:  188 Bytes
 Downloaded:  725 Time(s)

Back to top
View user's profile Send private message
Fluffer_Nutter
Advanced Cheater
Reputation: 0

Joined: 26 Feb 2015
Posts: 67

PostPosted: Wed May 13, 2015 1:01 am    Post subject: Reply with quote

Here is a CT file with Play, Pause, Resume, Stop.

Or just load it when the file loads. The world is yours buddy.

Cheers.

- Fluffer Nutter



Fixed XM sound player.CT
 Description:

Download
 Filename:  Fixed XM sound player.CT
 Filesize:  1.12 MB
 Downloaded:  815 Time(s)

Back to top
View user's profile Send private message
Branimir
Advanced Cheater
Reputation: 0

Joined: 12 May 2015
Posts: 58

PostPosted: Wed May 13, 2015 1:23 am    Post subject: Reply with quote

Fluffer_Nutter wrote:
Here is a CT file with Play, Pause, Resume, Stop.

Or just load it when the file loads. The world is yours buddy.

Cheers.

- Fluffer Nutter


...You are amazing! This is exactly what I was looking for!
Back to top
View user's profile Send private message
Branimir
Advanced Cheater
Reputation: 0

Joined: 12 May 2015
Posts: 58

PostPosted: Thu Oct 22, 2015 12:05 pm    Post subject: Reply with quote

Well, I have enjoyed Fluffer_Nutter's cheat table fix for quite some time now,
but I believe it is time for me to finally learn how people like Fling
(Chinese trainer maker from 3DMgame) makes trainers with sounds in them.
(Without any need for extra windows like Fluffer_Nutter's ct file).

So... Can anyone here tell me what is needed when making a standalone trainer
(.exe) with .xm music embedded directly in it like it is in his/her trainer?
I have all the skills needed when editing the trainer via the Form Designer.
However...adding music is still unknown to me.
(I keep getting the error from my earlier posts).

I will add the picture with the "Play .xm music file" option as an attachment.



a12f699e4f86c66e8ec61a335a691d68.png
 Description:
 Filesize:  3.59 KB
 Viewed:  22204 Time(s)

a12f699e4f86c66e8ec61a335a691d68.png


Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Oct 22, 2015 10:54 pm    Post subject: Reply with quote

I made a simple music tool / player using CE Form Design and lua.
Maybe it can help or useful for you.

Instruction :
1. Download a simple (small 150 kb) of music player called 1by1.exe
link : https://www.mediafire.com/?6cdkduwjf8qh480
2. Once download finish, extract it and put file 1by1.exe into same foder
with the ct file (attached)
3. Run CT file and try it by your self
4. You able to edit script / form inside CT file and save it as CETrainer or exe

Code:

------ Avoid lua engine pop-up
getLuaEngine().cbShowOnPrint.Checked=false
getLuaEngine().hide()

------ Setting Clock
t=createTimer(nil)
t.Interval=1000
t.OnTimer=function(t)
control_setCaption(MyForm.Lbl_Jam, tostring(os.date()))
end
t.Enabled=true

------ Set Single XM Music Tester
function Btn_XMTestClick(sender)
xmplayer.playXM( findTableFile('sweetdre.xm') )
end
--
function Btn_XMPauseClick(sender)
xmplayer_pause()
end
--
function Btn_XMResumeClick(sender)
xmplayer_resume()
end
--
function Btn_XMStopClick(sender)
xmplayer_stop()
end
--
function Btn_OpenMP3Click(sender)
if TrainerOrigin~=nil then
  path=TrainerOrigin
else
  path=getCheatEngineDir()
end
if string.sub(path,#path, #path)~="\\" then
  path=path.."\\"
end
shellExecute(path.."1by1")
end
--
function Btn_ExitClick(sender)
closeCE();
return caFree
end


regards



music2.PNG
 Description:
 Filesize:  189.29 KB
 Viewed:  22118 Time(s)

music2.PNG



CRDR-MusicTool-Ver.1.2.CT
 Description:
A sample tool for music player using CE and lua

Download
 Filename:  CRDR-MusicTool-Ver.1.2.CT
 Filesize:  486.01 KB
 Downloaded:  935 Time(s)

Back to top
View user's profile Send private message
lolAnonymous
Expert Cheater
Reputation: 1

Joined: 19 Jul 2015
Posts: 154

PostPosted: Fri Oct 23, 2015 1:21 am    Post subject: Reply with quote

hey Branimir leave the xm music its old Wink why don't u try the new mp3 music function... Smile
Back to top
View user's profile Send private message
Branimir
Advanced Cheater
Reputation: 0

Joined: 12 May 2015
Posts: 58

PostPosted: Fri Oct 23, 2015 5:57 am    Post subject: Reply with quote

@Corroder
I thank you for your CT and I have already started tinkering with it.
However... Can you tell me why my trainer refuses to work when I give it an
.xm file from the auto trainer generator? The LUA box/window in Cheat Engine is blank.
Is that the problem? I tried using if isPlayer then as per Zanzer's suggestion
(It's in my Neighbors From Hell.ct in my earlier posts), but that didn't help either.
(I have ZERO knowledge in both LUA and programming)

@MasterHacking321
Was there such a function? (I'm using Cheat Engine 6.4 and I can't see it)


Guys... This is depressing... Will I ever be able to put an .xm file into my trainers... Why must it be so hard and unnerving...
Can't Dark Byte fix the Play XM file option in Cheat Engine? Sigh...
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Fri Oct 23, 2015 10:01 am    Post subject: Reply with quote

Branimir, are you added the XM file as stream file into your CT trainer ?.
You can add XM file which you want to play into your trainer as autoplay or by a CEButtonClick(sender).

Here for example :
1. Auto play when you open your trainer
Say we we have a music file name "blabla.XM", then you want XM Player play it automatic when you open your trainer (put this code to the top of your trainer script and you already add blabla.XM as stream file, by click in CE menu > Table > add file) :

Code:

xmplayer.playXM( findTableFile('blabla.xm') )


2. Play, Pause, Resume and Stop XMPlayer
Say you made a CE Trainer form with 4 buttons to control XMPlayer.
The buttons name are CEButton1, CEButton2, CEButton3, CEButton4
To control XMPlayer :

Code:

functionCEButton1Click(sender)
xmplayer.playXM( findTableFile('blabla.xm') )    --- Play music
end
---
function CEButton2Click(sender)
xmplayer_pause()    ---  Pause music
end
---
function CEButton3Click(sender)
xmplayer_resume()      ---- Resume / continue music
end
---
function CEButton4Click(sender)
xmplayer_stop()    ----- stop music
end


I am also open your CT file and just found blank cheat table there. (no idea what happen). Anyhow, try to make a simple CE Trainer using Form Designer shall help you much to understand many things.

A picture to explaining simple tester XMPlayer CT file has attached which you can review or edit.



Capture.JPG
 Description:
 Filesize:  100.12 KB
 Viewed:  22032 Time(s)

Capture.JPG



Fixed XM sound player.CT
 Description:

Download
 Filename:  Fixed XM sound player.CT
 Filesize:  1.12 MB
 Downloaded:  2687 Time(s)

Back to top
View user's profile Send private message
Branimir
Advanced Cheater
Reputation: 0

Joined: 12 May 2015
Posts: 58

PostPosted: Fri Oct 23, 2015 11:04 am    Post subject: Reply with quote

... ... ...IT WORKS!!!
I cannot believe that all it took was 1 line of code.

Code:
xmplayer.playXM( findTableFile('blabla.xm') )


(Which was already in Fluffer_Nutter's CT file to begin with...but I was too retarded to figure it out)
I am...truly...forever in your debt!

Btw... I really am crying right now. Q_Q
THAT'S how happy I am!

Oh and, you don't need to add the .xm file via CE menu > Table > add file.
Adding it through the trainer generator is enough.
(Was curious so I tested it out).

Again... I thank you from the bottom of my being for your aid!!
(And to Fluffer_Nutter as well).
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
Goto page 1, 2  Next
Page 1 of 2

 
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