Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


if the value changing statement

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
HyberCode
Cheater
Reputation: 0

Joined: 17 Feb 2016
Posts: 40

PostPosted: Thu Aug 18, 2016 11:50 am    Post subject: if the value changing statement Reply with quote

hello
so i want to do if statement in my trainer if the value changing then don't add it to saved addresses ... else add it so i can use later

Code:
for i in pairs(MyCoordAddresses) do
   if readFloat(i,thevalueischanging) then
           don't add it
    else
         add it
    end


ofc i want it in for loop so i check in every value Smile
i hope i get good answer , thanks
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Aug 18, 2016 11:55 am    Post subject: Reply with quote

Code:
for i,v in pairs(MyCoordAddresses) do
  if readFloat(i) == v then
    -- add it
  else
    -- don't add it
  end
end
Back to top
View user's profile Send private message
HyberCode
Cheater
Reputation: 0

Joined: 17 Feb 2016
Posts: 40

PostPosted: Thu Aug 18, 2016 12:17 pm    Post subject: Reply with quote

Zanzer wrote:
Code:
for i,v in pairs(MyCoordAddresses) do
  if readFloat(i) == v then
    -- add it
  else
    -- don't add it
  end
end

great but how can i give (v) an address from the debugger
or
simply any value that in the debugger does change don't add it
else
add it
sorry and thank you
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Aug 18, 2016 1:56 pm    Post subject: Reply with quote

Code:
saved_addresses = {}
debug_setBreakpoint(0x12345678, 1, bptExecute, function()
  local address = ECX
  local value = saved_addresses[address]
  if value == nil then
    saved_addresses[address] = readInteger(address)
  else
    if value ~= false then
      local new_value = readInteger(address)
      if value ~= new_value then
        saved_addresses[address] = false
      end
    end
  end
  return 1
end)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites