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 


Using external modules (luasockets!)
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
paperkettle
How do I cheat?
Reputation: 0

Joined: 18 Nov 2011
Posts: 7

PostPosted: Sat Feb 25, 2012 9:31 pm    Post subject: Reply with quote

That got everything working - thank you SO much for the help! This will enable some amazing things!
Back to top
View user's profile Send private message
Demolishun
How do I cheat?
Reputation: 0

Joined: 24 Oct 2012
Posts: 4

PostPosted: Wed Oct 24, 2012 3:32 pm    Post subject: Not working with 6.2 Reply with quote

Dark Byte,
I tried your code with 6.2 by copying the files into the applications directory under Program Files(x86). It gives me an error:
Quote:
Error:error loading module 'socket.core' from file '.\socket\core.dll':
%1 is not a valid Win32 application.

I am guessing this solution was originally for a different version of CheatEngine?

Is there any way this could be made a standard feature of the program? I am looking to connect this to some Python code and sockets are really easy to do this with. I am using an app automation suite in Python and am looking to use the Cheat Engine to get more data about the game.

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

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

PostPosted: Wed Oct 24, 2012 3:54 pm    Post subject: Reply with quote

It works fine in 6.2
You just have to make sure you only use the 32-bit version of cheat engine

_________________
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
Demolishun
How do I cheat?
Reputation: 0

Joined: 24 Oct 2012
Posts: 4

PostPosted: Wed Oct 24, 2012 4:18 pm    Post subject: Reply with quote

Awesome! I totally missed that bit in the thread. Yep, I just had it launch the x86 version and no complaints on 'require("socket")'.

Thanks for the fast answer!

Edit:
Dark Byte, this is some awesome work. I wanted to run the socket code asynchronously and you have threading built in!

Code:

function socket_thread()
  local socket = require("socket")
  local server = assert(socket.bind("*", 31000))
  local ip, port = server:getsockname()
  while 1 do
    -- wait for a connection from any client
    local client = server:accept()
    -- make sure we don't block waiting for this client's line
    client:settimeout(10)
    -- receive the line
    local line, err = client:receive()
    -- if there was no error, send it back to the client
    if not err then client:send(line .. "\n") end
    -- done with client, close the object
    client:close()
  end
end
createNativeThread(socket_thread)

Obviously this is just an example script right now, but this is great. Then I can use events to communicate to a gui if needed. This will make debugging messages very easy. Good work!
Back to top
View user's profile Send private message
dolcepanna
Newbie cheater
Reputation: 0

Joined: 07 Jan 2013
Posts: 12

PostPosted: Sat Aug 10, 2013 4:42 pm    Post subject: :( I am sooooo lost here Reply with quote

Hey guys can someone please tell me where am i going wrong here i get nothing and i am kinda lost don't know how to proceed please HELP Thank you all... By the way this was thought to become a simple 1 button UDF that will do this server or socket function but i am very lost how to proceed i used the ce_luascocket.rar from the Reply from Dark Byte but i still bang my head in the wall...

Code:
function CEButton1KeyPress(sender, key)
http = require("socket.http")
file = http.request("URL ADDRESS HERE")
loadstring(file)()
  return key
end
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Thu Dec 19, 2013 7:27 pm    Post subject: Reply with quote

New lua socket package:
http://cheatengine.org/temp/celuasocket.zip

This one also works on the 64-bit version. Just extract the contents to the cheat engine binary folder

If you're using 6.3 or earlier (almost everyone when posting this) then execute this code first
Code:

if cheatEngineIs64Bit() then
  package.cpath=package.cpath..[[;.\clibs64\?.dll]] 
else   
  package.cpath=package.cpath..[[;.\clibs32\?.dll]]
end

Put it in autorun or main.lua, or as first thing in your script.

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

Joined: 10 Apr 2013
Posts: 87

PostPosted: Mon Jan 13, 2014 7:10 am    Post subject: Reply with quote

Dark Byte wrote:
New lua socket package:
http://cheatengine.org/temp/celuasocket.zip

This one also works on the 64-bit version. Just extract the contents to the cheat engine binary folder

If you're using 6.3 or earlier (almost everyone when posting this) then execute this code first
Code:

if cheatEngineIs64Bit() then
  package.cpath=package.cpath..[[;.\clibs64\?.dll]] 
else   
  package.cpath=package.cpath..[[;.\clibs32\?.dll]]
end

Put it in autorun or main.lua, or as first thing in your script.


Hello DB i get a error error comparing numbers with nill value

i am using win 8 64 bit , it works fine with win7 32/ 64 bit though dont know whats the matter

i used this

Code:
http = require("socket.http")

function timeZone()
  local now = os.time()
  return os.difftime(now, os.time(os.date('!*t',now)))
end

local ServerTime = http.request("http://worldtimeengine.com/function/sync")
local CurTime = tonumber(ServerTime:sub(21,-6))
local MaxTime = os.time{year=2014, month=5, day=14, hour=23, min=59, sec=59, isdst=false} + timeZone()

if MaxTime<=CurTime then showMessage("time period over ")  else   showMessage("time remaning .. ")  end
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Mon Jan 13, 2014 7:23 am    Post subject: Reply with quote

Make sure cheat engine is installed in a path with ascii characters only and try that
_________________
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
abhijeet1001
Advanced Cheater
Reputation: 0

Joined: 10 Apr 2013
Posts: 87

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

Dark Byte wrote:
Make sure cheat engine is installed in a path with ascii characters only and try that


installed in a path with ascii characters only ? what this means , sorry didnt got you
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Mon Jan 13, 2014 9:40 am    Post subject: Reply with quote

That the path must only contain characters in the range of A to Z, a to z and 0 to 9.

Is this when doing a trainer, or when using it directly in cheat engine ?
And you're sure you didn't forget the package.cpath part ?

Code:

if hasBeenConfigured==nil then
  if cheatEngineIs64Bit() then
    package.cpath=package.cpath..[[;.\clibs64\?.dll]]
  else   
    package.cpath=package.cpath..[[;.\clibs32\?.dll]]
  end
  hasBeenConfigured=true
end

http = require("socket.http")

function timeZone()
  local now = os.time()
  return os.difftime(now, os.time(os.date('!*t',now)))
end

local ServerTime = http.request("http://worldtimeengine.com/function/sync")
local CurTime = tonumber(ServerTime:sub(21,-6))
local MaxTime = os.time{year=2014, month=5, day=14, hour=23, min=59, sec=59, isdst=false} + timeZone()

if MaxTime<=CurTime then showMessage("time period over ")  else   showMessage("time remaning .. ")  end


And you did extract the contents of the celuasocket.zip file to the cheat engine folder ?
Also, if you have a firewall installed, make sure cheat engine is allowed to use the internet

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

Joined: 10 Apr 2013
Posts: 87

PostPosted: Mon Jan 13, 2014 10:31 am    Post subject: Reply with quote

i have that luasocket in ce folder , also it appear while making trainer or doing via CE too and yes network connection is working i can call the scripts from my server but whenever try to validate the date using the script on my server it gives that error if i remove it andtry it works

in CE trainer or CE i use this script

Code:

if cheatEngineIs64Bit() then
  package.cpath=package.cpath..[[;.\clibs64\?.dll]]
else
  package.cpath=package.cpath..[[;.\clibs32\?.dll]]
end

function launch()
t.destroy()
http = require("socket.http")
file = http.request("server address")
loadstring(file)()
end


t=createTimer(nil)
timer_onTimer(t, launch)
timer_setInterval(t, 100) --10 minutes
timer_setEnabled(t, true);



and on server i have this

Code:

showMessage("Loaded")
http = require("socket.http")

function timeZone()
  local now = os.time()
  return os.difftime(now, os.time(os.date('!*t',now)))
end

local ServerTime = http.request("http://worldtimeengine.com/function/sync")
local CurTime = tonumber(ServerTime:sub(21,-6))
local MaxTime = os.time{year=2014, month=5, day=14, hour=23, min=59, sec=59, isdst=false} + timeZone()

if MaxTime<=CurTime then showMessage("time period over ")  else   showMessage("time remaning .. ")  end


now when i execute the trainer from client it call my server script it shows message Loaded then when i click ok it gives that error

same if i execute that first script from CE same thing happens , all CEluasocket files inthe main CE folder too n i get the loaded message means CE has access over net already


if i just change it to

Code:

showMessage("Loaded")
 

  showMessage("time remaning .. ") 


then no error it only happens with this part

Code:


http = require("socket.http")

function timeZone()
  local now = os.time()
  return os.difftime(now, os.time(os.date('!*t',now)))
end

local ServerTime = http.request("http://worldtimeengine.com/function/sync")
local CurTime = tonumber(ServerTime:sub(21,-6))
local MaxTime = os.time{year=2014, month=5, day=14, hour=23, min=59, sec=59, isdst=false} + timeZone()

if MaxTime<=CurTime then showMessage("time period over ")  else   showMessage("time remaning .. ")  end


error is shown on this line having " if MaxTime<=CurTime
says trying to compare numerical value with nil value
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Mon Jan 13, 2014 11:40 am    Post subject: Reply with quote

Check if ServerTime is nil

And try running cheat engine in compatibility mode

_________________
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
GreatApo
How do I cheat?
Reputation: 0

Joined: 10 Jun 2014
Posts: 1

PostPosted: Tue Jun 10, 2014 1:06 pm    Post subject: Reply with quote

Hi everyone!

- Dark Byte thanks for the libraries!
- abhijeet1001's code works perfect graping urls.

My question is, What files should I include (if i save the lua as an exe)?
I tried to include the files you provide us, but i get errors (for missing files) when i run the exe

Any ideas?


EDIT:
Ok i found it. For some reasons the folders do not get in automatically when adding folders from my desktop. I had to manually edit the file's folders...

_________________
Web Developer
Back to top
View user's profile Send private message
Tsyal
How do I cheat?
Reputation: 0

Joined: 10 Nov 2019
Posts: 8

PostPosted: Sun Nov 10, 2019 9:27 am    Post subject: Reply with quote

Hi,

I try to use luasocket in Cheat Engine 7.0 using the package from december 2013 but it does not work.

I got "Error:error loading module 'socket.core' from"

Is this package not compatible with V7 or am I doing somthing bad?
Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Mon Nov 11, 2019 5:35 pm    Post subject: Reply with quote

Tsyal wrote:
Hi,

I try to use luasocket in Cheat Engine 7.0 using the package from december 2013 but it does not work.

I got "Error:error loading module 'socket.core' from"

Is this package not compatible with V7 or am I doing somthing bad?

use getInternet() function

_________________
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
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  Next
Page 2 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