|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
gaming04 Expert Cheater Reputation: 0
Joined: 06 Dec 2010 Posts: 186
|
Posted: Sun Nov 08, 2015 2:39 pm Post subject: Automatic Fill templates |
|
|
Hello Cheat Engine Community,
I want to find out how I can make my own automated template for the auto-assembler that will automatically fill upon selecting several addresses from the disassembler.
For example, I want to select two addresses to automatically send to the different code-caves using a single script without having to do that manually every time. It is basically using the code-injection twice but having my own custom scripts show up each time.
_________________
Life can be a blitz. What's right and wrong will fly right past you without you having to do a thing about it.
"Cheating only means you want to hold on to the things you value." |
|
Back to top |
|
|
Fluffer_Nutter Advanced Cheater Reputation: 0
Joined: 26 Feb 2015 Posts: 67
|
Posted: Sun Nov 08, 2015 3:31 pm Post subject: |
|
|
Here are 2 options.
Option 1: (EASY)
This will activate ANY and ALL "AA" scripts that are below it in the same tree.
Option 2: (MED)
Lua. This you have to do manually.
ex: Create a UDF. Place a button. Show UDF. Bla Bla Bla.
Also for the Lua there is a few ways to do it. Is it an AOB or AA
And you would need to set a check if it is checked or unchecked.
With a little more info on what kind of code you are doing and how you want it done i can write up a basic script for you to see how it works.
-Fluffer Nutter[/code]
|
|
Back to top |
|
|
gaming04 Expert Cheater Reputation: 0
Joined: 06 Dec 2010 Posts: 186
|
Posted: Wed Nov 11, 2015 3:15 pm Post subject: |
|
|
Okay let's try it.
Within the Auto-assembler window, I want a new option to pop up:
Code-injection > Custom Template
The Custom Template option will automatically insert codes into the code box in the AA window using a custom script. Notice this is much like simply using File > Open.
However, the trick I am asking about is that this custom template will have the power like Template > Code-Injection. It will ask for more than a single address from the dis-assembler because this custom script plans to modify the code in a specific way. it reads out a section of the memory by address and safely transmit them to Template -> Cheat table framework--depending on how many addresses are desired by the user. Much like using Code-Injection multiple times.
The difference in the end is that the custom code-inject template will automatically sort out the addresses and have my own set of codes already inserted. In short, this should turn out to be much like a Code-Injection Macro turned into a template.
_________________
Life can be a blitz. What's right and wrong will fly right past you without you having to do a thing about it.
"Cheating only means you want to hold on to the things you value." |
|
Back to top |
|
|
Fluffer_Nutter Advanced Cheater Reputation: 0
Joined: 26 Feb 2015 Posts: 67
|
Posted: Thu Nov 12, 2015 1:22 am Post subject: |
|
|
I think I understand what you want. This is a snipit from my script. If it seems like what yo want i can send you the entire thing and explain the process. Or i might be totally misunderstanding. Ill try to put a lot of detail of it here tho.
Code: |
-- This will see what state the checkbox is in (1 = Checked)
if (checkbox_getState(WC.IRCheckBox) == 1) then
-- IF Checked Call AA Script ENABLE
getAddressList().getMemoryRecordByDescription('NAMNE OF AA').Active=true
-- My codes are AOB so this will check if the code was found or not
if AobSwapCheck~=true then
-- If AOB = NOT FOUND Do Something. In this chase it writes to a memo
memo_append(LA.CEMemo1,'FAILED - NAME OF AA')
else
-- If AOB = FOUND Do Something. In this chase it writes to a memo
memo_append(LA.CEMemo1,'ENABLED - NAME OF AA')
end
|
So what you can do is more then one AA. You can go down a list of all of them making sure they all are found and all enable. Or Just call them one at a time by a button or checkbox.
Now to actually EDIT the AA im not 100% sure. A quick search should find some useful info. But the same idea would work. Be it checkbox or Textbox input. So for ex: If user inputs "100" for gold then it still needs to find the correct AA. Then just add the value where it is needed. (Again need to do a quick search on how to live edit an AA script)
Maybe a little more on the game and what is being changed can help also. (Unless it is a multiplayer game then the post will be locked )
But knowing what is changing and what input can be placed into it will help.
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Thu Nov 12, 2015 4:35 am Post subject: |
|
|
Sorry, Fluffer_Nutter, keyword of gaming04's idea is 'string interpolation' http://lua-users.org/wiki/StringInterpolation
Here my little interp copied there,which has been evolved to be a bit monster-like
To test, place script at lua-window, attach ce to itself and execute
eg. Code: | --
-- main interpolation functions
function hx(n)return string.format("%02X",n)end
function string:trim(dir)
if dir==true then return self:match('^%s*(.-)$')
elseif dir==false then return self:match('^(.-)%s*$')
elseif dir==nil then return self:match('^%s*(.-)%s*$')
else return self end
end
function string:sep(SEP,extra)
local r,s,i,a,b = {},{},1,1,-1
if type(SEP)=='number' then
for i=1,self:len(),SEP do r[1+#r]=self:sub(i,i+SEP-1) end
if extra == true then
for i=1,#r do r[i]={string.byte(r[i],1,-1)}end
end
return r
end
SEP = type(SEP)=='string' and SEP or ','
a,b = self:find(SEP,i)
while a~=nil do
r[1+#r]= string.trim(self:sub(i,a-1))
s[1+#s]= self:sub(a,b)
i = b + 1
a,b = self:find(SEP,i)
end
r[1+#r] = self:sub(i)
if extra== true then return r end
return r,s
end
function interp(s,lookup,parsehex)
if type(lookup)=='table' then
local source = lookup
lookup = function(k)return source[k]end
end
local noc = 0 -- nochange counter
local a,b,c,d,e = 1,1,1,1,1 -- gsub counters
local parselookup = function (h,n,d)-- parameters: head-code name-key default
local v,m = lookup(n),tonumber(n)
if v==nil and m~=nil then v = lookup(m) end
if type(v)=='string' then return v
elseif type(v)=='number' then
return h=='^' and string.format("%02X",v) or tostring(v)-- decimal for '#'
else noc=noc+1 return d end
end
while a+b+c+d+e>0 do
if type(lookup)=='function' then
s,e = s:gsub('"([%a_][%w_.]*)(%^)([%a_][%w_<.:+`%[%]>]*)"',function(func,h,n)
local original,fn = '"'..func..h..n..'"',_G[func] or loadstring('return '..func)()
local parsed = parselookup(h,n,original)
if parsed==original then
noc=noc-1 -- -- undo noc count
parsed = n -- treat symbol as input
end
if type(fn)=='function' then
local hexform = tonumber(parsed,16)
if hexform ~= nil then parsed = hexform end
local v = fn(parsed)
if type(v)=='string' then return v
elseif type(v)=='number' then
return string.format("%02X",v)
end
end
noc=noc+1
return original
end)
e,noc=e-noc,0
s,c = s:gsub('"([%^#])([%a_][%w_<.:+`%[%]>]*)"',function(h,n) return parselookup(h,n,'"'..h..n..'"') end)
c,noc=c-noc,0
s,d = s:gsub('(%^)([%a_][%w_.]*)',function(h,n) return parselookup(h,n,h..n) end)
d,noc=d-noc,0
else
c,d,e=0,0,0
end -- parse lookup
s = s:gsub('("[#]%d+")',function(a)return string.format('%02X',tonumber(a:sub(3,-2)))end)
-- special,for example,convert "#1000" to 3e8
if parsehex==true then
a=1 -- force enter mul whileloop
while a > 0 do
s,a = s:gsub('([+-]%x+)(%*[+-]?%x+)',function(x,y)
local p,q,sign= tonumber(x,16),tonumber(y:sub(2,-1),16),1
if p==nil or q==nil then noc=noc+1 return x..y end
if p<0 then p=-p sign=-sign end
if q<0 then q=-q sign=-sign end
sign = p*q==0 and '+' or sign<0 and '-' or '+'
return string.format(sign.."%02X",p*q)
end)
a,noc=a-noc,0
end
s,b = s:gsub('([+-]%x+)([+-]%x+)',function(x,y)
local p,q= tonumber(x,16),tonumber(y,16)
if p==nil or q==nil then noc=noc+1 return x..y end
p,q = p+q,-p-q
return p<0 and string.format("-%02X",q) or string.format("+%02X",p)
end)
b,noc=b-noc,0
else
a,b=0,0
end -- parse hex
end -- while
return s
end
--- many support functions to be developed
function DisassembleBlk(addy,ln,dis,addrLookup)
local disassemble = dis or getDefaultDisassembler().disassemble
addrLookup = addrLookup or getAddress
-- addy = safeGetAddress(addy)
if type(addy)=='string' then addy = addrLookup(addy) end
local s={string.rep('-',76)}
local cnt,addr = 0,addy
while cnt<5 do
table.insert(s,disassemble(addr))
local len = getInstructionSize(addr)
addr = addr + len
cnt = cnt + len
end
table.insert(s,string.rep('-',76))
for i=1,ln do
table.insert(s,disassemble(addr))
addr = addr + getInstructionSize(addr)
end
addr = getPreviousOpcode(addy)
for i=1,ln do
table.insert(s,1,disassemble(addr))
addr = getPreviousOpcode(addr)
end
-- addr = addy
local max = {0,0}
for i=1,#s do
s[i] = s[i]:sep(' %- ')
if #s[i]>1 then
for j=1,#max do
local ll = s[i][j]:len()
if max[j]<ll then max[j]=ll end
end
end
end
for i=1,#s do
if 1<#s[i] then
for j=1,#max do
s[i][j]=s[i][j]..string.rep(' ',max[j]-s[i][j]:len())
end
end
s[i]=table.concat(s[i],' - ')
end
return table.concat(s,'\n')
end
function Disassemble10(a) return DisassembleBlk(a,10) end
function opsonly1(a) local d = disassemble(a):sep(' %- ') return d[#d] end
function toaob(a,len)
len = len or 10
local bt,s = readBytes(a,len,true),{}
for i=1,#bt do s[i]=hx(bt[i]) end
return table.concat(s,' ')
end
print(interp([[
AOBSCAN(where,"toaob^ADDR")
where:
"opsonly1^ADDR"
{
"Disassemble10^ADDR"
}
]],{ADDR='ReadProcessMemory+22'})) |
<please edit long quote>
bye~
_________________
- Retarded. |
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Sat Nov 14, 2015 4:10 pm Post subject: |
|
|
I also made something if you're interested:
http://pastebin.com/GNbWSzj4
It adds a new menu item under the "Tools" menu in the memory viewer called "Multi-Code Injection". It'll bring up a window for you to add addresses, and once you're done, it'll make a new script in your cheat table that contains everything.
You can put that code in a .lua file in the autorun folder in your main CE directory so you don't have to post it into the lua script table and execute it manually every time you want to use it.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
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
|
|