Posted: Sun Feb 02, 2020 1:13 pm Post subject: Specified lua script
Hi,
Can somebody help me with lua script that will auto set some values when they will restart or will not be set to the right values?
Here is how it looks in cheat engine:
first photo
Only thing i want to change in last one Value(this one with two queston marks). By default it is 100 I'm setting it to 1000 and after some time it gets back to 100.
so if I got it right you want to set the value to 100 as soon as it has became a valid address? (like not ??).
Code:
healthUpdate = healthUpdate or createTimer();
healthUpdate.interval = 200; --check every 0.2 sec
healthUpdate.tag = 0; -- we use this to tell if the address is '??' or not;
healthRecord = getAddressList().getMemoryRecordByDescription('Health'); -- get the memoryRecord
healthUpdate.onTimer = function(sender)
if (healthRecord.value == '??') then -- check if we should update it as soon as it is available;
sender.tag = 1;
end
if (sender.tag == 1 and healthRecord.Value ~= '??') then -- if we detected that it was invalid and now its value is valid;
sender.tag = 0; -- wait for the next time 'Health' memory record becomes '??'
healthRecord.Value = 1000;
print('updated health value..');
end
end
or do you wish to set the value constantly to 1000?
Code:
healthUpdate = healthUpdate or createTimer();
healthUpdate.interval = 200; --check every 0.2 sec
healthRecord = getAddressList().getMemoryRecordByDescription('Health'); -- get the memoryRecord
healthUpdate.onTimer = function(sender)
local value = healthRecord.value
if (tonumber(value) and tonumber(value) ~= 1000)) then -- try to cast it to number and check if it has changed from default value;
healthRecord.Value = 1000;
print('updated health value..');
end
end
_________________
I'm rusty and getting older, help me re-learn lua.
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