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 


Syntax for object language

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

Joined: 08 Oct 2012
Posts: 586

PostPosted: Tue Nov 01, 2016 2:35 pm    Post subject: Syntax for object language Reply with quote

Code:

enemy1curhpaddress = addresslist_getMemoryRecordByDescription(addresslist, "Enemy 1 HP").Value
if tonumber(enemy1curhpaddress) >= 2 then
  enemy1curhpaddress.Value = 1--with many iterations and changes
end


So how does one set the address's value?
Back to top
View user's profile Send private message Yahoo Messenger
mgr.inz.Player
I post too much
Reputation: 222

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

PostPosted: Tue Nov 01, 2016 2:45 pm    Post subject: Reply with quote

{removed due to bknight2602's post below.}
_________________


Last edited by mgr.inz.Player on Tue Nov 01, 2016 3:14 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Tue Nov 01, 2016 2:50 pm    Post subject: Reply with quote

I didn't type it as I thought it, say the value in enemy1curhpaddress was 1527 and that the code seeing it greater than 2, sets the value at 1.
Back to top
View user's profile Send private message Yahoo Messenger
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Tue Nov 01, 2016 2:58 pm    Post subject: Reply with quote

Code:
enemy1curhpaddress = addresslist_getMemoryRecordByDescription(addresslist, "Enemy 1 HP")
if tonumber(enemy1curhpaddress.Value) >= 2 then
  enemy1curhpaddress.Value = 1--with many iterations and changes
end
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

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

PostPosted: Tue Nov 01, 2016 3:04 pm    Post subject: Reply with quote

Now I see, you mixed few things.

Old syntax with new syntax. Instead of
Code:
addresslist_getMemoryRecordByDescription(addresslist, "Enemy 1 HP")


Use
Code:
addresslist.getMemoryRecordByDescription("Enemy 1 HP")




You should use memrec object. Your code:
Code:
enemy1curhpaddress = addresslist.getMemoryRecordByDescription("Enemy 1 HP").Value


You probably wanted this:
Code:
enemy1curhpaddress = addresslist.getMemoryRecordByDescription("Enemy 1 HP")






Also, variable names are misleading. Whole script should be.
Code:
enemy1curhp = addresslist.getMemoryRecordByDescription("Enemy 1 HP")
if tonumber(enemy1curhp.Value) >= 2 then
  enemy1curhp.Value = 1
end






PS: if you use addresslist object to only find memrec by description. You can use something like this:
Code:
enemy1curhp = getTableEntry("Enemy 1 HP")
if tonumber(enemy1curhp.Value) >= 2 then
  enemy1curhp.Value = 1
end

_________________
Back to top
View user's profile Send private message MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Tue Nov 01, 2016 3:20 pm    Post subject: Reply with quote

Those changes worked first time.
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
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