 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1476
|
Posted: Thu Apr 12, 2018 1:09 pm Post subject: |
|
|
@Corroder Please ..
the result is the same as the others.
It writes files on the table (.CT or .CETRAINER)
Files do not open, no changes are made.
Please check this code:
An onClick is querying the version.
The router is sending messages.
.CT downloading the file to the selected folder.
and replacing it with the old version which is open.
Code: | if syntaxcheck then return end
function 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()
assert(true)
end |
This code should be edited, I do not know, maybe.
.CETRAINER file must be downloaded,
must close the old version, you must delete and should open in a new version.
An idea like that.
Please check again.
My brain has stopped!
_________________
|
|
Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Thu Apr 12, 2018 5:46 pm Post subject: |
|
|
@Aylin
Quote: | It writes files on the table (.CT or .CETRAINER) |
May I ask you, when you upload your script to a web host (i.e dropbox, ggogle doc, etc), WHAT is you uploaded ?. A CT or CETRAINER FILE ?. or a TEXT SCRIPT ?.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1476
|
|
Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Thu Apr 12, 2018 8:09 pm Post subject: |
|
|
It depending how you wrote your script and upload it to web host.
Try this code to run your script :
Code: | function getUpdate()
local newVersion = "https://hastebin.com/raw/codumaveva"
local http = getInternet()
local newTable = http.getURL(newVersion)
if newTable ~= nil then
local table_path = TrainerOrigin or getMainForm()
name = table_path..'\\game.CT'
local file = io.open(name, "w")
file:write(newTable)
file:close()
loadTable(name)
opening_form.visible = false
else
showMessage("Unable to updating new table")
http.destroy()
end
end
function checkUpdate()
if syntaxcheck then return end
local current_version = 2
local new_version_url = "https://docs.google.com/document/d/1h9fxfqztRnyamuXn75hElBEgf2OWJcogOPZBH3P9GN8/export?format=txt"
local http = getInternet()
local result = http.getURL(new_version_url)
local version = tonumber(result:match("%d+"))
if result ~= current_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
getUpdate()
showMessage("You currently have the latest version!")
return
else
return
end
end
http.destroy()
assert(true)
end
opening_form = createForm()
opening_form.setSize(100,100)
opening_form.position = 'poScreenCenter'
opening_form.visible = true
b = createButton(opening_form)
b.setSize(80,40)
b.left = (opening_form.width - b.width) / 2
b.top = (opening_form.height - b.height) / 2
b.caption = 'Check Table'
b.onClick = checkUpdate
opening_form.show() |
To see how I wrote your script on the web host, try open this URL :
https://hastebin.com/raw/codumaveva
EDIT :
since pastebin has blocked on your country, then try other sites like pastebin i,e :
Tinypaste, Chop, hastebin, Snipt, etc instead using google docs. Because when you post your script onto google docs, usually it's change your script format.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
 |
TheyCallMeTim13 Wiki Contributor
Reputation: 51
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Thu Apr 12, 2018 9:34 pm Post subject: |
|
|
Every on of these just give an error, "Data Error".
Lets start with a working file by it self and go from there.
And Dropbox requires an ID cookie this won't work.
_________________
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1476
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1476
|
Posted: Fri Apr 13, 2018 6:05 pm Post subject: |
|
|
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. |
Thanks and FINAL!!!
"os.execute" It was a life-saving details.
and example Trainer:
https://dl.dropboxusercontent.com/s/6ro1jgyzqkuchhs/GameV32.CETRAINER?dl=1
and Code:
Code: | if syntaxcheck then return end
function CEButton5Click(sender)
local TABLE_VERSION = 32
local version_url = "https://docs.google.com/document/d/14OcroOlC5xX6igGg42_OpiHXCDWs-vUxTvVZBEynMnI/export?format=txt"
local table_url = "https://dl.dropboxusercontent.com/s/x7bdrwdv9aj9zel/GameV33.CETRAINER?dl=1"
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
path = TrainerOrigin or getMainForm()
local name = path .. "\\GameV33.CETRAINER"
local file = io.open(name, "wb")
file:write(latest)
file:close()
local name = os.execute(name, "\\GameV33.CETRAINER")
-- os.remove(file)
closeCE()
-- if useExist(file) then os.remove(file) end
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()
assert(true)
end |
there is only one missing.
please complete.
After the new version is installed,
A coding needed to clear off the old version.
like os.remove (file)
Thank you for all your efforts.
old version, still need the delete code.
and Thanks @Zanzer
_________________
|
|
Back to top |
|
 |
TheyCallMeTim13 Wiki Contributor
Reputation: 51
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Fri Apr 13, 2018 8:53 pm Post subject: |
|
|
Code: | os.execute(name, "\\GameV33.CETRAINER") |
Ok, so a CETRAINER still needs to be reexecuted like an EXE. So I'm thinking have an option for trainers, if true; install new one, write old ones name to file, start new one, close old one, then new one detects file and removes old one (say with an "isFirstLaunch()" function or an "onFirstLaunch()" event).
_________________
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1476
|
Posted: Sat Apr 14, 2018 5:45 am Post subject: |
|
|
TheyCallMeTim13 wrote: | close old one, then new one detects file and removes old one (say with an "isFirstLaunch()" function or an "onFirstLaunch()" event). |
Code: | local file = os.remove(path .. "\\GameV32.CETRAINER"); |
and Message:
Code: | messageDialog("Caution:\nThis update will permanently delete the old version.\nIf you do not want to delete the old version,\nget a copy before you approve!", mtInformation, mbOK) |
but there is a risk:
If the user tamper with the name of the old version,
it may not match the name in the delete code,
and can give this error.
This code, in conjunction with "closeCE ()", anonymous,
Can we connect with "path" or "TrainerOrigin"?
or it may be about as anonymous code.
FirstLaunch() Can he provide this?
Could you give the built-in use of the code?
or we hope that the user does not spoil the Names.
NOTE:
I noticed that; People take it and get it.
And appreciated; only with thanks or nothing!
But they are even too lazy to give a RAP Score!
This is great carelessness.
@TheyCallMeTim13 - @Corroder - @Zanzer ; I owe you a RAP score of the.
I will return them when the timeout is over.
Thanks again.
_________________
|
|
Back to top |
|
 |
TheyCallMeTim13 Wiki Contributor
Reputation: 51
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sat Apr 14, 2018 6:00 am Post subject: |
|
|
So I'll be adding a "FirstLaunch" function/event. And the user can mess with a lot, so it's best just to prepare for the user to tamper with the name, then just prompt the user and say old file not found. The other option will be to use the "${Temp}" key the is provided (in my modules File path setting), I'll give an example on the nest version.
I really don't care about REP, more interested in knowing YOU learned a new skill.
_________________
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1476
|
Posted: Sat Apr 14, 2018 6:24 am Post subject: |
|
|
TheyCallMeTim13 wrote: |
I really don't care about REP, more interested in knowing YOU learned a new skill. |
I'm still trying to find out.
I've had a lot of changes in the last eight months.
Now they're talking about trailers I do. This is a nice feeling.
For me; It is a virtue to consult the master and appreciate the masters.
Your sincerity, for your patience and wisdom: thank you all.
NOTE: I use the code as it is now.
As I learn, maybe I make a change.
Including old version deletion, final state:
https://www.dropbox.com/s/6ro1jgyzqkuchhs/GameV32.CETRAINER?dl=1
Thanks Masters ..
_________________
|
|
Back to top |
|
 |
|
|
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
|
|