View previous topic :: View next topic |
Author |
Message |
AntonVitalievich How do I cheat? Reputation: 0
Joined: 21 Jan 2016 Posts: 6
|
Posted: Thu Jan 21, 2016 1:10 am Post subject: Lua 6.5 CE version problem |
|
|
Hi
I Tryed to made some lua sript in 6.5 CE version which will must add or sub value "8".
***************************
Code: | al = getAddressList()
FIRSTAdress = al.getMemoryRecordByDescription("FIRSTAdress")
function fordownder()
if FIRSTAdress.Value~="??" then
FIRSTAdress.Value=FIRSTAdress.Value-8
end
end
createHotkey("fordownder", VK_C); |
***************************
FIRSTAdress.Value in CE Table has 4 bytes type. When i press hotckey lua show mesage - Error:"12.0" is an invalid integer
If i change type to float or drouble it work.
After that i try CE 6.4 version and in this version all fine. 4 bytes adress work. In CE 6.5 4 bytes adrees not work
Its some bug or i do something wrong in CE 6.5?
Last edited by AntonVitalievich on Thu Jan 21, 2016 4:36 am; edited 1 time in total |
|
Back to top |
|
|
hhhuut Grandmaster Cheater Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Thu Jan 21, 2016 3:05 am Post subject: |
|
|
Maybe it's not a bug, but just another difference between LUA 5.1 (which is used by CE 6.4) and LUA 5.3 (which is used by CE 6.5) ...
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Thu Jan 21, 2016 3:51 am Post subject: |
|
|
redownload cheat engine, you may gotten it within the first week. There has been a fix at the end of the week after release that fixed an integer conversion issue
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Thu Jan 21, 2016 4:31 am Post subject: |
|
|
In Lua5.1 if you execute this line:
it will convert '20' to 20, subtract 8, then print the result: 12
In Lua5.2-Lua5.3 if you execute this line:
it will convert '20' to 20.0, subtract 8, then print the result: 12.0
You see the difference? 12 and 12.0
Going back to FIRSTAdress.Value
In CE6.4 doing FIRSTAdress.Value = 12.5 will throw 'is an invalid integer'.
In CE6.4 doing FIRSTAdress.Value = '12.5' will throw 'is an invalid integer'.
In CE6.5 doing FIRSTAdress.Value = 12.5 will throw 'is an invalid integer'.
In CE6.5 doing FIRSTAdress.Value = '12.5' will throw 'is an invalid integer'.
4bytes do not accept values with fractions.
Value field is a string, when assigning a value, Lua will convert that value to a string. In this case 12.0 to '12.0'.
solution:
you have to use math.floor:
Code: | FIRSTAdress.Value = math.floor(FIRSTAdress.Value-8) |
_________________
Last edited by mgr.inz.Player on Thu Jan 21, 2016 4:33 am; edited 2 times in total |
|
Back to top |
|
|
AntonVitalievich How do I cheat? Reputation: 0
Joined: 21 Jan 2016 Posts: 6
|
Posted: Thu Jan 21, 2016 4:31 am Post subject: |
|
|
Understand
It couse CE now have new version of Lua which work some another way
Thanks
With this now work
Code: | FIRSTAdress.Value = math.floor(FIRSTAdress.Value-8) |
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Thu Jan 21, 2016 4:43 am Post subject: |
|
|
Yes. I had that problem with previous CE versions (6.2-6.4).
I was making more advanced calculations:
Code: | newValue = {calculations here}
memoryRecord.Value = math.floor(newValue) |
(value type is an integer type: 2bytes, 4bytes, 8bytes)
About the fix DB wrote.
In CE6.4 those are possible:
label.Top = 34.8
writeInteger(address,56.4)
34.8 will be truncated to 34
56.4 will be truncated to 56
Initial CE6.5 release has a bug (or, Lua new feature). That feature truncated all values with fractions to zero.
Now, in recent CE6.5 (with fixes) this is no longer an issue.
Edit:
typos
_________________
Last edited by mgr.inz.Player on Thu Jan 21, 2016 5:04 am; edited 2 times in total |
|
Back to top |
|
|
AntonVitalievich How do I cheat? Reputation: 0
Joined: 21 Jan 2016 Posts: 6
|
Posted: Thu Jan 21, 2016 4:58 am Post subject: |
|
|
CE 6.5 which i used when test first script, i downlowd today from
this site, green button. Without language pack.
|
|
Back to top |
|
|
AntonVitalievich How do I cheat? Reputation: 0
Joined: 21 Jan 2016 Posts: 6
|
Posted: Fri Jan 22, 2016 2:00 am Post subject: |
|
|
Hello again
Some problem yet with Lua
I try to use script
Code: | al = getAddressList()
FIRSTAdress = al.getMemoryRecordByDescription("FIRSTAdress")
function fordownderone()
if FIRSTAdress.Value>"8" then
FIRSTAdress.Value=math.floor(FIRSTAdress.Value-8)
end
end
createHotkey("fordownderone", VK_DOWN) |
I want made protect for value. Want decrease value but not under 0
couse 4 bytes when was under 0 - was aboue 4294967272
But script not want work
If i set value 88 and then press 2 time hotkey - value was 80 and then 72 and then i press third time and not happend, it stop on 72
*************************************
And tryed this version of script
Code: | al = getAddressList()
FIRSTAdress = al.getMemoryRecordByDescription("FIRSTAdress")
function fordownderone()
if FIRSTAdress.Value>"8" then
FIRSTAdress.Value=math.floor(FIRSTAdress.Value-1)
end
end
createHotkey("fordownderone", VK_DOWN) |
Value decrease only when i set value to 99. And it stoped on 79. If i set 100 - not want decrease, only when i set 99. But it stoped decrease on 79
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Fri Jan 22, 2016 5:59 am Post subject: |
|
|
How many times you executed this script?
createHotkey creates an object every time you click "execute script". If you have five, it will call function 5 times per button press.
to prevent this, you have to this:
Code: | if myHotkey==nil then myHotkey=createHotkey("fordownderone", VK_DOWN) end |
It will create hotkey only once.
Or this:
Code: | if myHotkey~=nil and myHotkey.destroy then myHotkey.destroy() end
myHotkey=createHotkey("fordownderone", VK_DOWN) |
It will recreate hotkey. (delete existing, add new)
_________________
|
|
Back to top |
|
|
AntonVitalievich How do I cheat? Reputation: 0
Joined: 21 Jan 2016 Posts: 6
|
Posted: Fri Jan 22, 2016 7:07 am Post subject: |
|
|
Yes i activate/existing script only one time
And if i made some changes in script i always close CE and again open and when if CE ask meaboute start old lua project script - i set no. Then i copy past new scipt in lua (with new chenges)and then press existing
6.4 version cant too decrease 4 byte value
with this
Code: | if FIRSTAdress.Value>"8" then |
withoute it string in script all fine all work
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Fri Jan 22, 2016 3:59 pm Post subject: |
|
|
That line..... I see.
It is because you compare string with string.
Thy this instead:
Code: | if tonumber(FIRSTAdress.Value) > 8 then |
_________________
|
|
Back to top |
|
|
AntonVitalievich How do I cheat? Reputation: 0
Joined: 21 Jan 2016 Posts: 6
|
Posted: Sat Jan 23, 2016 12:38 am Post subject: |
|
|
Now work with
Code: | if tonumber(FIRSTAdress.Value) > 8 then |
Thanks mgr.inz.Player.
|
|
Back to top |
|
|
|