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 Unequal Lua compare Does NOT Work

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Fri Feb 16, 2018 2:50 pm    Post subject: Reply with quote

Learn to use some code debugging techniques.

Example, change it to this (timer interval set to 5000 so you won't get spammed with debug messages too much):
Code:
function ifNotModel(sender)

  local modelValue = readInteger(Model)
  local model2Value = readInteger(Model2)

  print(string.format('model1: %08x   model2: %08x', modelValue, model2Value))

  if modelValue~=0x00300035 and model2Value~=0x00300033 then
    print('MemoryRecord 1337018732 deactivate')
    AddressList.getMemoryRecordByID(1337018732).Active = false
  end

  if modelValue~=0x00300035 and model2Value~=0x00300031 then
    print('MemoryRecord 1337018733 deactivate')
    AddressList.getMemoryRecordByID(1337018733).Active = false 
  end
end

tcupf2=createTimer(nil, true)
timer_onTimer(tcupf2, ifNotModel)
timer_setInterval(tcupf2, 5000)

_________________
Back to top
View user's profile Send private message MSN Messenger
Meiyoh
Master Cheater
Reputation: 1

Joined: 14 Mar 2015
Posts: 400

PostPosted: Fri Feb 16, 2018 3:10 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
Learn to use some code debugging techniques.

Example, change it to this (timer interval set to 5000 so you won't get spammed with debug messages too much):
Code:
function ifNotModel(sender)

  local modelValue = readInteger(Model)
  local model2Value = readInteger(Model2)

  print(string.format('model1: %08x   model2: %08x', modelValue, model2Value))

  if modelValue~=0x00300035 and model2Value~=0x00300033 then
    print('MemoryRecord 1337018732 deactivate')
    AddressList.getMemoryRecordByID(1337018732).Active = false
  end

  if modelValue~=0x00300035 and model2Value~=0x00300031 then
    print('MemoryRecord 1337018733 deactivate')
    AddressList.getMemoryRecordByID(1337018733).Active = false 
  end
end

tcupf2=createTimer(nil, true)
timer_onTimer(tcupf2, ifNotModel)
timer_setInterval(tcupf2, 5000)


model1: 00310035 model2: 00300031
MemoryRecord 1337018732 deactivate
model1: 00310035 model2: 00300031
MemoryRecord 1337018732 deactivate
model1: 00310035 model2: 00300031
MemoryRecord 1337018732 deactivate
model1: 00310035 model2: 00300031
MemoryRecord 1337018732 deactivate
model1: 00310035 model2: 00300031
MemoryRecord 1337018732 deactivate
model1: 00310035 model2: 00300031
MemoryRecord 1337018732 deactivate
model1: 00310035 model2: 00300031
MemoryRecord 1337018732 deactivate
model1: 00310035 model2: 00300031
MemoryRecord 1337018732 deactivate
model1: 00310035 model2: 00300031
MemoryRecord 1337018732 deactivate
model1: 00310035 model2: 00300031
MemoryRecord 1337018732 deactivate
model1: 00310035 model2: 00300031
MemoryRecord 1337018732 deactivate

Seems to work. I wonder what caused it to skip at first...

_________________
I am the forgotten one the dead one.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Fri Feb 16, 2018 3:13 pm    Post subject: Reply with quote

Meiyoh wrote:
The fix is to make compare to if EQUAL to... then Put ELSE condition after

That's using different logic.

Code:
a == 1 and b == 2
This expression is the same as:
Code:
not (a ~= 1 or b ~= 2)
But not the one you're trying to use:
Code:
not (a ~= 1 and b ~= 2)

If you don't understand why, drawing truth tables can help.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
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 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