Page 1 of 1

Question: Read value then Speak

Posted: Sun Mar 17, 2024 2:49 pm
by Blackrosemmt
Hi all

I need lua script to read value from address then speak it once it reach the value I specify.
for example once money in game reach 100 then speak "hundred"

Can anyone please help.

Re: Question: Read value then Speak

Posted: Mon Apr 15, 2024 12:33 pm
by imjustmaxie
Assuming money is 4 bytes type:

if readInteger(address) == 100 then speak(“hundred”) end

Re: Question: Read value then Speak

Posted: Mon Apr 15, 2024 1:58 pm
by S1N74X
Blackrosemmt wrote:
Sun Mar 17, 2024 2:49 pm
Hi all

I need lua script to read value from address then speak it once it reach the value I specify.
for example once money in game reach 100 then speak "hundred"

Can anyone please help.
Hope that helps
Spoiler

Code: Select all

{$lua}
if syntaxcheck then return end
[ENABLE]

runTimer = true

local interval = 5000
local addressToRead = 0xDEADBEEF -- replace with your Money Address
local valToCheck = 100

local function ReadAddress()
local addressResult = readInteger(addressToRead)
if type(addressResult) == 'number' and addressResult >= valToCheck then
speakEnglish(tostring(addressResult),true)
end
end


local timer = createTimer(GetMainForm(true))
timer.Interval = interval
timer.OnTimer = function()
if runTimer ~= true then
timer.Destroy()
timer = nil
end
ReadAddress()
end


[DISABLE]
runTimer = nil