 |
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: 1546
|
Posted: Fri Feb 04, 2022 9:01 am Post subject: |
|
|
After so many posts, I'm starting to understand you.
Here is an example;
| Code: | local byteTbl = {}
function convert2(num,fmt)
byteTbl = {}
num1=math.floor(tonumber(num) / tonumber(fmt))
--print("num1:" .. num1)
b = (tostring(num1)):reverse()
lnn="0 "
a = b:gsub("..", "%1 "):sub(1,-1)
--print("a:"..a)
a=(a):reverse():sub(1,-1)
if (a):sub(1,1)==" " then a=(a):sub(2, -1) end
--print("a1:"..a)
a1=string.len(a) / 3
a1=math.floor(5 - tonumber(a1))
--print(a1)
ln=string.rep(lnn, a1) .. a
for byte in ln:gmatch("%d+") do
--print(byte)
table.insert(byteTbl, byte) end
return ln
end
function parseValue(val,fmt,desc1,desc2,desc3,desc4,desc5)
convert2(val,fmt)
addresslist=getAddressList()
if desc1~=nil then
aa1=addresslist_getMemoryRecordByDescription(addresslist, desc1)
aa1.Value=tonumber(byteTbl[1])
end
if desc2~=nil then
aa2=addresslist_getMemoryRecordByDescription(addresslist, desc2)
aa2.Value=tonumber(byteTbl[2])
end
if desc3~=nil then
aa3=addresslist_getMemoryRecordByDescription(addresslist, desc3)
aa3.Value=tonumber(byteTbl[3])
end
if desc4~=nil then
aa4=addresslist_getMemoryRecordByDescription(addresslist, desc4)
aa4.Value=tonumber(byteTbl[4])
end
if desc5~=nil then
aa5=addresslist_getMemoryRecordByDescription(addresslist, desc5)
aa5.Value=tonumber(byteTbl[5])
end
showMessage("The values were distributed to the given addresses.")
end
--parseValue(val,fmt,desc1,desc2,desc3,desc4,desc5)
--val = convert address value
--fmt = Determine by how many the value will be divided, if you do not want to divide, write 1 there
--desc1 = Address description where the 1st value will be written after the format.
--desc2 = Address description where the 2st value will be written after the format.
-- ...
--Use
--example address desc.
--addresslist_getMemoryRecordByDescription(addresslist, "exaple1") --example1 2 3 etc
--example address value:
-- conVal=addresslist_getMemoryRecordByDescription(addresslist, "example15").Value
--UDF1.CEButton1.OnClick=function()
parseValue(conVal,1,"example1","example2","example8","example11","example4")
--end |
I may have misunderstood you for the conversion format.
Here is a Conversion with different output lengths without division;
| Code: | local byteTbl = {}
function convert2(num,fmt)
byteTbl = {}
num1=math.floor(tonumber(num))
--print("num1:" .. num1)
b = (tostring(num1)):reverse()
lnn="0 "
a = b:gsub("..", "%1 "):sub(1,-1)
--print("a:"..a)
a=(a):reverse():sub(1,-1)
if (a):sub(1,1)==" " then a=(a):sub(2, -1) end
--print("a1:"..a)
a1=string.len(a) / 3
a1=math.floor(tonumber(fmt) - tonumber(a1))
--print(a1)
ln=string.rep(lnn, a1) .. a
for byte in ln:gmatch("%d+") do
--print(byte)
table.insert(byteTbl, byte) end
return ln
end
print(convert2(345,3))
print(convert2(345,5))
print(convert2(345,6))
print(convert2(345,9)) |
result:
0 3 45
0 0 0 3 45
0 0 0 0 3 45
0 0 0 0 0 0 0 3 45
_________________
|
|
| Back to top |
|
 |
bknight2602 Grandmaster Cheater
Reputation: 0
Joined: 08 Oct 2012 Posts: 588
|
Posted: Fri Feb 04, 2022 10:56 am Post subject: |
|
|
Seems to me that you need a few declarations or this won't work
if desc1~=nil then
aa1=addresslist_getMemoryRecordByDescription(addresslist, desc1)
dec1 = addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^2")
etc.?
|
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1546
|
Posted: Fri Feb 04, 2022 1:16 pm Post subject: |
|
|
| bknight2602 wrote: | Seems to me that you need a few declarations or this won't work
if desc1~=nil then
aa1=addresslist_getMemoryRecordByDescription(addresslist, desc1)
dec1 = addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^2")
etc.? |
This shouldn't be difficult to do;
parseValue(conVal,1,"Exp 10^1","Exp 10^2","Exp 10^3","Exp 10^4","Exp 10^5")
or new convert code .. (no 1 .. 5)
parseValue(conVal,5,"Exp 10^1","Exp 10^2","Exp 10^3","Exp 10^4","Exp 10^5")
--or 3 addres
parseValue(conVal,3,"Exp 10^1","Exp 10^2","Exp 10^3")
Of course if "Exp 10^2" specified "2" is a split request, return to the first exchange code and make the distribution request like this;
parseValue(conVal,2,"Exp 10^1","Exp 10^2","Exp 10^3","Exp 10^4","Exp 10^5")
_________________
|
|
| Back to top |
|
 |
bknight2602 Grandmaster Cheater
Reputation: 0
Joined: 08 Oct 2012 Posts: 588
|
Posted: Sat Feb 05, 2022 12:27 pm Post subject: |
|
|
| Thanks to both of you for coming up with the scheme on how to approach the problem. I still don't understand the arrays and their use, especially on getting the values out so that they may be put into addresses in the table. I have used both of your ideas to math.floor divide by stepping down the values by 100 manually, setting each to the correct table address and then setting the derived result of the math.floor operations to the correct address. I didn't count the steps because I have a lot of prints in there (commented out now) but there is at least 15 steps, but the whole procedure works when an item in the listview.
|
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1546
|
Posted: Sat Feb 05, 2022 2:16 pm Post subject: |
|
|
If the problem is still not fixed, you don't need to share your desk, just list what you're doing step by step.
Look at my signature, I'm still a beginner today and in the past.
I'll just try to make things easier with ideas.
Please help me understand what you want to do.
According to the result, let me prepare a small sample table for you.
An example of a ranking;
1) I scan a specific address and list the results.
a) List; in a list box on my table.
b) List; The CE main form is also in the "Found List".
c) List; in the address list.
2) I choose an address from the results.
3) I format the selected address value with the code above and divide it into 5 parts.
a) I divide the current value by 2 in math before dividing it into 5 parts.
b) I format it into 5 parts without using math.
4) I replace 5 new formatted values with 5 address values.
a) Addresses to be changed are in the Address list.
b) If elsewhere, where?
5) If there is no problem in the format, there is a problem in choosing the address to be distributed.
6) If there is no problem with the distribution, there is a problem with the list.
7) Please duplicate the options.
_________________
|
|
| Back to top |
|
 |
bknight2602 Grandmaster Cheater
Reputation: 0
Joined: 08 Oct 2012 Posts: 588
|
Posted: Sat Feb 05, 2022 3:16 pm Post subject: |
|
|
Um I thought my description was sufficient, however
| Code: |
local addresslist = getAddressList()
hundredmillions = math.floor(expvalue)/100000000
millions = math.floor(expvalue/1000000)
tenthousand = expvalue - math.floor(expvalue/1000000)*1000000
tenthousands = math.floor(tenthousand/10000)
hundred = expvalue-math.floor(expvalue/10000)*10000
tens = hundred - math.floor(hundred/100)*100
a = math.floor(hundred-tens)/100
hundreds = math.floor(a)
heronamelevelTens = addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^2")
heronamelevelHundreds = addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^4")
heronamelevelTenThousands = addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^6")
heronamelevelMillions = addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^8")
heronamelevelOneHundredMillions = addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^10")
memoryrecord_setValue(heronamelevelTens, tens)
memoryrecord_setValue(heronamelevelHundreds, hundreds)
memoryrecord_setValue(heronamelevelTenThousands, tenthousands)
memoryrecord_setValue(heronamelevelMillions, millions)
memoryrecord_setValue(heronamelevelHundredMillions, hundredmillions)
heronamelevelTens = nil
heronamelevelHundreds = nil
heronamelevelTenThousands = nil
heronamelevelOneHundredThousands = nil
heronamelevelOneHundredMillions = nil
|
My bad nineteen steps not counting the nils. Some of this was prior to initiating the thread, maybe could have eliminated one or two steps.
|
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1546
|
Posted: Sat Feb 05, 2022 4:27 pm Post subject: |
|
|
Indicate that your value is a number, not a "string".
Here are the results where you can see all the account outputs with different usage examples.
| Code: | --expvalue ?
local addresslist = getAddressList()
expvalue=math.floor(tonumber(expvalue))
print(1,expvalue)
hundredmillions = tonumber(expvalue) / 100000000
hundredmillions=math.floor(hundredmillions)
print(2,hundredmillions)
millions = tonumber(expvalue) / 1000000
millions=math.floor(millions)
print(3,millions)
tenthousand = tonumber(expvalue) - tonumber(expvalue) / 1000000 * 1000000
tenthousand=math.floor(tenthousand)
print(4,tenthousand)
tenthousands = tonumber(tenthousand) / 10000
tenthousands=math.floor(tenthousands)
print(5,tenthousands)
hundred = tonumber(expvalue) - tonumber(expvalue) / 10000 * 10000
hundred = math.floor(tonumber(hundred))
print(6,hundred)
tens = tonumber(hundred) - tonumber(hundred) / 100 * 100
tens = math.floor(tonumber(tens))
print(7,tens)
a = tonumber(hundred) - tonumber(tens) / 100
hundreds = math.floor(tonumber(a))
print(8,hundreds)
heronamelevelTens = addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^2")
heronamelevelHundreds = addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^4")
heronamelevelTenThousands = addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^6")
heronamelevelMillions = addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^8")
heronamelevelOneHundredMillions = addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^10")
heronamelevelTens.Value = tonumber(tens)
heronamelevelHundreds.Value = tonumber(hundreds)
memoryrecord_setValue(heronamelevelTenThousands, tonumber(tenthousands))
memoryrecord_setValue(heronamelevelMillions, tonumber(millions))
--memoryrecord_setValue(heronamelevelHundredMillions, tonumber(hundredmillions))
memoryrecord_setValue(heronamelevelOneHundredMillions, tonumber(hundredmillions)) |
Output of above code:
I haven't fully checked, although you may get a small error.
EDIT:
Error fixed. (You made a typo)
| Description: |
|
| Filesize: |
139.75 KB |
| Viewed: |
2446 Time(s) |

|
_________________
|
|
| Back to top |
|
 |
bknight2602 Grandmaster Cheater
Reputation: 0
Joined: 08 Oct 2012 Posts: 588
|
Posted: Sat Feb 05, 2022 5:13 pm Post subject: |
|
|
| AylinCE wrote: | | Indicate that your value is a number, not a "string". |
What are you asking? All I know is that the addresses are filled with the correct values up to ~25 K, not open at this time as I'm on another game debugging it. If you are suggesting that I add a tonumber to all of the set values, I can do that.
|
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1546
|
Posted: Sat Feb 05, 2022 5:24 pm Post subject: |
|
|
Are you making these calculations hypothetical?
Or is it a calculation that gives the values you really want?
| Code: | hundredmillions = tonumber(expvalue) / 100000000
hundredmillions=math.floor(hundredmillions)
print(2,hundredmillions)
millions = tonumber(expvalue) / 1000000
millions=math.floor(millions)
print(3,millions)
tenthousand = tonumber(expvalue) - tonumber(expvalue) / 1000000 * 1000000
tenthousand=math.floor(tenthousand)
print(4,tenthousand)
tenthousands = tonumber(tenthousand) / 10000
tenthousands=math.floor(tenthousands)
print(5,tenthousands)
hundred = tonumber(expvalue) - tonumber(expvalue) / 10000 * 10000
hundred = math.floor(tonumber(hundred))
print(6,hundred)
tens = tonumber(hundred) - tonumber(hundred) / 100 * 100
tens = math.floor(tonumber(tens))
print(7,tens)
a = tonumber(hundred) - tonumber(tens) / 100
hundreds = math.floor(tonumber(a))
print(8,hundreds) |
If this is a correct calculation, I can generate an automatic function in the same way.
EDIT:
| Code: | local hundredmillions=0
local millions=0
local tenthousand=0
local tenthousands=0
local hundred=0
local tens=0
local tens1=0
local addresslist = getAddressList()
function NewValueCalculation(expvalue)
if expvalue~=nil then
expvalue=math.floor(tonumber(expvalue))
--print(1,expvalue)
hundredmillions = tonumber(expvalue) / 100000000
hundredmillions=math.floor(hundredmillions)
--print(2,hundredmillions)
millions = tonumber(expvalue) / 10000000
millions=math.floor(millions)
--print(3,millions)
tenthousand = tonumber(expvalue) - tonumber(expvalue) / 1000000 * 1000000
tenthousand=math.floor(tenthousand)
--print(4,tenthousand)
tenthousands = tonumber(tenthousand) / 10000
tenthousands=math.floor(tenthousands)
--print(5,tenthousands)
hundred = tonumber(expvalue) - tonumber(expvalue) / 10000 * 10000
hundred = math.floor(tonumber(hundred))
--print(6,hundred)
tens = tonumber(hundred) - tonumber(hundred) / 100 * 100
tens = math.floor(tonumber(tens))
--print(7,tens)
tens1 = tonumber(hundred) - tonumber(tens) / 100
hundreds = math.floor(tonumber(tens1))
--print(8,hundreds)
else
showMessage("Please provide a valid digit value!")
end
end
function replaceValue(expvalue)
addresslist = getAddressList()
if expvalue~=nil and expvalue==tonumber(expvalue) then
NewValueCalculation(expvalue)
addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^2").value=tonumber(tens)
addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^4").Value=tonumber(hundreds)
addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^6").Value=tonumber(tenthousands)
addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^8").Value=tonumber(hundredmillions)
addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^10").Value=tonumber(millions)
end
end
-- use
newNmr=999999999.991 --or your value and button click ..
replaceValue(tonumber(newNmr)) |
result:
0
0
0
9
99
_________________
|
|
| Back to top |
|
 |
bknight2602 Grandmaster Cheater
Reputation: 0
Joined: 08 Oct 2012 Posts: 588
|
Posted: Sat Feb 05, 2022 7:24 pm Post subject: |
|
|
| AylinCE wrote: | Are you making these calculations hypothetical?
Or is it a calculation that gives the values you really want?
| Code: | hundredmillions = tonumber(expvalue) / 100000000
hundredmillions=math.floor(hundredmillions)
print(2,hundredmillions)
millions = tonumber(expvalue) / 1000000
millions=math.floor(millions)
print(3,millions)
tenthousand = tonumber(expvalue) - tonumber(expvalue) / 1000000 * 1000000
tenthousand=math.floor(tenthousand)
print(4,tenthousand)
tenthousands = tonumber(tenthousand) / 10000
tenthousands=math.floor(tenthousands)
print(5,tenthousands)
hundred = tonumber(expvalue) - tonumber(expvalue) / 10000 * 10000
hundred = math.floor(tonumber(hundred))
print(6,hundred)
tens = tonumber(hundred) - tonumber(hundred) / 100 * 100
tens = math.floor(tonumber(tens))
print(7,tens)
a = tonumber(hundred) - tonumber(tens) / 100
hundreds = math.floor(tonumber(a))
print(8,hundreds) |
If this is a correct calculation, I can generate an automatic function in the same way.
EDIT:
| Code: | local hundredmillions=0
local millions=0
local tenthousand=0
local tenthousands=0
local hundred=0
local tens=0
local tens1=0
local addresslist = getAddressList()
function NewValueCalculation(expvalue)
if expvalue~=nil then
expvalue=math.floor(tonumber(expvalue))
--print(1,expvalue)
hundredmillions = tonumber(expvalue) / 100000000
hundredmillions=math.floor(hundredmillions)
--print(2,hundredmillions)
millions = tonumber(expvalue) / 10000000
millions=math.floor(millions)
--print(3,millions)
tenthousand = tonumber(expvalue) - tonumber(expvalue) / 1000000 * 1000000
tenthousand=math.floor(tenthousand)
--print(4,tenthousand)
tenthousands = tonumber(tenthousand) / 10000
tenthousands=math.floor(tenthousands)
--print(5,tenthousands)
hundred = tonumber(expvalue) - tonumber(expvalue) / 10000 * 10000
hundred = math.floor(tonumber(hundred))
--print(6,hundred)
tens = tonumber(hundred) - tonumber(hundred) / 100 * 100
tens = math.floor(tonumber(tens))
--print(7,tens)
tens1 = tonumber(hundred) - tonumber(tens) / 100
hundreds = math.floor(tonumber(tens1))
--print(8,hundreds)
else
showMessage("Please provide a valid digit value!")
end
end
function replaceValue(expvalue)
addresslist = getAddressList()
if expvalue~=nil and expvalue==tonumber(expvalue) then
NewValueCalculation(expvalue)
addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^2").value=tonumber(tens)
addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^4").Value=tonumber(hundreds)
addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^6").Value=tonumber(tenthousands)
addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^8").Value=tonumber(hundredmillions)
addresslist_getMemoryRecordByDescription(addresslist, "Exp 10^10").Value=tonumber(millions)
end
end
-- use
newNmr=999999999.991 --or your value and button click ..
replaceValue(tonumber(newNmr)) |
result:
0
0
0
9
99 |
As I indicated up tp ~25000 yes the function has the correct values. The numbers in the listview are all -1 for the next level and they all leveled up with the next battle.
I'm a little confused are you indicating both functions have the correct values computed and stored in the correct fields?
The only reason that there are two tens is that the first always had an error because it resulted in a xx.x and those resulted in an error, I then tried doing a math.floor on thefirst division and that solved the problem xx.x became xx. You tell me why all the others resulted in an integer, but not that one. Didn't make sense to me. But yes the code results in the correct values as far as I've checked.
|
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1546
|
Posted: Sat Feb 05, 2022 9:24 pm Post subject: |
|
|
If there's still something missing, let me know.
If that's enough, it was accomplished with "math.floor()", "tonumber()" and other calculations you specified.
_________________
|
|
| 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
|
|