 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1550
|
Posted: Sat Aug 03, 2019 10:12 am Post subject: Print result as string (SOLVED) |
|
|
Why the question is name-specific?
Because @ DaSpamer has original ideas for such complex encodings.
If you have any ideas of course, please help.
The following code is an @Corroder publication.
He performs an Aobs scan and prints all the results.
I tried, but I couldn't find a solution
I need two additions.
| Code: | function getByteString(address, bytecount)
local bytes = readBytes(address, bytecount, true)
if bytes then
local result = ""
for i = 1, #bytes do
if #result > 0 then result = result .. " " end
result = result .. string.format("%02X", bytes[i]) end
return result end
end
function aobResult(aobStr)
res = AOBScan(aobStr)
j = 0
cnt = 1
if (res~=nil) then
print("Results found: "..res.Count)
while j < res.Count do
a = getByteString(res[j], 12)
--print("Address "..cnt.." = "..res[j].." --> AOB : "..a)
UDF1.CEMemo1.append("Address "..cnt.." = "..res[j].." --> AOB : "..a)
j=j+1
cnt = cnt+1
end
res.destroy()
res=nil
else
print("No results found")
end
end
function CEButton1Click(sender)
UDF1.CEMemo1.Clear()
UDF1.CEMemo1.ScrollBars='ssVertical'
aobResult("24 01 62 07") --- example, put your AOB here
end
UDF1.Show() |
1) I need to get the result as "String"
Sample:
| Code: | | aobResult("22 2C 20 22 72 61 6E 6B 22 3A 20 30 2C 20 22 73 63 6F 72 65 22 3A 20 ?? ?? ?? ?? ?? ?? ?? ?? ?? 7D") |
| Code: | | (Print) Result: "22 2C 20 22 72 61 6E 6B 22 3A 20 30 2C 20 22 73 63 6F 72 65 22 3A 20 32 31 35 30 32 31 34 31 34 7D" |
What I want is that it returns the result as a string as follows.
| Code: | | New String Format Result: "", "rank": 0, "score": 215021414}" |
2) Here's a question specific to @DaSpamer:
What I need are the numbers in the code.
I just have to print those numbers as a string.
Sample:
| Code: | | aobResult("22 2C 20 22 72 61 6E 6B 22 3A 20 30 2C 20 22 73 63 6F 72 65 22 3A 20 ?? ?? ?? ?? ?? ?? ?? ?? ?? 7D", 23, 9) |
| Code: | | New String Format Result: "215021414" |
Of course, if you have any relevant solution ideas, please write.
Thanks ..
_________________
Last edited by AylinCE on Mon Aug 05, 2019 10:27 pm; edited 1 time in total |
|
| Back to top |
|
 |
Lynxz Gaming Expert Cheater
Reputation: 4
Joined: 01 Jul 2017 Posts: 208 Location: help
|
Posted: Sat Aug 03, 2019 7:54 pm Post subject: Re: Print result as string (! DaSpamer) |
|
|
if im not misunderstanding
my way is i add address manually in table and make type string and set the length and i make the description as "to string"
| Code: |
table = getAddressList().getMemoryRecordByDescription
scan = AOBScan("22 2C 20 22 72 61 6E 6B 22 3A 20 30 2C 20 22 73 63 6F 72 65 22 3A 20 ?? ?? ?? ?? ?? ?? ?? ?? ?? 7D")
table("to string").address = scan[0]
print(table("to string").value) |
_________________
my english is bad
discord : rynx#9828 |
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Sat Aug 03, 2019 9:43 pm Post subject: |
|
|
No. 1 :
| Code: | function string.fromhex(str)
str = str:gsub("%s+", "")
str = string.gsub(str, "%s+", "")
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16)) end))
end
Result = "22 2C 20 22 72 61 6E 6B 22 3A 20 30 2C 20 22 73 63 6F 72 65 22 3A 20 32 31 35 30 32 31 34 31 34 7D"
new_str = string.fromhex(str)
print(new_str) --> ", "rank": 0, "score": 215021414} |
No. 2
| Code: | local new_str = '"rank": 0, "score": 215021414}'
local extracted = string.match(new_str, '"score":(.*)')
local repl = string.gsub(extracted,'}','')
local text = 'Result : '..repl
print(text) --> Result : 215021414 |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1550
|
Posted: Sun Aug 04, 2019 5:26 am Post subject: |
|
|
@Lynxz Gaming and @Corroder ,
Thanks for your ideas.
But the codes don't match.
Here's the code to use:
| Code: | function getByteString(address, bytecount)
local bytes = readBytes(address, bytecount, true)
if bytes then
local result = ""
for i = 1, #bytes do
if #result > 0 then result = result .. " " end
result = result .. string.format("%02X", bytes[i]) end
return result end
end
function aobResult(aobStr)
res = AOBScan(aobStr)
j = 0
cnt = 1
if (res~=nil) then
while j < res.Count do
a = getByteString(res[j], 51)
--UDF1.CEMemo1.append("Address "..cnt.." = "..res[j].." --> AOB : "..a)
UDF1.CEMemo1.append(a)
j=j+1
cnt = cnt+1
end
res.destroy()
res=nil
else
UDF1.CEMemo1.append("No results found")
end
end
function num2hex(num)
local hexstr = '0123456789ABCDEF'
local s = ' '
while num > 0 do
local mod = math.fmod(num, 16)
s = string.sub(hexstr, mod+1, mod+1) .. s
num = math.floor(num / 16)
end
if s == '' then s = '0' end
return s
end
function str2hex(str1)
local hex = ''
while #str1 > 0 do
local hb = num2hex(string.byte(str1, 1, 1))
if #hb < 2 then hb = '1' .. hb end
hex = hex .. hb
str1 = string.sub(str1, 2)
end
return hex
end;
-----------------------------------
function CEButton1Click(sender)
UDF1.CEEdit2.Text=""
UDF1.CEMemo1.Clear()
a = UDF1.CEEdit1.Text -->The zID number given by the game to the user to challenge his / her own score.
b = str2hex(a)
UDF1.CEEdit2.Text=("22 69 64 22 3A 20 22 "..b.." 22 2C 20 22 72 61 6E 6B 22 3A 20 30 2C 20 22 73 63 6F 72 65 22 3A 20 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??") --> Search Aob
end
UDF1.Show() |
Result:
| Code: | 22 69 64 22 3A 20 22 33 31 31 30 39 38 38 35 30 36 35 22 2C 20 22 72 61 6E 6B 22 3A 20 30 2C 20 22 73 63 6F 72 65 22 3A 20 32 31 35 30 32 31 34 31 34 7D
22 69 64 22 3A 20 22 33 31 31 30 39 38 38 35 30 36 35 22 2C 20 22 72 61 6E 6B 22 3A 20 30 2C 20 22 73 63 6F 72 65 22 3A 20 32 31 35 30 32 31 34 31 34 7D
22 69 64 22 3A 20 22 33 31 31 30 39 38 38 35 30 36 35 22 2C 20 22 72 61 6E 6B 22 3A 20 30 2C 20 22 73 63 6F 72 65 22 3A 20 32 31 35 30 32 31 34 31 34 7D |
I have to fill Memo.Lines.Text with the number given for String and "Score".
_________________
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Sun Aug 04, 2019 5:55 am Post subject: Re: Print result as string (! DaSpamer) |
|
|
| Aylin wrote: |
1) I need to get the result as "String"
Sample:
| Code: | | aobResult("22 2C 20 22 72 61 6E 6B 22 3A 20 30 2C 20 22 73 63 6F 72 65 22 3A 20 ?? ?? ?? ?? ?? ?? ?? ?? ?? 7D") |
| Code: | | (Print) Result: "22 2C 20 22 72 61 6E 6B 22 3A 20 30 2C 20 22 73 63 6F 72 65 22 3A 20 32 31 35 30 32 31 34 31 34 7D" |
What I want is that it returns the result as a string as follows.
| Code: | | New String Format Result: "", "rank": 0, "score": 215021414}" |
2) Here's a question specific to @DaSpamer:
What I need are the numbers in the code.
I just have to print those numbers as a string.
Sample:
| Code: | | aobResult("22 2C 20 22 72 61 6E 6B 22 3A 20 30 2C 20 22 73 63 6F 72 65 22 3A 20 ?? ?? ?? ?? ?? ?? ?? ?? ?? 7D", 23, 9) |
| Code: | | New String Format Result: "215021414" |
Those above the first what you want. Of course, if you have any relevant solution ideas, please write.
Thanks .. |
Of course, the code I wrote which tried to give you solutions as you wish, doesn't match. Because what you want on the first topic is different from what you want on your last post. I didn't surprise about it. Has become a habit, that I knew.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1550
|
Posted: Mon Aug 05, 2019 10:26 pm Post subject: Re: Print result as string (! DaSpamer) |
|
|
| Corroder wrote: |
Of course, the code I wrote which tried to give you solutions as you wish, doesn't match. Because what you want on the first topic is different from what you want on your last post. I didn't surprise about it. Has become a habit, that I knew. |
@Corroder, I was hasty again.
I apologize and thank you for the Code.
I made some arrangements with your Uncle Lua's support,
http://lua-users.org/wiki/StringLibraryTutorial
The code you provide is now compatible with the main code
And it works fine.
with codes and regulations that you gave, compatible version:
| Code: | function CEButton1Click(sender)
UDF1.CEEdit2.Text=""
UDF1.CEEdit3.Text=""
a = UDF1.CEEdit1.Text
b = str2hex(a)
c = ("22 69 64 22 3A 20 22 "..b.." 22 2C 20 22 72 61 6E 6B 22 3A 20 30 2C 20 22 73 63 6F 72 65 22 3A 20 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??")
aobResult(c)
UDF1.CETimer1.Enabled = true
end
function CETimer1Timer(sender)
function string.fromhex(str1)
local str1 = UDF1.CEEdit3.Text
str1 = str1:gsub("%s+", "")
str1 = string.gsub(str1, "%s+", "")
return (str1:gsub('..', function (cc)
return string.char(tonumber(cc, 16)) end))
end
UDF1.CEEdit2.Text = string.fromhex(str1)
local new_str = UDF1.CEEdit2.Text
--print(new_str) (result ("id": "31109885065", "rank": 0, "score": 215022254}, {)
local re = string.find(new_str, 'e":') +3
local rep = string.find(new_str, '}') -1
local repl = string.sub(new_str, re, rep)
local text = (cnt..'_ Result : '..repl)
UDF1.CEMemo1.append(text)
UDF1.CETimer1.Enabled = false
end
UDF1.CEEdit2.visible = false
UDF1.CEEdit3.visible = false
UDF1.CETimer1.Enabled = false
UDF1.Show()
-- Result: "4_ Result : 215022254"
|
Thanks again @Corroder, you always deserve +1.
_________________
|
|
| 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
|
|