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 


Trainer [standalone]. Save/Load settings.
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
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Mon Dec 19, 2011 8:12 pm    Post subject: Trainer [standalone]. Save/Load settings. This post has 1 review(s) Reply with quote

I was intrigued by this topic: http://forum.cheatengine.org/viewtopic.php?t=544107

For now, all CE6 standalone trainers are extracting all needed files to: %temp%\cetrainers\CET{random}.tmp\extracted\

getCheatEngineDir() leads to above temporary folder.

and io.open("file.txt", "r") opens file.txt inside "extracted" folder


But how to get the trainer real path and use it? I made small modification to standalonephase2.dat file
([url=link down]download[/url]) (copy/paste/overwrite original) (backup original)
(DIFF)


Modified standalonephase2.dat causes additional file named TrainerRealPath.txt (yes, it's a pretty lame name Cool ) to be created inside extracted directory - just after you launch your trainer but before it unpacks the needed files.


Now with this Lua code and standalonephase2.dat you can get trainer real path:
Code:
function getTrainerRealPath()
local t
  local f = io.open("TrainerRealPath.txt", "r")
  if (f ~= nil) then
    t = f:read("*all")
    f:close()
  else
    t = nil
  end
  return t
end





You can use it to save trainer user options/settings (or logs, stats, etc)

for example:
Code:
MyPath = getTrainerRealPath() -- Trainer real path

function SaveSettings()
  if MyPath then
    settingsFile = io.open(MyPath.."Settings.ini", "w")
    if (settingsFile ~= nil) then
      settingsFile:write(control_getCaption(EDIT1).."\n") --diamonds
      settingsFile:write(control_getCaption(EDIT2))       --playerspeed
      settingsFile:close()
    end
  end
end

function LoadSettings()
  if MyPath then
    settingsFile = io.open(MyPath.."Settings.ini", "r")
    if (settingsFile ~= nil) then
      tmpAddDiamonds = settingsFile:read() --read line
      tmpPlayerSpeed = settingsFile:read() --read line
      settingsFile:close()
    end
  end
end



Here, you have trainer ( it only loads values from file named settings.ini and saves all values when trainer is closed ) :

- standalone demo trainer (EXE file) [url=link down]LINK[/url]


- CT file (attachment). Of course "save settings", "load settings" do not work for CT and CETRAINER.


Edit:
Use TrainerOrigin instead. (variable added in CE6.2)



save_load.ct
 Description:

Download
 Filename:  save_load.ct
 Filesize:  2.03 KB
 Downloaded:  1690 Time(s)


_________________


Last edited by mgr.inz.Player on Wed Apr 03, 2013 6:45 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Wed Apr 03, 2013 5:52 pm    Post subject: Reply with quote

Interesting!
Can you re-upload the files? Smile

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Wed Apr 03, 2013 5:56 pm    Post subject: Reply with quote

In 6.2 it's a variable named TrainerOrigin
_________________
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: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Wed Apr 03, 2013 6:05 pm    Post subject: Reply with quote

Thanks!
Gonna test it now.

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Wed Apr 03, 2013 6:22 pm    Post subject: Reply with quote

@Mother of hack, Indeed. What DB wrote.

@all
The above standalonephase2.dat is now useless.

But, I'm using standalonephase2.dat to do other things for me Razz
Creates file with pids of all currently running processes + information about parent process for those. I just read that file with io.open("processes.txt", "r"):read()



As for saving trainer settings, I've made class (Lua class or whatever it is called in Lua) for such things. Saving window position, size, user preferences, etc.
I will create new topic for this when ready, probably with name: "LoadSaveOptions".

It's finished in 90% (Apr 15, 2012). It's almost universal/flexible. I can add more entries inside "settings" window with ease, all controls buttons are created automatically...

Here is trainer with "LoadSaveOptions" class:
http://forum.cheatengine.org/viewtopic.php?t=550742



To do:
- 5% - custom hotkeys Razz (when I find some free time)
- 5% - testing, testing, ... (-//-)

_________________
Back to top
View user's profile Send private message MSN Messenger
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Sat Apr 06, 2013 2:56 am    Post subject: Reply with quote

Any chance to have look in the source of it? Smile.
_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Mon Jul 08, 2019 6:01 pm    Post subject: Reply with quote

hi mgr.inz.Player and CEF ..

without saving files on the table,
Is it possible to record in Trainer?
So "MyPath = getMainForm ()", like "findTableFile ('record.txt')".

I designed a game.
progress in the game, I'm recording.
With the above code it will be exposed recorded files.
I don't want them to edit the .txt file on the Desktop. Sad

Is it possible to record inaccessible file?
Thanks.

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
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 Visit poster's website MSN Messenger
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Wed Jul 10, 2019 8:27 am    Post subject: Reply with quote

write a binary file, and/or use compression/encryption. might be able to make it hidden with shellExecute... should be able to put it in %userprofile% / SavedGames or something if you wanted, just because the default path is the table/trainer location doesn't mean you can't give an absolute path when opening the file.

I suppose you could also use the registry via the settings lua stuff but it seems locked to the CE key /shrug.


afaik there's no easy way to overwrite saved table files and resave the trainer.

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Wed Jul 10, 2019 3:32 pm    Post subject: Reply with quote

Thanks for the answer @FreeER
I think I can set the absolute path: "Temp" or "CE Autorun".
3 existing files will be saved.
I think I can put them in one folder.
I tried encryption, but the restore doesn't produce the same result.

What I'm trying to tell you is more clear here.
Please open the game and try to play.
On the table: "Win List", Level and xp records will come.

( A game open to development and in the beginning. Smile )

Game Download: https://www.dosyaupload.com/6ud8

Without using VB, I will only work with CE Lua.
Thanks in advance for all your ideas.

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
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 Visit poster's website MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Wed Jul 10, 2019 8:12 pm    Post subject: Reply with quote

Aylin wrote:
...
Without using VB, I will only work with CE Lua.
Thanks in advance for all your ideas.


What does that mean?. Please explain...

In my opinion, CE has created mainly for hacking or as memory managing tool.
It's not created for game development. Making a game using CE, especially just to prove that CE can also be used to make things other than for memory management purposes.

Your statement by claiming not to use VB leads to an allusion to other people, especially users of VB programming.

I am one of those people who use VB and C-Sharp in making many applications, not just for making games.

And if you want to show that you are truly an expert at making games using cheat engines, then you should prove it by making an advance game like 3D games and others.

So, it would be better for you to explain the purpose of your statement in this forum. Because of your statement, seen by many people, including VB programmers.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Thu Jul 11, 2019 5:00 am    Post subject: Reply with quote

As far as I can tell, I do not claim "expertise".
I used VB, and I admit it's more advanced than CE Lua.
But my goal is: CE Lua's boundaries,
Except to interrupt or correct the game,
see if you can do a lot of different things, and show them.

I remember that copyright infringement and CE and CEF were warned.
There is much labor here; CE is causing people to be involved with codes.
This is a beautiful mission for the future.
Or so I think.

I agree: I still can't write code,
But that doesn't stop me from creating different issues.

Gifs, MP3 Player, Trainers, Games.
These and more are just steps.
Objective: Coding with fun.
Don't focus on cutting the game, time is running out.
Different topics lead to great goals.
Note: You may think I'm in the wrong place!
But to spread it, CE is a pretty good start.

I repeat: I will not give up CE Lua Script. Smile

I exaggerate too much?
In my eyes, numbers and letters dance in harmony,
Each code seems to trigger a different life.
CE is a meaningful coding tool and spreading honor.

You were saying how @Corroder;
Cheers! Smile

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
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 Visit poster's website MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Jul 11, 2019 9:35 am    Post subject: Reply with quote

Aylin wrote:
I repeat: I will not give up CE Lua Script. Smile

I exaggerate too much?
In my eyes, numbers and letters dance in harmony,
Each code seems to trigger a different life.
CE is a meaningful coding tool and spreading honor.

You were saying how @Corroder;
Cheers! Smile


Seem you are unfair and not honest. I did almost my apps and game using VB and C-Sharp. When you said "Without using VB, I will only work with CE Lua.", of course, I feel you were insulting me because you knew how I did with my game apps and VB script.

Why you must say VB?. Is there any connections that VB scripts with your ambitions and your projects?. You no need to say like that or you can say Unity, Eclipse, Gideros, Love2D, and much other game development tools instead must say VB. There is no relation at all with your ambitions. No one will stumble your goal and your ambitions, but that will seem pretty and good if you do on a good way too without comparing what you did with others, except for learning purposes.
So, last words from me. goes on with all what you want and it's better to be wiser on the future.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Thu Jul 11, 2019 12:46 pm    Post subject: Reply with quote

Corroder wrote:


"Without using VB, I will only work with CE Lua.", of course, I feel you were insulting me because you knew how I did with my game apps and VB script.


@Corroder, you totally misunderstood me.
I would never insult you, maybe it's a translation error.
But insulting! I'm sorry if you felt that way.
You are one of my favorite masters in this forum.
@Corroder, @FreeER, @DaSpamer and @mgrInzPlayer.

I did some projects with VB,
it has a very rich plugin and ready ".dll" power.
but I have reviewed CEF shares from the past to this day.
There is another soul at CE, another magic and development.
That's how I see it.

Senden: the game you do with VB, I asked him to experiment with CE Lua.
This is not to belittle,
I think you got it wrong and I'm sorry. Sad

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
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 Visit poster's website MSN Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Fri Jul 12, 2019 5:48 am    Post subject: Reply with quote

and solution ..
and again @mgrInzPlayer code.


The following code allows you to record all available transactions.
Code:
Save()

and restores the current recordings when the Trainer is turned on again.
Code:
Load()


Code:
function Save()
if settings then
  settings.Value['label1'] = UDF1.CELabel1.caption --level
  settings.Value['label2'] = UDF1.CELabel2.caption --xp
  settings.Value['memo1'] = UDF1.CEMemo1.Lines.Text --win list
end
end

function Load()
  if settings.Value['label1' and 'label2' and 'memo1'] ~= nil then
    UDF1.CELabel1.caption = settings.Value['label1']
    UDF1.CELabel2.caption = settings.Value['label2']
    UDF1.CEMemo1.Lines.Text = settings.Value['memo1']
  end
end
Load()

function FormClose(sender)
Save()
 closeCE()
 return caFree()
end


And the most beautiful side: For Registration and Loading,
You don't need any files outside.
A completely local record. Wink

again thanks @mgr.inz.Player

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
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 Visit poster's website MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat Jul 13, 2019 9:43 am    Post subject: Reply with quote

The full game has done. Using CE Lua. (See how, NOT JUST VB)

Demo: https://youtu.be/_E5NxseE15Y

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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