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 


Repeated Commands
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
FreeER
Grandmaster Cheater
Reputation: 32

Joined: 09 Aug 2013
Posts: 809

PostPosted: Sun Apr 15, 2018 1:16 pm    Post subject: Reply with quote

Create another memory record for it and set it's value in the timer as well

Code:
GENJURO_mr=addresslist.getMemoryRecordByID(0)
GENJURO2_mr=addresslist.getMemoryRecordByID(1)

GENJURO_timer.OnTimer = function(t)
  GENJURO_mr.Value = thename
  GENJURO2_mr.Value = thename
end

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Genjuro
Newbie cheater
Reputation: 0

Joined: 26 Mar 2018
Posts: 15

PostPosted: Tue Apr 17, 2018 5:40 pm    Post subject: Reply with quote

Worked great as usual thanks alot man Very Happy

Unfortunately this memory address seems to be alot harder to pin down so ive given up.

So ive added a new "cheat" into the same script from before that stops code coming in from a dll.

I have it setup to do the cheat on a keypress (subsequent keypresses will just keep repeating the script)

However yet again i need this to just repeat the code automatically, every 8 seconds or so this time.

I tried to implement the timer i was shown earlier in this thread but got stuck as to the timer was made for changing memory values and this time i just need it to run a small script. Below is more or less whats been added.

Code:

    <CheatEntry>
      <ID>2</ID>
      <Description>"Auto Assemble script"</Description>
      <LastState/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
TeknoParrot64.dll+6A5F:
nop
nop
nop
nop
nop
nop
nop
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
TeknoParrot64.dll+6A5F:
nop
nop
nop
nop
nop
nop
nop
</AssemblerScript>
      <Hotkeys>
        <Hotkey>
          <Action>Toggle Activation</Action>
          <Keys>
            <Key>22528</Key>
          </Keys>
          <Description>Toggle the Title Force</Description>
          <ID>0</ID>
        </Hotkey>
      </Hotkeys>
    </CheatEntry>
  </CheatEntries>
  <CheatCodes>
    <CodeEntry>
      <Description>Change of lea rax,[TeknoParrot64.dll+91860]</Description>
      <Address>7FF890A56A5F</Address>
      <ModuleName>TeknoParrot64.dll</ModuleName>
      <ModuleNameOffset>6A5F</ModuleNameOffset>
      <Before>
        <Byte>48</Byte>
        <Byte>89</Byte>
        <Byte>44</Byte>
        <Byte>24</Byte>
        <Byte>20</Byte>
      </Before>
      <Actual>
        <Byte>48</Byte>
        <Byte>8D</Byte>
        <Byte>05</Byte>
        <Byte>FA</Byte>
        <Byte>AD</Byte>
        <Byte>08</Byte>
        <Byte>00</Byte>
      </Actual>
      <After>
        <Byte>48</Byte>
        <Byte>8B</Byte>
        <Byte>7C</Byte>
        <Byte>24</Byte>
        <Byte>20</Byte>
      </After>
    </CodeEntry>
  </CheatCodes>
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater
Reputation: 32

Joined: 09 Aug 2013
Posts: 809

PostPosted: Tue Apr 17, 2018 6:04 pm    Post subject: Reply with quote

Hm, I wouldn't think you'd need to run a script like that multiple times, you should be able to just enable it once and leave it on. Regardless to enable a script from lua you use memrec.Active = true where memrec is from getMemoryRecordByID etc. (for non-script memory records this will freeze the memory record the same as clicking the box in the address list)

If you really need it done in a timer you may need to toggle it which just involves setting it's active state to true if it's false and false if it's true, the not operator will give the opposite boolean state so you can use memrec.Active = not memrec.Active to toggle the state.

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Genjuro
Newbie cheater
Reputation: 0

Joined: 26 Mar 2018
Posts: 15

PostPosted: Wed Apr 18, 2018 7:24 pm    Post subject: Reply with quote

I knew you were gonna say that about only needing to run it once hehe.

I guess i just want it this way because the trainer is open before the game and i want to make sure the incoming code is stopped. Also i want it just to be an active timer as soon as the trainer is open just so the user dosnt have to think about using it.

I was looking forward to trying this out today but woke up with a debilitating migraine... all i could bring myself to do with my pc before going to work was sticking an episode of the punisher on.

Anyway just wanted to send this so you dont think im being ignorant of your help. Very Happy
Back to top
View user's profile Send private message
Genjuro
Newbie cheater
Reputation: 0

Joined: 26 Mar 2018
Posts: 15

PostPosted: Thu Apr 19, 2018 3:29 am    Post subject: Reply with quote

PERFECTO this thing runs nice and smooth Very Happy

I have a repeated request by some users to have the name input to be taken from a local text file, would it be possible to incorporate this?

Would it be like this? (complete stab in the dark here)

Code:

thename = File.name.txt.Text


Thanks alot for this man, people are loving this thing Very Happy
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater
Reputation: 32

Joined: 09 Aug 2013
Posts: 809

PostPosted: Thu Apr 19, 2018 8:26 am    Post subject: Reply with quote

You can google lua file io and find some stuff like https://www.lua.org/pil/21.1.html

But something basic for this would be
Code:
name = io.lines('somename.txt')()


which would try to open the file somename.txt in the same directory as the CT and read whatever is on the first line as the name. It'll error if that file doesn't exist however, if you need to be able to handle it not existing you'll probably want to open it yourself with io.open and see if it returns nil or not.

(technically io.lines returns an iterator to all the lines in the file that you'd normally use in a loop but if you're just reading a name all you need is the first, hence the () after the lines call, to manually call the iterator and get the first line)

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Genjuro
Newbie cheater
Reputation: 0

Joined: 26 Mar 2018
Posts: 15

PostPosted: Thu Apr 19, 2018 11:08 am    Post subject: Reply with quote

Worked like a charm. Ill check that site out in future, cheers.

Yeah so it worked great when running the script through my cheat engine installation. But when running it as a saved .exe it fails to detect the text file...

I saved it as 64bit (since the game is 64bit), gigantic size, with the VEH debugger selected (otherwise that affected dll crashes the game).

I only got to test the exe version once before having to leave for work. Is there another option i need to tick to let it detect the text file?
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater
Reputation: 32

Joined: 09 Aug 2013
Posts: 809

PostPosted: Thu Apr 19, 2018 11:19 am    Post subject: This post has 1 review(s) Reply with quote

yeah as a trainer I think you have to use the TrainerOrigin variable as the path (the exe is actually a self-extracting archive that extracts the actual trainer and some required files into the temp directory and then runs it).

something like
Code:
name = io.lines(TrainerOrigin .. '/somename.txt')()


(alternatively you pack the text file into the trainer but that's a bit meaningless in this case since you want the users to be able to change it easily lol)

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Genjuro
Newbie cheater
Reputation: 0

Joined: 26 Mar 2018
Posts: 15

PostPosted: Fri Apr 20, 2018 3:02 am    Post subject: Reply with quote

perfect, thanks again for your help, its been invaluable. Very Happy
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
Page 2 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