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 


Tiny Trainer Problem

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

Joined: 08 Aug 2012
Posts: 25

PostPosted: Tue Jan 07, 2014 2:26 pm    Post subject: Tiny Trainer Problem Reply with quote

Hello Guys,

i have some Problem, maybe you can help me to fix it?

I want to create some tiny Trainer, next to it a Folder called "src" including the luasocket-package.
Now the Problem is the Error in the attached Screenshot below...


Code:
fix__0 = io.open(TrainerOrigin..'src/lua/ltn12.lua', "rb")
fix__1 = io.open(TrainerOrigin..'src/lua/mime.lua', "rb")
fix__2 = io.open(TrainerOrigin..'src/lua/socket.lua', "rb")
fix__3 = io.open(TrainerOrigin..'src/lua/socket/ftp.lua', "rb")
fix__4 = io.open(TrainerOrigin..'src/lua/socket/http.lua', "rb")
fix__5 = io.open(TrainerOrigin..'src/lua/socket/smtp.lua', "rb")
fix__6 = io.open(TrainerOrigin..'src/lua/socket/tp.lua', "rb")
fix__7 = io.open(TrainerOrigin..'src/lua/socket/url.lua', "rb")
fix__8 = io.open(TrainerOrigin..'src/mime/core.dll', "rb")
fix__9 = io.open(TrainerOrigin..'src/socket/core.dll', "rb")
------------------------------------------------------------------
fixed0 = io.open(getCheatEngineDir()..'lua/ltn12.lua',"wb")
fixed1 = io.open(getCheatEngineDir()..'lua/mime.lua',"wb")
fixed2 = io.open(getCheatEngineDir()..'lua/socket.lua',"wb")
fixed3 = io.open(getCheatEngineDir()..'lua/socket/ftp.lua',"wb")
fixed4 = io.open(getCheatEngineDir()..'lua/socket/http.lua',"wb")
fixed5 = io.open(getCheatEngineDir()..'lua/socket/smtp.lua',"wb")
fixed6 = io.open(getCheatEngineDir()..'lua/socket/tp.lua',"wb")
fixed7 = io.open(getCheatEngineDir()..'lua/socket/url.lua',"wb")
fixed8 = io.open(getCheatEngineDir()..'mime/core.dll',"wb")
fixed9 = io.open(getCheatEngineDir()..'socket/core.dll',"wb")
------------------------------------------------------------------
bytes0 = fix__0:read(120000); fixed0:write(bytes0); fix__0:close(); fixed0:close();
bytes1 = fix__1:read(120000); fixed1:write(bytes1); fix__1:close(); fixed1:close();
bytes2 = fix__2:read(120000); fixed2:write(bytes2); fix__2:close(); fixed2:close();
bytes3 = fix__3:read(120000); fixed3:write(bytes3); fix__3:close(); fixed3:close();
bytes4 = fix__4:read(120000); fixed4:write(bytes4); fix__4:close(); fixed4:close();
bytes5 = fix__5:read(120000); fixed5:write(bytes5); fix__5:close(); fixed5:close();
bytes6 = fix__6:read(120000); fixed6:write(bytes6); fix__6:close(); fixed6:close();
bytes7 = fix__7:read(120000); fixed7:write(bytes7); fix__7:close(); fixed7:close();
bytes8 = fix__8:read(120000); fixed8:write(bytes8); fix__8:close(); fixed8:close();
bytes9 = fix__9:read(120000); fixed9:write(bytes9); fix__9:close(); fixed9:close()

messageDialog([[   - Your System is now Unlocked !
               - Have Fun using my Hacks :)   ]], 0, 2);



I cant copy those Files into my CE Folder, but its really important for my Trainers and Releases in future, so i hope you can help me with that.. :/

Thx and happy new Year,
Keule Smile



Screenshot_002.png
 Description:
 Filesize:  34.12 KB
 Viewed:  12340 Time(s)

Screenshot_002.png


Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Jan 07, 2014 4:35 pm    Post subject: Reply with quote

You're sure you cant just set the lua package and cpath paths to the trainerorigin and use the socket plugin from the trainer folder?

Anyhow, you may first have to create the paths in the cheat engine folder before creating the file

_________________
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
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Jan 07, 2014 5:25 pm    Post subject: Reply with quote

Here is an example of the most recent socket library used by a tiny trainer, without the need to copy the files to the cheat engine dir:
http://cheatengine.org/download/trainerwithsocketexample.zip

(there is a .pdb file in the 32-bit libs folder which you can delete to save on size)

_________________
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
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Tue Jan 07, 2014 6:10 pm    Post subject: Reply with quote

Code:
local _a = io.open(getCheatEngineDir()..'lua\\ltn12.lua', "r");
local a = _a:read("*all");
local b = io.open('C:\\Lua\\ltn12.lua', "w");
b:write(a); b:close(); _a:close();
local _a = io.open(getCheatEngineDir()..'lua\\mime.lua', "r")
local a = _a:read("*all");
local b = io.open('C:\\Lua\\mime.lua', "w");
b:write(a); b:close(); _a:close();
local _a = io.open(getCheatEngineDir()..'lua\\socket.lua', "r")
local a = _a:read("*all");
local b = io.open('C:\\Lua\\socket.lua', "w");
b:write(a); b:close(); _a:close();
local _a = io.open(getCheatEngineDir()..'lua\\socket\\ftp.lua', "r")
local a = _a:read("*all");
local b = io.open('C:\\Lua\\ftp.lua', "w");
b:write(a); b:close(); _a:close();
local _a = io.open(getCheatEngineDir()..'lua\\socket\\http.lua', "r")
local a = _a:read("*all");
local b = io.open('C:\\Lua\\http.lua', "w");
b:write(a); b:close(); _a:close();
local _a = io.open(getCheatEngineDir()..'lua\\socket\\smtp.lua', "r")
local a = _a:read("*all");
local b = io.open('C:\\Lua\\smtp.lua', "w");
b:write(a); b:close(); _a:close();
local _a = io.open(getCheatEngineDir()..'lua\\socket\\tp.lua', "r")
local a = _a:read("*all");
local b = io.open('C:\\Lua\\tp.lua', "w");
b:write(a); b:close(); _a:close();
local _a = io.open(getCheatEngineDir()..'lua\\socket\\url.lua', "r")
local a = _a:read("*all");
local b = io.open('C:\\Lua\\url.lua', "w");
b:write(a); b:close(); _a:close();


You cannot read and write .dlls data this method.

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
Keule
Cheater
Reputation: 0

Joined: 08 Aug 2012
Posts: 25

PostPosted: Wed Jan 08, 2014 9:13 am    Post subject: Reply with quote

Thanks DarkByte, i will take a look at it Smile
Edit: solved... my own fault, sorry Wink

@DaSpammer
Wrong, i'm sure you can write .dll's with this method.
See DarkByte's Fix in this Post, i did it the same Way Wink :

/viewtopic.php?p=5373053#5373053


Last edited by Keule on Wed Jan 08, 2014 10:27 am; edited 1 time in total
Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Wed Jan 08, 2014 10:10 am    Post subject: Reply with quote

Keule wrote:
Thanks DarkByte, i will take a look at it Smile
Edit: There seems to be a Bug somewhere, it prints out:

Error:[string "RequiredCEVersion=6.3..."]:28: attempt to index global 'http' (a boolean value)
in the Lua Console.

@DaSpammer
Wrong, i'm sure you can write .dll's with this method.
See DarkByte's Fix in this Post, i did it the same Way Wink :

/viewtopic.php?p=5373053#5373053

You can't write .dll's by storing the string of the .dll (which contains symbols that cannot be copied), you may duplicate it, but cannot store it as string (at least not using this method).

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
Keule
Cheater
Reputation: 0

Joined: 08 Aug 2012
Posts: 25

PostPosted: Wed Jan 08, 2014 10:30 am    Post subject: Reply with quote

It reads the file in binary-mode and writes in same method to new file.

@DarkByte
That piece of Code made it working fine Wink
Great thx! I got it working! FINALLY hehe Smile
Back to top
View user's profile Send private message
Keule
Cheater
Reputation: 0

Joined: 08 Aug 2012
Posts: 25

PostPosted: Mon Jan 13, 2014 1:42 pm    Post subject: Reply with quote

Now i have another Error...
it says, that "b1" is a nil value.

Here is the Code of the whole Function, i tried in x86 and x64, nothing worked. Sad


Code:

function ConnectButtonClick(sender)
   local a1 = io.open(TrainerOrigin..'src\\lua\\ltn12.lua', "rb")
   local _a1 = a1:read("*all");
   local b1 = io.open(getCheatEngineDir()..'lua\\ltn12.lua',"wb")
   b1:write(_a1); b1:close(); a1:close();
   UDF1.CEProgressbar1.Position = 10
   UDF1.CEPanel2.Caption = "10% - ltn12.lua copied."
   UDF1.CEPanel2.Color = c_orange
---
   local a2 = io.open(TrainerOrigin..'src\\lua\\mime.lua', "rb")
   local _a2 = a2:read("*all");
   local b2 = io.open(getCheatEngineDir()..'lua\\mime.lua',"wb")
   b2:write(_a2); b2:close(); a2:close();
   UDF1.CEProgressbar1.Position = 20
   UDF1.CEPanel2.Caption = "20% - mime.lua copied."
---
   local a3 = io.open(TrainerOrigin..'src\\lua\\socket.lua', "rb")
   local _a3 = a3:read("*all");
   local b3 = io.open(getCheatEngineDir()..'lua\\socket.lua',"wb")
   b3:write(_a3); b3:close(); a3:close();
   UDF1.CEProgressbar1.Position = 30
   UDF1.CEPanel2.Caption = "30% - socket.lua copied."
---
   local a4 = io.open(TrainerOrigin..'src\\lua\\socket\\ftp.lua', "rb")
   local _a4 = a4:read("*all");
   local b4 = io.open(getCheatEngineDir()..'lua\\socket\\ftp.lua',"wb")
   b4:write(_a4); b4:close(); a4:close();
   UDF1.CEProgressbar1.Position = 40
   UDF1.CEPanel2.Caption = "40% - ftp.lua copied."
---
   local a5 = io.open(TrainerOrigin..'src\\lua\\socket\\http.lua', "rb")
   local _a5 = a5:read("*all");
   local b5 = io.open(getCheatEngineDir()..'lua\\socket\\http.lua',"wb")
   b5:write(_a5); b5:close(); a5:close();
   UDF1.CEProgressbar1.Position = 50
   UDF1.CEPanel2.Caption = "50% - http.lua copied."
---
   local a6 = io.open(TrainerOrigin..'src\\lua\\socket\\smtp.lua', "rb")
   local _a6 = a6:read("*all");
   local b6 = io.open(getCheatEngineDir()..'lua\\socket\\smtp.lua',"wb")
   b6:write(_a6); b6:close(); a6:close();
   UDF1.CEProgressbar1.Position = 60
   UDF1.CEPanel2.Caption = "60% - smtp.lua copied."
---
   local a7 = io.open(TrainerOrigin..'src\\lua\\socket\\tp.lua', "rb")
   local _a7 = a7:read("*all");
   local b7 = io.open(getCheatEngineDir()..'lua\\socket\\tp.lua',"wb")
   b7:write(_a7); b7:close(); a7:close();
   UDF1.CEProgressbar1.Position = 70
   UDF1.CEPanel2.Caption = "70% - tp.lua copied."
---
   local a8 = io.open(TrainerOrigin..'src\\lua\\socket\\url.lua', "rb")
   local _a8 = a8:read("*all");
   local b8 = io.open(getCheatEngineDir()..'lua\\socket\\url.lua',"wb")
   b8:write(_a8); b8:close(); a8:close();
   UDF1.CEProgressbar1.Position = 80
   UDF1.CEPanel2.Caption = "80% - url.lua copied."
---
   local a9 = io.open(TrainerOrigin..'src\\x86\\mime\\core.dll', "rb")
   local _a9 = a9:read("*all");
   local b9 = io.open(getCheatEngineDir()..'mime\\core.dll',"wb")
   b9:write(_a9); b9:close(); a9:close();
   UDF1.CEProgressbar1.Position = 90
   UDF1.CEPanel2.Caption = "90% - mime/core.dll copied."
---
   local a0 = io.open(TrainerOrigin..'src\\x86\\socket\\core.dll', "rb")
   local _a0 = a0:read("*all");
   local b0 = io.open(getCheatEngineDir()..'socket\\core.dll',"wb")
   b0:write(_a0); b0:close(); a0:close();
   UDF1.CEProgressbar1.Position = 100
   UDF1.CEPanel2.Caption = "100% - Connected!"
   UDF1.CEPanel2.Color = c_green
   UDF1.ConnectButton.Visible = false
---
   messageDialog([[- Your System is now Unlocked !
               - Have Fun using my Hacks :)
   ]], 2, 2);
end
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Jan 13, 2014 3:41 pm    Post subject: Reply with quote

Does the path (getCheatEngineDir()..'lua\') exist ?
If not, file creation will probably fail

_________________
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
Keule
Cheater
Reputation: 0

Joined: 08 Aug 2012
Posts: 25

PostPosted: Mon Jan 13, 2014 4:12 pm    Post subject: Reply with quote

I want to create those Subfolders in the C.E. Folder, then copy those Files into it, so that i dont need to include the Luasocket-Package in every future Release Smile
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