View previous topic :: View next topic |
Author |
Message |
!BEWARE! !BEWARE! Deletes post on answer Reputation: 0
Joined: 26 Jun 2013 Posts: 56 Location: !BEWARE!
|
Posted: Wed Sep 21, 2022 6:07 am Post subject: supervision a value and auto change it |
|
|
Hello
I need simple script (if possible not in lua) to supervision value in address.
Every time when value will change to 20, I wanna swap it to 100 automatically.
Address is Float type and value is display in this form -> XX.XXXXXXXX
All digits after dot are useless.
Also necessary there is hotkey to turn on & off script
_________________
!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE! |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 31
Joined: 16 Feb 2017 Posts: 1234
|
Posted: Wed Sep 21, 2022 7:14 am Post subject: |
|
|
Why not lua?
Here is a script:
------------------
Edit the address in the code. (myAddress)
After activating the script, click the "F8" key to run or stop it. (or replace it).
------------------
Code: | [ENABLE]
{$lua}
if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
cycleTimer=createTimer() cycleTimer.Interval=100 cycleTimer.Enabled=false
myAddress = "0x0DE08BE8" --your address! ?
function checkValue()---
if readFloat(myAddress)<21 then --"<" = If less than 20.. "==" = if 20..
writeFloat(myAddress,100)
--else
--print(readFloat(myAddress))
end
end
cycleTimer.OnTimer = checkValue
if ExitKey then ExitKey.Destroy() ExitKey=nil end
-- check open-close key (F8)
ExitKey = createHotkey((function()
sleep(200)
if cycleTimer.Enabled==false then
cycleTimer.Enabled=true
else
cycleTimer.Enabled=false
end
end), VK_F8)
{$asm}
[DISABLE]
{$lua}
if ExitKey then ExitKey.Destroy() ExitKey=nil end
if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
|
_________________
|
|
Back to top |
|
|
!BEWARE! !BEWARE! Deletes post on answer Reputation: 0
Joined: 26 Jun 2013 Posts: 56 Location: !BEWARE!
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 31
Joined: 16 Feb 2017 Posts: 1234
|
Posted: Wed Sep 21, 2022 9:20 am Post subject: |
|
|
Where are you using the code?
Cheat Table Lua Script?
Address List Script?
The code is set for the address list. Create an asm script, delete the contents and paste the existing code.
If you were to use it in a Lua table it would be:
Code: |
if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
cycleTimer=createTimer() cycleTimer.Interval=100 cycleTimer.Enabled=false
myAddress = "0x0DE08BE8" --your address! ?
function checkValue()---
if readFloat(myAddress)<21 then --"<" = If less than 20.. "==" = if 20..
writeFloat(myAddress,100)
--else
--print(readFloat(myAddress))
end
end
cycleTimer.OnTimer = checkValue
if ExitKey then ExitKey.Destroy() ExitKey=nil end
-- check open-close key (F8)
ExitKey = createHotkey((function()
sleep(200)
if cycleTimer.Enabled==false then
cycleTimer.Enabled=true
else
cycleTimer.Enabled=false
end
end), VK_F8) |
_________________
|
|
Back to top |
|
|
!BEWARE! !BEWARE! Deletes post on answer Reputation: 0
Joined: 26 Jun 2013 Posts: 56 Location: !BEWARE!
|
Posted: Wed Sep 21, 2022 9:52 am Post subject: |
|
|
sorry, i thought you made first script to lua.
I put it to Auto Assemble but cant make it run.
Your second script in lua working fine.
Edit.
At this moment testing it in lua. I changed "<" to "==" but then script cant catch value. Probably because there are digits after dot.
I never get clean 20 value.
One time its 20.59763
Next time is 20.19385
_________________
!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE! |
|
Back to top |
|
|
cooleko Grandmaster Cheater Reputation: 11
Joined: 04 May 2016 Posts: 717
|
|
Back to top |
|
|
!BEWARE! !BEWARE! Deletes post on answer Reputation: 0
Joined: 26 Jun 2013 Posts: 56 Location: !BEWARE!
|
|
Back to top |
|
|
cooleko Grandmaster Cheater Reputation: 11
Joined: 04 May 2016 Posts: 717
|
Posted: Wed Sep 21, 2022 11:52 am Post subject: |
|
|
That is fine, you still use the address, but you need to update the logic on what to do with it. You can convert it to bytes and compare the bytes or keep it as a float and compare the float twice.
Just store your float in a variable and use two logic checks in your code on the variable. If you don't mind reading twice, you can skip the variable but your value may change in between the two logic checks if you read twice.
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 31
Joined: 16 Feb 2017 Posts: 1234
|
Posted: Wed Sep 21, 2022 4:46 pm Post subject: |
|
|
Code: | function checkValue()---
if readFloat(myAddress)<21 then --"<" = If less than 20.. "==" = if 20..
writeFloat(myAddress,100)
--else
--print(readFloat(myAddress))
end
end |
Change:
Code: | function checkValue()
myValue = math.floor(readFloat(myAddress))
if myValue == 20 then
writeFloat(myAddress,100)
--else
--print(math.floor(readFloat(myAddress)))
end
end |
_________________
|
|
Back to top |
|
|
!BEWARE! !BEWARE! Deletes post on answer Reputation: 0
Joined: 26 Jun 2013 Posts: 56 Location: !BEWARE!
|
|
Back to top |
|
|
cooleko Grandmaster Cheater Reputation: 11
Joined: 04 May 2016 Posts: 717
|
Posted: Thu Sep 22, 2022 10:47 am Post subject: |
|
|
!BEWARE! wrote: | @AylinCE - Thanks, its solved problem
@cooleko - So bytes from 701527F8 would be this? :
0x70
0x15
0x27
0xF8
I dont get how to put it to "myAddress". Sadly i dont understand programming language :cry: |
You wouldnt break up your address, that was for the floating point value. However, your breakdown from 4 bytes into a sequence of bytes is correct unless you are dealing with big-endian which reverses the order.
In our case, a floating point 20 is represented with the bytes provided above. I like this for getting byte values.
You can see that the value 20 is all values between 0x41A0 and 0x41A7, so you could detect the value 20 by ignoring the last 2 bytes of the mantissa and just comparing the first two.
I googled flooring a float in cheat engine which is how I got the link above telling someone to use bytes. Since CE now allows using math.floor, it is the better way of doing it!
|
|
Back to top |
|
|
!BEWARE! !BEWARE! Deletes post on answer Reputation: 0
Joined: 26 Jun 2013 Posts: 56 Location: !BEWARE!
|
Posted: Sat Dec 17, 2022 5:37 am Post subject: |
|
|
Im using script in this form to till day, but need update.
-currently Numpad9 loop timer from 31 to 60
But need two additional keys:
-Numpad 7 to loop timer from 1 to 60
and
-Numpad 8 to disable script
(numpad7 and 9 only to turn on script)
Code: | if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
cycleTimer=createTimer() cycleTimer.Interval=500 cycleTimer.Enabled=false
myAddress = "0x701527F8" --your address! ?
function checkValue()
myValue = math.floor(readFloat(myAddress))
if myValue == 31 then
writeFloat(myAddress,60)
--else
--print(math.floor(readFloat(myAddress)))
end
end
cycleTimer.OnTimer = checkValue
if ExitKey then ExitKey.Destroy() ExitKey=nil end
-- check open-close key (F8)
ExitKey = createHotkey((function()
sleep(500)
if cycleTimer.Enabled==false then
cycleTimer.Enabled=true
else
cycleTimer.Enabled=false
end
end), VK_NUMPAD9) |
_________________
!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE! |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 31
Joined: 16 Feb 2017 Posts: 1234
|
Posted: Sat Dec 17, 2022 12:18 pm Post subject: |
|
|
Will 7 and 9 run at the same time?
If yes, you can test 1 and 31 in a single loop (eg 9).
Code: | if myValue == 31 or myValue == 1 then
writeFloat(myAddress,60) |
If no, use the same code (as in numped9.) change 1-31 to 1-60 and use a second timer. In one's working condition; Edit code that, when numped7 is clicked, stops the numped9 code and otherwise stops the numped7 timer.
It; Are the 7 and 9 timers likely to run at the same time?
numpad8 = Stop check (Timer) code:
Code: | if ExitKey8 then ExitKey8.Destroy() ExitKey8=nil end
ExitKey8 = createHotkey((function()
sleep(500)
cycleTimer.Enabled=false
end), VK_NUMPAD8) -- stop check |
Example code:
Code: | if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
cycleTimer=createTimer() cycleTimer.Interval=500 cycleTimer.Enabled=false
function prt7() --value 31-60 code func.
print("Active key: 7")
end
function prt9() -- value 1-60 code func.
print("Active key: 9")
end
if ExitKey7 then ExitKey7.Destroy() ExitKey7=nil end
if ExitKey8 then ExitKey8.Destroy() ExitKey8=nil end
if ExitKey9 then ExitKey9.Destroy() ExitKey9=nil end
ExitKey7 = createHotkey((function()
sleep(500)
cycleTimer.Enabled=false
cycleTimer.OnTimer = prt7
cycleTimer.Enabled=true
end),VK_F7)
ExitKey9 = createHotkey((function()
sleep(500)
cycleTimer.Enabled=false
cycleTimer.OnTimer = prt9
cycleTimer.Enabled=true
end),VK_F9)
ExitKey8 = createHotkey((function()
sleep(500)
cycleTimer.Enabled=false
print("Active keys: Stop!")
end),VK_F8) |
_________________
|
|
Back to top |
|
|
!BEWARE! !BEWARE! Deletes post on answer Reputation: 0
Joined: 26 Jun 2013 Posts: 56 Location: !BEWARE!
|
Posted: Sat Dec 17, 2022 4:52 pm Post subject: |
|
|
7 and 9 will not run at the same time.
If 7 is activated, pushing 9 cause disable 7 and turning on 9.
To turn off 7 or 9, have to be used 8
Not like before when 9 worked as ON>OFF>ON>OFF....
_________________
!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE! |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 31
Joined: 16 Feb 2017 Posts: 1234
|
Posted: Sat Dec 17, 2022 5:22 pm Post subject: |
|
|
Code: | if cycleTimer then cycleTimer.Destroy() cycleTimer=nil end
cycleTimer=createTimer() cycleTimer.Interval=500 cycleTimer.Enabled=false
myAddress = "0x701527F8" --your address! ?
function checkValue9()
myValue = math.floor(readFloat(myAddress))
if myValue == 31 then
writeFloat(myAddress,60)
--else
--print(math.floor(readFloat(myAddress)))
end
end
function checkValue7()
myValue = math.floor(readFloat(myAddress))
if myValue == 1 then
writeFloat(myAddress,60)
--else
--print(math.floor(readFloat(myAddress)))
end
end
if ExitKey7 then ExitKey7.Destroy() ExitKey7=nil end
if ExitKey8 then ExitKey8.Destroy() ExitKey8=nil end
if ExitKey9 then ExitKey9.Destroy() ExitKey9=nil end
ExitKey7 = createHotkey((function()
sleep(500)
cycleTimer.Enabled=false
cycleTimer.OnTimer = checkValue7
cycleTimer.Enabled=true
end),VK_NUMPAD7)
ExitKey9 = createHotkey((function()
sleep(500)
cycleTimer.Enabled=false
cycleTimer.OnTimer = checkValue9
cycleTimer.Enabled=true
end),VK_NUMPAD9)
ExitKey8 = createHotkey((function()
sleep(500)
cycleTimer.Enabled=false
print("Active keys: Stop!")
end),VK_NUMPAD8) |
_________________
|
|
Back to top |
|
|
|