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 


Can Someone Write me a Script

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
dyl10s
How do I cheat?
Reputation: 0

Joined: 21 Aug 2016
Posts: 5

PostPosted: Sun Aug 21, 2016 11:34 pm    Post subject: Can Someone Write me a Script Reply with quote

Hey Everyone,

I need a lua script that looks for a string on a process and copies the first address it finds onto the clipboard.

Thanks!
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Aug 22, 2016 6:15 pm    Post subject: Reply with quote

Not sure if CE implements any clipboard functionality for you.
Back to top
View user's profile Send private message
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Mon Aug 22, 2016 7:01 pm    Post subject: Reply with quote

Zanzer wrote:
Not sure if CE implements any clipboard functionality for you.


AOBScan(aobstring): scans the currently opened process and returns a StringList object containing all the results. don't forget to free this list when done
Bytevalue of higher than 255 or anything not an integer will be seen as a wildcard

readInteger(address) : Reads an integer from the specified address. Returns nil if not a valid address.

writeToClipboard(text): Writes the given text to the clipboard
readFromClipboard(): Reads the text from the clipboard
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Tue Aug 23, 2016 6:36 am    Post subject: Reply with quote

Code:
function strToAOB(input) -- case sensitive
   if (input and type(input) == 'string') then
      local output = {};
      for i=1,#input do
         table.insert(output,("%x"):format(input:sub(i,i):byte()));
      end
      return table.concat(output," ");
   end
   return false
end
function findString(input)
   if (input) then
      local aob = strToAOB(input)
      if (aob) then
         local oAobs = AOBScan(aob);
         if (oAobs) then
            writeToClipboard(oAobs.getString(0));
            oAobs.destroy();
            return true;
         end
      end
   end
   return false;
end
-- converts string to aobs and writes to clipboard first address.
-- this scan is case sensitive
print(tostring(findString("hello")))

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

Joined: 21 Aug 2016
Posts: 5

PostPosted: Tue Aug 23, 2016 8:45 am    Post subject: Reply with quote

DaSpamer wrote:
Code:
function strToAOB(input) -- case sensitive
   if (input and type(input) == 'string') then
      local output = {};
      for i=1,#input do
         table.insert(output,("%x"):format(input:sub(i,i):byte()));
      end
      return table.concat(output," ");
   end
   return false
end
function findString(input)
   if (input) then
      local aob = strToAOB(input)
      if (aob) then
         local oAobs = AOBScan(aob);
         if (oAobs) then
            writeToClipboard(oAobs.getString(0));
            oAobs.destroy();
            return true;
         end
      end
   end
   return false;
end
-- converts string to aobs and writes to clipboard first address.
-- this scan is case sensitive
print(tostring(findString("hello")))


Thank You So Much!! This is perfect!
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Tue Aug 23, 2016 6:06 pm    Post subject: Reply with quote

CE already has a string to byte function. Smile
Code:
local output = stringToByteTable(input)
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Wed Aug 24, 2016 5:54 am    Post subject: Reply with quote

Zanzer wrote:
CE already has a string to byte function. Smile
Code:
local output = stringToByteTable(input)

Haha never noticed 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
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
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