Posted: Sat Jun 14, 2025 11:21 am Post subject: How do I LUA read a value and write a value?
I want to write a script where it takes a hotkey and then switches on a specific code where it reads a value and writes a new value when pressing the hotkey again.
1. Press hotkey; read values.
2. Press hotkey; does math to values and writes new values.
Is this how LUA works in CE? I have never understood how to use LUA in CE. _________________
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."
Isn't it easier to download the found address to the address list, select it, press enter and change the value?
If you want to test the value and change with Lua, here is some code to get you started.
Run the code (CE Lua Script >> Execute),
Press F4,
Type the address whose value you want to change in the opened dialog box and confirm.
Press F4 again,
Read the value and type the new value in the box and confirm.
To add another address, just put "-" (dash symbol) in the box and confirm.
Press F4 again and type the new address.
Code:
local addr = ""
local opt = 1
function addAddresses()
local res = ""
local str=inputQuery('Add Address!','Write: Address..', res)
if str then
addr = getAddress(str)
opt = 2
end
end
function readWriteValue()
if addr=="" then
addAddresses()
else
local val = readInteger(addr) or "?" or nil
local res = ""
local str=inputQuery('Replace Value',"Address: "..addr.."\nValue: "..val.."\n********************\n(Reset Address, write: -\nWrite: New value..", res)
if str then
if str=="-" then
addr=""
opt = 1
else
writeInteger(addr, str)
end
end
end
end
function startKey()
sleep(150)
if opt==1 then
addAddresses()
else
readWriteValue()
end
end
-- keys:
if addrKey1 then addrKey1.Destroy() addrKey1=nil end
addrKey1=createHotkey(startKey, VK_F4)
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