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 


[RESOLVED]Automatic .CETRAINER New Version Download!
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
TheyCallMeTim13
Wiki Contributor
Reputation: 14

Joined: 24 Feb 2017
Posts: 433
Location: 'Merica

PostPosted: Tue Apr 10, 2018 5:21 pm    Post subject: Reply with quote

Put a plain text file where you want to download from, then get the text and print it to see if you get what you think you should.

Code:

local url = ''
local int = getInternet()
local text = int.getURL(url)
int.destroy()
print(text)

_________________
A: What manner of man are you that can summon up fire without flint or tinder?
T: I... am an enchanter.
Back to top
View user's profile Send private message
Aylin
Expert Cheater
Reputation: 2

Joined: 16 Feb 2017
Posts: 154

PostPosted: Tue Apr 10, 2018 6:24 pm    Post subject: Reply with quote

TheyCallMeTim13 wrote:
May be this is what your looking for, this is made by Zanzer and will auto-update the table from a server file (but I've never used it my self just remembered the thread).

Automatically Update to Latest Cheat Table


Thanks.. Thanks.. Thanks..

I think I'm reaching a conclusion.
I will share a detailed Trainer tomorrow.
I worked on your idea (Zanzer-AutoUpdate (Thanks @Zanzer)).
I just have a curiosity, I have to solve them:
When the new version is downloaded (Changed)
Trainer subsequent use
Will it continue in the new version?
or the new version will now remain the registered version!
I have to test it tomorrow.
Also, can I install .CETRAINER instead of .CT ..? Rolling Eyes
(Zanzer said there is no guarantee for .exe.
Is there a chance for the trainer!)
I have to test all these questions. crazy questions in my mind. Rolling Eyes Rolling Eyes

I must also try your last code.
and also,
If @Corroder looking for solutions, I have to wait for the result.
Thanks again. and for giving you hope again. Smile

_________________
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: 613

PostPosted: Tue Apr 10, 2018 6:56 pm    Post subject: Reply with quote

Made some test :

1. Testing #1 Original script :

Code:
function myWholeCode()
 f = createForm()
 f.setSize(200,200)
 b = createButton(f)
 b.setSize(100,100)
 b.left = (f.width - b.width) / 2
 b.top = (f.height - b.height) / 2
 b.Caption = 'My Button'

 function showMsg()
  showMessage('Hello there...!!')
  return
 end

 b.onClick = showMsg
 f.show()
end

myWholeCode()


Script has stored at paste.bin with name : mcode.lua and URL is : https://pastebin.com/raw/1jDXDFcn (Raw data)
Then test to call that script with :

Code:
local url = 'https://pastebin.com/raw/1jDXDFcn'
local int = getInternet()
local text = int.getURL(url)
int.destroy()
load(text)()


Result : Work properly without error (see. Picture 1 attached)


2. 1. Testing #2 @Aylin Original script with little modification as below :

Code:
function mcode()
 local my_function = decodeFunction('c-p.[-A:,.... bla..bla..bla
 my_function()
end


Script has stored at paste.bin with name : specimen1.lua (not txt format) URL is : https://pastebin.com/raw/rRCfBbjT (Raw data)
Then test to call that script with :

Code:
local url = 'https://pastebin.com/raw/rRCfBbjT'
local int = getInternet()
local text = int.getURL(url)
int.destroy()
load(text)()
mcode()



result : "Error:?:-1: attempt to index a nil value (field 'UDF1')"
It show script loaded properly but gave error because I am not make form UDF1 or other properties, etc which CE can not recognized it all then.

Conclusions :
1. No matter with web host service (you can use pastebin, tinypaste, etc)
2. Save / store script at web host with file format : *.lua or *.CT or *.CETRAINER
3. If your script has encoded script, then put it under a FUNCTION (see script above as an example)
4. If you must save/stored your encoded script as 'format:txt", then need manipulating it when call that script from web host by : (NOT TESTED)
- call using script above
- next create stream file and add contents from text loaded from URL
- save to local disk as temporary file or save as lua file
- call that lua file from path or stream file and execute

Try your self



Picture 1.JPG
 Description:
Test Result : load script form URL
 Filesize:  32.19 KB
 Viewed:  2127 Time(s)

Picture 1.JPG



_________________
Singapore Sling + Johnnie Walker + Some Peanuts....
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 14

Joined: 24 Feb 2017
Posts: 433
Location: 'Merica

PostPosted: Wed Apr 11, 2018 12:55 am    Post subject: Reply with quote

Aylin wrote:
...

I think the main problem you might run into with EXEs, is AVs and them deleting the trainers EXE; you might have to prompt the user about tuning if off.


But I feel the need to add that; because of the part of me that thinks tin foil hats are stylish, I would probably not use a trainer that auto updated it self. Table sure, but not an EXE form some lone person I really don't know.

_________________
A: What manner of man are you that can summon up fire without flint or tinder?
T: I... am an enchanter.
Back to top
View user's profile Send private message
Aylin
Expert Cheater
Reputation: 2

Joined: 16 Feb 2017
Posts: 154

PostPosted: Wed Apr 11, 2018 6:08 am    Post subject: Reply with quote

TheyCallMeTim13 wrote:

But I feel the need to add that; because of the part of me that thinks tin foil hats are stylish, I would probably not use a trainer that auto updated it self. Table sure, but not an EXE form some lone person I really don't know.



I do not use .exe trainer.
I'm always on the CETRAINER side.
But @Zanzer code only supports .CT format.
.cetrainer the 'Temp' is saving the folder,
but there is no change or the new version is not opened.
Maybe use DropBox, it affects file.
But DropBox .CT also does not make any mistakes.

I tried the code you gave, it worked nice.
Print; He wrote the whole Script correctly. Smile

Code:
local url = ''
local int = getInternet()
local text = int.getURL(url)
int.destroy()
print(text)


I think @Corroder and error in global code:

Code:
local url = 'https://pastebin.com/raw/1jDXDFcn'
local int = getInternet()
local text = int.getURL(url)
int.destroy()
load(text)()


It must be a mistake. The 'LOAD' function is constantly failing.

@Corroder;
I tried the last encoding you gave
(I can not reach 'Pastebin', you know! I tried DropBox)
but every time it targeted the 'load' function and gave an error.
I tried .CT, .CETRAINER and .LUA. Conclusion: The 'load' error again
@TheyCallMeTim13, perhaps to reach a conclusion.
Print (text) function correctly wrote the code.
maybe the second step is to write it into 'Script'. Wink

The weird thing is: @Zanzer code: Game.cetrainer the 'Temp' is saving the file.
but why it does not run and does not replace with the old version! Rolling Eyes


Code:
--{$lua}
if syntaxcheck then return end
--[ENABLE]
UDF1.CEButton1Click(sender)
local TABLE_VERSION = 1
local version_url = "https://docs.google.com/document/d/1h9fxfqztRnyamuXn75hElBEgf2OWJcogOPZBH3P9GN8/export?format=txt"
local table_url = "http://forum.cheatengine.org/download.php?id=119714"
local http = getInternet()
local result = http.getURL(version_url)
if result then
  local version = tonumber(result:match("%d+"))
  if version > TABLE_VERSION then
    local answer = messageDialog("There is a newer version of this table.\nWould you like to download it now?", mtWarning, mbYes, mbNo)
    if answer == mrYes then
      messageDialog("Be sure to save the new table!", mtInformation, mbOK)
      local latest = http.getURL(table_url)
      if latest ~= nil then
        local name = os.getenv("TEMP")
        name = name .. "\\Zanzer.CT"
        local file = io.open(name, "w")
        file:write(latest)
        file:close()
        loadTable(name)
      else
        messageDialog("Failed to load the new table!", mtError, mbOK)
      end
    end
  else
    messageDialog("You currently have the latest version!", mtInformation, mbOK)
  end
else
  messageDialog("Failed to find latest version!", mtError, mbOK)
end
http.destroy()
--{$asm}
assert(true)
end
--[DISABLE]


This code can be a separate solution.
Incorrect aspects: Sad
1) You can register dozens of Trainer files into the 'Temp' folder.
(You can translate the 'Temp' folder into Trainer garbage!)
2). Not enough power for .CETRAINER file.
(Maybe one more code should be added)

Good sides: Smile
1) With a single click; He is questioning, warning, loading and changing.
(I could not check whether the record is continuing with the new version.)

Maybe @Zanzer or a master, the code update may be correct. Rolling Eyes

and I still have a lot of crazy questions in my mind.
Thanks for the help.
And please, do not forget to have fun, take the time to life. 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
TheyCallMeTim13
Wiki Contributor
Reputation: 14

Joined: 24 Feb 2017
Posts: 433
Location: 'Merica

PostPosted: Wed Apr 11, 2018 7:01 am    Post subject: Reply with quote

Why not download the new .CETRAINER to the current working folder, so if the user is at "...\Trainers\game name" you download here and just add the version number to the name so like "game.v1-0-1.CETRAINER" then just use "os.execute" to launch the new trainer then close the old one when you detect the new one running.

P.S.: you got me interested in this idea (at lest for CT), this is what I wrote up last night, I will keep working on it and probable make a module at some point.

Code:



-- TABLE_VERSION_URL = 'https://docs.google.com/document/d/1pPgHNGV1-EmIpfxxXp0vnoeoZxlCg11ofdV1x78bJEw/export?format=txt'
-- TABLE_URL = 'http://fearlessrevolution.com/index.php?attachments/mgsvtpp-v3-0-9-ct.9549/'

-- dofile([[E:\Documents\My Cheat Tables\~Lua\I2CETUpdater.lua]])
-- CETUpdater.TableVersion = '3.0.8'
-- CETUpdater.TableName = 'mgsvtpp'
-- CETUpdater.TableUrl = 'http://fearlessrevolution.com/index.php?attachments/mgsvtpp-v3-0-9-ct.9549/'
-- CETUpdater.VersionUrl = 'https://docs.google.com/document/d/1pPgHNGV1-EmIpfxxXp0vnoeoZxlCg11ofdV1x78bJEw/export?format=txt'
-- CETUpdater.checkTableVersion()


local NAME = 'I2 Cheat Engine Table Updater'
local CLASS_NAME = 'I2CETUpdater'
local VERSION = '1.0.1'
local AUTHOR = 'Matt Irwin; [email protected]'
local LICENSE = [=[MIT License

Copyright (c) 2018 Matt Irwin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sub-license, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
]=]


local format = string.format
local strE = string.empty or STRING_EMPTY or ''
local t = translate


-- local Logger = {
--    LEVELS = {
--       OFF = 0,
--       FATAL = 1,
--       ERROR = 2,
--       WARN = 3,
--       INFO = 4,
--       DEBUG = 5,
--       TRACE = 6
--    },
-- }
-- for k, v in pairs(Logger.LEVELS) do
--    -- Logger[k:lower()] = function( ... ) return end
--    -- Logger[k:lower() .. 'f'] = function( ... ) return end
--    Logger[k:lower()] = function(msg, ex) return print(msg, ex) end
--    Logger[k:lower() .. 'f'] = function(msg, ... ) return print(string.format(msg, ... )) end
-- end
local Logger = Logger
if Logger == nil then
   if type(CETrequire) == 'function' then
      Logger = CETrequire('I2CETLogger')
   else
      Logger = require('I2CETLogger')
   end
   Logger.LogName = 'CETtele'
end


CETUpdater = {
   Name = NAME,
   ClassName = CLASS_NAME,
   Version = VERSION,
   Author = AUTHOR,
   License = LICENSE,
   TableVersion = TABLE_VERSION,
   TableName = TABLE_TITLE,
   TableUrl = TABLE_URL,
   VersionUrl = VERSION_URL,
}

function CETUpdater.getVersionNumber(versionString)
   versionString = table.concat({ string.match(versionString, '(%d+)%.(%d+)%.(%d+)') }, strE)
   return tonumber(versionString)
end

function CETUpdater.isTableToDownLoad(versionUrl, tableVersion)
   versionUrl = versionUrl or CETUpdater.VersionUrl
   local tableVersionStr = tableVersion or CETUpdater.TableVersion
   tableVersion = CETUpdater.getVersionNumber(tableVersionStr)
   ---- ADD: nil check
   local iNet = getInternet()
   local text = iNet.getURL(versionUrl)
   iNet.destroy()
   if text then
      local version = CETUpdater.getVersionNumber(text)
      return (version > tableVersion), tableVersionStr
   else
      Logger.errorf('Unable to download version file; at: "%s"', versionUrl)
      return nil
   end
end

function CETUpdater.getNewTable(versionStr, tableUrl, tableName)
   versionStr = versionStr or '1.0.1'
   tableUrl = tableUrl or CETUpdater.TableUrl
   tableName = tableName or CETUpdater.TableName or CETUpdater.ClassName
   ---- ADD: nil check
   local iNet = getInternet()
   local newTableStr = iNet.getURL(tableUrl)
   if newTableStr ~= nil then
      local newTablePath = tableName .. format('.[v%s].CT', versionStr)
      local f, err = io.open(newTablePath, 'w')
      if f and not err then
         f:write(newTableStr)
         f:close()
         Logger.infof('New table downloaded; from: "%s", to: "%s"', tableUrl, newTablePath)
         loadTable(newTablePath)
      else
         Logger.errorf('Unable to create temp file for new table; at: "%s"', newTablePath)
      end
   else
      Logger.errorf('Unable to download latest table file; at: "%s"', tableUrl)
   end
   iNet.destroy()
end


function CETUpdater.checkTableVersion()
   local downloadTable, versionStr = CETUpdater.isTableToDownLoad()
   if downloadTable then
      local answer = messageDialog(t('There is a newer version of this table.') .. '\n'
               .. t('Would you like to download it now?'), mtWarning, mbYes, mbNo)
      if answer == mrYes then
         CETUpdater.getNewTable(versionStr)
         messageDialog(t('Be sure to save the new table!'), mtInformation, mbOK)
      end
   else
      messageDialog('You currently have the latest version!', mtInformation, mbOK)
   end
end

return CETUpdater



And here is the logger.
Code:



local NAME = 'I2 Cheat Engine Table CEA'
local CLASS_NAME = 'I2CETLogger'
local VERSION = '1.0.1'
local AUTHOR = 'Matt Irwin; [email protected]'
local LICENSE = [=[MIT License

Copyright (c) 2017 Matt Irwin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sub-license, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
]=]

local format = string.format
local strE = string.empty or STRING_EMPTY or ''
local t = translate



I2CETLogger = {
   Name = NAME,
   ClassName = CLASS_NAME,
   Version = VERSION,
   Author = AUTHOR,
   License = LICENSE,
   LogName = 'CETLog',
   LEVELS = {
      OFF = 0,
      FATAL = 1,
      ERROR = 2,
      WARN = 3,
      INFO = 4,
      DEBUG = 5,
      TRACE = 6
   },
}
I2CETLogger.Level = I2CETLogger.LEVELS.WARN
I2CETLogger.Settings = {
   PrintLevel = false,
   PrintLevelName = true,
   PrintLogName = true,
   PrintClassName = true,
   Padding = 0,
   PrintTraceback = false,
   PrintTracebackOnError = false,
}

I2CETLogger.format = format
I2CETLogger.tostring = tostring
I2CETLogger.write = print
I2CETLogger.writef = function(msg, ... ) return I2CETLogger.write(I2CETLogger.format(msg, ...)) end


local function split(s, delimiter)
   result = {}
   for match in (s .. delimiter):gmatch('(.-)' .. delimiter) do
      table.insert(result, match)
   end
   return result
end

function I2CETLogger.logEvent(level, msg, ex)
   if msg == nil then
      msg = strE
   end
   if I2CETLogger.Level >= level then
      if type(msg) ~= 'string' then
         msg = I2CETLogger.tostring(msg)
      end
      local s = strE
      if I2CETLogger.Settings.PrintLevelName then
         for k, v in pairs(I2CETLogger.LEVELS) do
            local tl = split(debug.traceback(), '\n')
            local tn = split(tl[4], ': in function ')[2]
                  or split(tl[4], ': in field ')[2]
                  or split(tl[4], ': in upvalue ')[2]
                  or split(tl[4], ': in ')[2] or '???'
            tn = tn:gsub('\'', strE):gsub('<.', strE):gsub('>', strE)
            if v == level then
               s = k:upper() .. ':'
               s = s .. string.rep(' ', 7 - #s)
               s = s .. tn .. ':\r\n'
               break
            end
         end
      end
      if I2CETLogger.Settings.PrintLevel then
         s = format('%d:%s', level, s)
      end
      if I2CETLogger.Settings.PrintLogName and type(I2CETLogger.LogName) == 'string' then
         s = format('%s - %s', I2CETLogger.LogName, s)
      end
      if I2CETLogger.Settings.PrintClassName and type(I2CETLogger.ClassName) == 'string' then
         s = format('%s::%s', I2CETLogger.ClassName, s)
      end
      if type(I2CETLogger.Settings.Padding) == 'number' and I2CETLogger.Settings.Padding > 0 then
         s = s .. string.rep(' ', I2CETLogger.Settings.Padding - #s)
      end
      if I2CETLogger.Settings.PrintTraceback or level == I2CETLogger.LEVELS.TRACE or level == I2CETLogger.LEVELS.FATAL
      or (I2CETLogger.Settings.PrintTracebackOnError and level == I2CETLogger.LEVELS.ERROR) then
         if msg ~= strE then
            msg = msg .. '\r\n'
         end
         msg = msg .. debug.traceback():gsub('\n', '\r\n')
      end
      I2CETLogger.write(s .. msg .. '\r\n')
      if ex then I2CETLogger.write('Exception:\r\n' .. I2CETLogger.tostring(ex)) end
   end
end

for k, v in pairs(I2CETLogger.LEVELS) do
   if v > 0 then
      I2CETLogger[k:lower()] = function(msg, ex) return I2CETLogger.logEvent(v, msg, ex) end
      I2CETLogger[k:lower() .. 'f'] = function(msg, ... ) return I2CETLogger.logEvent(v, I2CETLogger.format(msg, ... )) end
   end
end


local function logDebug(parameters, syntaxcheck)
   ---- logDebug(some DEBUG text to log)
   if not syntaxcheck then
      I2CETLogger.debug(parameters)
   end
   return strE
end
local function logInfo(parameters, syntaxcheck)
   ---- logInfo(some INFO text to log)
   if not syntaxcheck then
      I2CETLogger.info(parameters)
   end
   return strE
end
local function logWarn(parameters, syntaxcheck)
   ---- logWarn(some WARN text to log)
   if not syntaxcheck then
      I2CETLogger.warn(parameters)
   end
   return strE
end
local function logError(parameters, syntaxcheck)
   ---- logError(some ERROR text to log)
   if not syntaxcheck then
      I2CETLogger.error(parameters)
   end
   return strE
end
local function logFatal(parameters, syntaxcheck)
   ---- logFatal(some FATAL text to log)
   if not syntaxcheck then
      I2CETLogger.fatal(parameters)
   end
   return strE
end
registerAutoAssemblerCommand('logDebug', logDebug)
registerAutoAssemblerCommand('logInfo', logInfo)
registerAutoAssemblerCommand('logWarn', logWarn)
registerAutoAssemblerCommand('logError', logError)
registerAutoAssemblerCommand('logFatal', logFatal)



if DEBUG then I2CETLogger.Level = I2CETLogger.LEVELS.DEBUG end
I2CETLogger.debugf('%s [v:%s]; Loaded.', CLASS_NAME, VERSION)

return I2CETLogger

_________________
A: What manner of man are you that can summon up fire without flint or tinder?
T: I... am an enchanter.
Back to top
View user's profile Send private message
Aylin
Expert Cheater
Reputation: 2

Joined: 16 Feb 2017
Posts: 154

PostPosted: Wed Apr 11, 2018 3:14 pm    Post subject: Reply with quote

TheyCallMeTim13 wrote:
Why not download the new .CETRAINER to the current working folder, so if the user is at "...\Trainers\game name" you download here and just add the version number to the name so like "game.v1-0-1.CETRAINER" then just use "os.execute" to launch the new trainer then close the old one when you detect the new one running.

P.S.: you got me interested in this idea (at lest for CT), this is what I wrote up last night, I will keep working on it and probable make a module at some point.


Fine work and archives will be added to the level +1 points.
My mistake in the picture, he says I have a few missing.
I left the Logger as a .lua in the Autorun folder.
but I started getting error.
(It can be sourced from me, like the characters change) Rolling Eyes

Perhaps a .lua example (for Autorun)
and maybe a passive CT example of updating.
or how to edit it.
even so; You made software from scratch, thank you.
I hope that many CE lovers will benefit from this. Idea



Logger.lua Error.JPG
 Description:
 Filesize:  118.12 KB
 Viewed:  2066 Time(s)

Logger.lua Error.JPG



Ekran Al&#305;nt&#305;s&#305;.JPG
 Description:
 Filesize:  142.92 KB
 Viewed:  2066 Time(s)

Ekran Al&#305;nt&#305;s&#305;.JPG



_________________
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
TheyCallMeTim13
Wiki Contributor
Reputation: 14

Joined: 24 Feb 2017
Posts: 433
Location: 'Merica

PostPosted: Wed Apr 11, 2018 4:47 pm    Post subject: Reply with quote

CE table Lua scripts can't have a "return". I think that's what that error is.

But for me the error was "getURL" or some thing seems to change all "\n" to "\r\n", and this was messing with CE. SO I had to fix that first.

Using table files: https://drive.google.com/file/d/1CMT6lW-ivGhN4VTLnDb5i7PLr0Cm1Arh/view?usp=sharing

Using local files (".7z"): https://drive.google.com/file/d/1s_A0dqhPThDbSe5ae0j7661EEkPaKeh5/view?usp=sharing

Using local files (".zip"): https://drive.google.com/file/d/1CwyFd8b6O-RVE5JM6eLfFwZ42pE5iFPf/view?usp=sharing


But at this point I think the URL for the new table should be pulled from a file like the version (may be line 1 is version and line 2 is URL) else the new URL will need to be in the old table.

Also the Lua engine may need to be reset and the table Lua script may still need to be ran; I haven't tested that yet.

EDIT: And the version number needs to be done differently (padding the numbers first should work). I just slapped that part together to get it going.

_________________
A: What manner of man are you that can summon up fire without flint or tinder?
T: I... am an enchanter.
Back to top
View user's profile Send private message
Aylin
Expert Cheater
Reputation: 2

Joined: 16 Feb 2017
Posts: 154

PostPosted: Wed Apr 11, 2018 7:08 pm    Post subject: Reply with quote

[quote="TheyCallMeTim13"]CE table Lua scripts can't have a "return". I think that's what that error is.

I will share every development:
'Updater' file throws qualifications.
File query and download succeeded,
but the file; . It is formatted as [v1.0.1] and does not open.
The files should be opened in the format in which they were installed; Like .CT or .CETRAINER.
Also, should I distribute these 2 lua files to all members?
Can every PC get equal results?

Below is the error message and the picture of successful download formats.
It downloads all visible formats or writes the code itself.
Because I'm inexperienced, the subject is drifting. Rolling Eyes



Game1.1.1.jpeg
 Description:
 Filesize:  546.46 KB
 Viewed:  2038 Time(s)

Game1.1.1.jpeg



LINE 1 POS 1.JPG
 Description:
 Filesize:  100.7 KB
 Viewed:  2038 Time(s)

LINE 1 POS 1.JPG



_________________
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
TheyCallMeTim13
Wiki Contributor
Reputation: 14

Joined: 24 Feb 2017
Posts: 433
Location: 'Merica

PostPosted: Wed Apr 11, 2018 7:23 pm    Post subject: Reply with quote

Made some fixes, Try one of these:

Just set "I2CETUpdater.FileExtension" as well.
Code:
I2CETUpdater.FileExtension = 'CETRAINER' -- or 'byTheyCallMeTim13.cetrainer' it just puts it and a period at the end of the file name.


Local:
https://drive.google.com/file/d/1W2_xkYfHoAIeHWuHsXdfi4w5kOtQEw59/view?usp=sharing

Table files:
https://drive.google.com/file/d/1xE03Li3t0x3dIhPqvp8gFWBStbDbRxxt/view?usp=sharing

To distribute you'll have to embed the modules in the table/trainer's Lua script; or you'll have to distribute the modules, either as table files for local files.

EDIT: And you're welcome to fork the modules; and trim them down and make them your own, just change the "ClassName" and the module name please so there are no name conflicts (you or I can remove the Licence I just add it out of habit but any code I post is yours the moment you read it).

EDIT:
The version file now needs to look like this, with version new line ('\r\n' or '\n') then table url.
Code:
3.0.9
http://fearlessrevolution.com/index.php?attachments/mgsvtpp-v3-0-9-ct.9549/


EDIT:
Updated the module, to take a format setting for the file name:
Code:
I2CETUpdater.FileNameFormat = '${FileName}.[v${Version}].${FileExtension}'

Code:
I2CETUpdater.FileNameFormat = '${Process}.${Version}.${FileExtension}'

Code:
I2CETUpdater.FileNameFormat = '${Temp}${FileName}.[v${Version}].${FileExtension}'

Code:
I2CETUpdater.FileNameFormat = '${TrainerOrigin}'



I2CETUpdater.lua
 Description:
V 1.0.4

Download
 Filename:  I2CETUpdater.lua
 Filesize:  6.39 KB
 Downloaded:  70 Time(s)


_________________
A: What manner of man are you that can summon up fire without flint or tinder?
T: I... am an enchanter.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater
Reputation: 17

Joined: 10 Apr 2015
Posts: 613

PostPosted: Wed Apr 11, 2018 8:44 pm    Post subject: This post has 1 review(s) Reply with quote

@Aylin :
Quote:
I tried .CT, .CETRAINER and .LUA. Conclusion: The 'load' error again


1. To execute CT or CETRAINER use : loadTable([file.CT or file CETRAINER])
2. To execute lua file just simple use : doFile("filename.lua")

But it also depending to what you wrote in your scripts.

The case is : If there are new version exist then
1. load new version from URL and save to local storage
or
2. load new version from URL and execute

1 and 2 give you extra scripting.

_________________
Singapore Sling + Johnnie Walker + Some Peanuts....
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 14

Joined: 24 Feb 2017
Posts: 433
Location: 'Merica

PostPosted: Wed Apr 11, 2018 9:56 pm    Post subject: Reply with quote

Added some stuff.

* Changed setting "VersionUrl" to "VersionFileUrl"
Code:

   Version: 1.1.1
      1.0.1:
         * Initial setup.
      1.0.5:
         * Added auto save ("AutoSave") setting and functionality (default: true).
            - Auto saves loaded table/trainer after download,
               using the name generated with "FileNameFormat".
         * Added force update ("ForceUpdate") setting and functionality (default: false).
            - Forces table/trainer update by closing CE if user selects no.
      1.1.1:
         * Changed some file name format keys.
         * Changed setting "VersionUrl" to "VersionFileUrl".

   Author: Matt - TheyCallMeTim13 - MattI2.com


   Features:
      - Auto updates table (".CT") or trainer (".CETRAINER") files from a URL.
      -

   Settings:
      TableVersion:
      TableName:
      TableUrl:
      VersionFileUrl:
      FileExtension:
      DefaultVersion:
      FileNameFormat:
      ForceUpdate (default: false): Forces table/trainer update by closing CE if user selects no.
      AutoSave (default: true): Auto saves loaded table/trainer after download,
                           using the name generated with "FileNameFormat".
      NewLine:

   Messages:
      NewVersionMessage:
      DownloadQuestion:
      SavedMessage:
      UserSaveMessage:
      ForceSaveMessage:
      ClosingMessage:
      HasLatestMessage:

   Keys:
      TrainerOrigin
      Process
      UserDir
      HomeDir
      AppData
      Temp
      CheatEngineDir
      HomeDir
      CheatTablesDir
      UserName
      FileName
      TableName
      Version
      VersionNumer
      FileExtension
      TableTitle
      GameTitle


   Examples:
      Version File:
         3.0.9
         http://fearlessrevolution.com/index.php?attachments/mgsvtpp-v3-0-9-ct.9549/

      Code:
         require('I2CETUpdater')
         CETUpdater.checkTableVersion(versionFileUrl, tableVersion, tableName)

      Code:
         require('I2CETUpdater')
         CETUpdater.TableVersion = '3.0.8'
         CETUpdater.TableName = 'mgsvtpp'
         CETUpdater.VersionFileUrl = 'https://docs.google.com/document/d/1pPgHNGV1-EmIpfxxXp0vnoeoZxlCg11ofdV1x78bJEw/export?format=txt'
         CETUpdater.FileNameFormat = '${TableName}.[v${Version}].${FileExtension}'
         CETUpdater.checkTableVersion()

      Code:
         local url = 'https://docs.google.com/document/d/1pPgHNGV1-EmIpfxxXp0vnoeoZxlCg11ofdV1x78bJEw/export?format=txt'
         require('I2CETUpdater')
         CETUpdater.checkTableVersion(url, '3.0.8', 'mgsvtpp')


local files:
https://drive.google.com/file/d/14TcAdRAVl4FfrxApheAMVtZ3Be-zQbtc/view?usp=sharing

tabel files:
https://drive.google.com/file/d/1Y4lRqw46mdQ1CTB5SF-jZt8BjR9KPS2A/view?usp=sharing


EDIT
Code:
--[====================================================================================================================[

   I2 Cheat Engine Table Updater

   Version: 1.1.2
      1.0.1:
         * Initial setup.
      1.0.5:
         * Added auto save ("AutoSave") setting and functionality (default: true).
            - Auto saves loaded table/trainer after download,
               using the name generated with "FileNameFormat".
         * Added force update ("ForceUpdate") setting and functionality (default: false).
            - Forces table/trainer update by closing CE if user selects no.
      1.1.1:
         * Changed some file name format keys.
         * Changed setting "VersionUrl" to "VersionFileUrl".
      1.1.2:
         * Fixed "ForceSaveMessage" setting name, changed to "ForcedMessage".

   Author: Matt - TheyCallMeTim13 - MattI2.com


   Features:
      - Auto updates table (".CT") or trainer (".CETRAINER") files from a URL.
      -

   Settings:
      TableVersion:
      TableName:
      TableUrl:
      VersionFileUrl:
      FileExtension:
      DefaultVersion:
      FileNameFormat:
      ForceUpdate (default: false): Forces table/trainer update by closing CE if user selects no.
      AutoSave (default: true): Auto saves loaded table/trainer after download,
                           using the name generated with "FileNameFormat".
      NewLine:

   Messages:
      NewVersionMessage:
      DownloadQuestion:
      SavedMessage:
      UserSaveMessage:
      ForcedMessage:
      ClosingMessage:
      HasLatestMessage:

   Keys:
      TrainerOrigin
      Process
      UserDir
      HomeDir
      AppData
      Temp
      CheatEngineDir
      HomeDir
      CheatTablesDir
      UserName
      FileName
      TableName
      Version
      VersionNumer
      FileExtension
      TableTitle
      GameTitle


   Examples:
      Version File:
         3.0.9
         http://fearlessrevolution.com/index.php?attachments/mgsvtpp-v3-0-9-ct.9549/

      Code:
         require('I2CETUpdater')
         CETUpdater.checkTableVersion(versionFileUrl, tableVersion, tableName)

      Code:
         require('I2CETUpdater')
         CETUpdater.TableVersion = '3.0.8'
         CETUpdater.TableName = 'mgsvtpp'
         CETUpdater.VersionFileUrl = 'https://docs.google.com/document/d/1pPgHNGV1-EmIpfxxXp0vnoeoZxlCg11ofdV1x78bJEw/export?format=txt'
         CETUpdater.FileNameFormat = '${TableName}.[v${Version}].${FileExtension}'
         CETUpdater.checkTableVersion()

      Code:
         local url = 'https://docs.google.com/document/d/1pPgHNGV1-EmIpfxxXp0vnoeoZxlCg11ofdV1x78bJEw/export?format=txt'
         require('I2CETUpdater')
         CETUpdater.FileNameFormat = '${Process}.${FileExtension}'
         CETUpdater.checkTableVersion(url, '3.0.8', 'mgsvtpp')

      Code:
         local url = 'https://docs.google.com/document/d/1pPgHNGV1-EmIpfxxXp0vnoeoZxlCg11ofdV1x78bJEw/export?format=txt'
         require('I2CETUpdater')
         CETUpdater.ForceUpdate = true
         CETUpdater.AutoSave = true
         CETUpdater.NewLine = '\n'
         CETUpdater.FileNameFormat = '${TrainerOrigin}'
         CETUpdater.NewVersionMessage = 'There is a newer version of this table/trainer.'
         CETUpdater.DownloadQuestion = 'Would you like to download it now?'
         CETUpdater.SavedMessage = 'New table/trainer saved.'
         CETUpdater.ForcedMessage = 'Sorry but the table/trainer creator thinks it\'s best to use the latest version!'
         CETUpdater.ClosingMessage = 'Now Closing Cheat Engine'
         CETUpdater.HasLatestMessage = 'You currently have the latest version!'
         CETUpdater.checkTableVersion(url, '3.0.8', 'mgsvtpp')

      Code:
         local url = 'https://docs.google.com/document/d/1pPgHNGV1-EmIpfxxXp0vnoeoZxlCg11ofdV1x78bJEw/export?format=txt'
         require('I2CETUpdater')
         CETUpdater.ForceUpdate = false
         CETUpdater.AutoSave = true
         CETUpdater.FileNameFormat = '${Process}.${FileExtension}'
         CETUpdater.UserSaveMessage = 'Be sure to save the new table/trainer!'
         CETUpdater.checkTableVersion(url, '3.0.8', 'mgsvtpp')


]====================================================================================================================]--



I2CETUpdater.lua
 Description:
Version: 1.1.2

Download
 Filename:  I2CETUpdater.lua
 Filesize:  13.48 KB
 Downloaded:  69 Time(s)


I2CETUpdater.lua
 Description:
Version: 1.1.1

Download
 Filename:  I2CETUpdater.lua
 Filesize:  12.03 KB
 Downloaded:  84 Time(s)


_________________
A: What manner of man are you that can summon up fire without flint or tinder?
T: I... am an enchanter.
Back to top
View user's profile Send private message
Aylin
Expert Cheater
Reputation: 2

Joined: 16 Feb 2017
Posts: 154

PostPosted: Thu Apr 12, 2018 5:48 am    Post subject: Reply with quote

TheyCallMeTim13 wrote:
Added some stuff.



Instead of the file being linked,
another file is being downloaded (or writing) and the file is not opening.
Below by file names and version numbers,
writes to the downloaded file.
Updater.lua and Logger.lua are set only in your file.
Any new file does not accept the connection.
if only one Updater.lua is written and
Must be stored in the trainer.
3 Will the .lua file be distributed to all users?
Sample: Wink
Without making any changes to Lua;
Try downloading and installing another version on CT or Trainer.
Changes in CT or Trainer are not accepted,
again the parameters in the updater.lua are checking the file. Rolling Eyes

We moved the update encoding to different details. Rolling Eyes

Again, I will try again. Thank you.

@Corroder ;

I wish you could tell me the details when you wrote the code.
When asking for a signature from the masters; I repeat that I am novice.
Some solutions are hidden in the details.
and I do not have experience of seeing them.
Thanks, I'll try.



Save_File.JPG
 Description:
 Filesize:  384.4 KB
 Viewed:  1977 Time(s)

Save_File.JPG



_________________
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
TheyCallMeTim13
Wiki Contributor
Reputation: 14

Joined: 24 Feb 2017
Posts: 433
Location: 'Merica

PostPosted: Thu Apr 12, 2018 6:11 am    Post subject: Reply with quote

Make sure your getting text back and not an error/404 message.

Code:

local url = ''
local int = getInternet()
local text = int.getURL(url)
int.destroy()
print(text)



It's not saving with the new version number, Not sure why yet; but I'll figure it out.

EDIT: figured it out.


EDIT:
With your url I get this.
https://www.dropbox.com/s/urnepw05qu0lr20/Game1.1.1.cetrainer?dl=1
Code:

l+|z   fYQGюMٍ%D>nrZ   BTνozћAܭ,RIaoOR'*Ȫҏp}]KΔGՌXjti$vBWbf;fmq .Zy}8rj,Pt3"u[M?]L~_{*hmimzO: r_"D=#]k[Ǣo>,5dߺ7u<e#J
ѝk49S'gi0thJPd7қ퐩e$qt|U\InQjGu[W?Zx*rQ[oQRffhX OS
]:C#T`:@Gm:߰s2h\6V-83]5gU5!fʹ -2KbrP~5{4   ZH
   {7*4r!° zY5TEBf5YwL =y;}1_ rCiO2S[``[7HNӷoOERt!   _?$Pd:*CRHn):>WÀ'^69
FS'_hj =,.
uRcD{)nGn6Ec<ߕDӣZ
f-4ȹv%tY \)ZBogMx8?[vE*D):]Ä/<(,'*M0ZO^S8>r6   …'P"Tq[email protected]
4/nnx{`[email protected]n3ekl.p&*ka1JDSQfSq%7al"IAM^gWR1eI69#VJ ňrw(?&D9ې    wyr<c?="Cר.y?*
~( (&cWg2k7p   e{67N!Ć~n%7#vuld\e TQ5P߮ gomk;7|+ D
G<


And with just the downloaded file I get this error.
Code:
loadTable([[C:\Users\Matt\Downloads\Game1.1.1.cetrainer]])

Quote:
Error:data error
Script Error


So this is not a valid file it looks like, and I think "loadTable" needs a raw XML CT/CETRAINER file.



I2CETUpdater.lua
 Description:
Version: 1.1.3

Download
 Filename:  I2CETUpdater.lua
 Filesize:  13.57 KB
 Downloaded:  74 Time(s)


_________________
A: What manner of man are you that can summon up fire without flint or tinder?
T: I... am an enchanter.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater
Reputation: 17

Joined: 10 Apr 2015
Posts: 613

PostPosted: Thu Apr 12, 2018 9:46 am    Post subject: Reply with quote

Quote:
EDIT:
With your url I get this.
https://www.dropbox.com/s/urnepw05qu0lr20/Game1.1.1.cetrainer?dl=1

Error:data error
Script Error


of course, I think because script stored at dropbox is a 'FILE' instead a 'SCRIPT'.

@Aylin, try store your script below (which I've decompiled) wit format text (at google doc or other web host, in case paste bin is blocked on your country)

Your decompiled script :

Code:
<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="26">
<Forms><UDF1 Class="TCEForm" Encoding="Ascii85">#JhJ]Q[r[Ayps=TN,9$mO%S9PDT4G}rAqG_LX^SJ=.u5r0?Ay52q=XyBGQYXR22o$L:p0)UVinQbI-ZYbMO1lJ9)[email protected];5tUYVZnv6F9fU(-sFw9t4Rn6z27r[G,H4y=GXO^p-H.7Qf,1:GG0I}-[jD38.K}Ph7rvNvIF9?b:=.GIm/4ySY:A[D:=#_u._87k3kNm$HBaGa9f.GL3=fp=o[77oj^^ThLVEYh%faDre^h=2wuaXa%/Uf-CfCt0;g{)R=bof8f=fwJ)KX;{CMD,[email protected]!2ry{-QV58)-^uHuL.ofvUhcc_1/t4H1$8B!Tx[oX88v*+q;D2-7z5Wp_hZheSkf(5Iq188LMlm^k/#ub=!QSSIXWW?CQzSzlG]=b{d!/up9I_oJcKQ!{Oe7DN.BOzeu(B2t74=c}UCgnf:^N?r0j,lA:g?tVNiYp%gzorojTGsl+P4BdO^8,l!YMmMsiK.BbJQjUDCXFLeVcbyq4ZHopHhkH5JgJ2hNMRf(h6:bf]wQ+%GhZFWa%!_ICotCI}RDbhk$saTb#sU([email protected]$s:]FNsFHcNdQ/pK.^[email protected]$[i)(=9qm!r1ANB4Q$Yx,3*SNPjkZl*cis)P}2jEfG$3i?PEdcX[mQwWP$Z.T-$h!+WY700F$IMoCMNM}MxoghYx6OTm#yLpJ*oUBiuq34cGwz1=MYPIew7Qb_/^#m[S[,JAL+g:r_Jhr^V[u.,5JvvblLKCqDD7r[]v]MdLA68*9LkWCdRl)m!yDSWTF+w8=Vo*kcNg:x[vs{tk;=Jblvm867uP-5(B[7+;X_8((V]niXyju1IHnaE95nkbCF]mJ.lVwkHdk^jX{7LopL%CLX)dOmrIANgN-Y3:P!G}[email protected];XPbr4N{VsP4A{CCk8N;[VkUtz2%j=y{La9nj$9$O{RPg%MV1-tqs%J+o!NQ!$QJN(VE^]vOCh#qs%SR#dr+5q%7:F:?F;)N5%2;JYjwoVSfHvGEyQ*cy(qovKUW*S3Es6)vg!s-pf%,Q7S(x5yj75-8;.8#v;)
---- bla...bla...bla...
---- bla...bla...bla..
function CEButton3Click(sender)
UDF1.CEImage3.visible = true
UDF1.CEButton3.Enabled = false
UDF1.CEButton1.Enabled = true
UDF1.CEButton2.Enabled = true
UDF1.CEImage1.visible = false
UDF1.CEImage2.visible = false
end
form_show(UDF1)

--local size = math.random(10,100000000000)
--end
--print(encodeFunction(my_script_to_encode))
</LuaScript>
</CheatTable>


and then test to call it first with this script :

Code:
local url = 'https://pastebin.com/raw/JCdcNiwW '  --- this is my URL for your script. You need use your own URL
local int = getInternet()
local text = int.getURL(url)
path = TrainerOrigin or getMainForm()
local name = path .. "\\mycode.CT"
local file = io.open(name, "w")
file:write(text)
file:close()
loadTable(name)
int.destroy()


NOTE : you need store your SCRIPT on web host, not a FILE

_________________
Singapore Sling + Johnnie Walker + Some Peanuts....
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 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