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 


Changing the value of an address

 
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: 577

PostPosted: Sat Oct 15, 2016 10:30 am    Post subject: Changing the value of an address Reply with quote

I'm attempting to learn the object language and I'm trying to set an addresses value.
Code:
  local AL = getAddressList();
   if tonumber(addresslist_getMemoryRecordByDescription(AL, "Battle Byte").Value) == 32 then
     addresslist_getMemoryRecordByDescription(AL, "After Battle Non Kill XP").Value = 1000
     addresslist_getMemoryRecordByDescription(AL, "After Battle AP").Value = 100
   end

The value of tonumber(addresslist_getMemoryRecordByDescription(AL, "Battle Byte").Value) is 32 as a print statement indicated.
But I get an error message when the other statements are executed.
Error:Invalid integer
What code changes do I need to the values?

EDIT: I was doing the checking with the debug window, now after commenting out the middles two statements I still get an invalid integer so the if statement is incorrect also.
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: Sat Oct 15, 2016 1:34 pm    Post subject: Reply with quote

I copied your code exactly how it is. Worked just fine. Your error is elsewhere.
Back to top
View user's profile Send private message
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Sun Oct 16, 2016 4:19 am    Post subject: Reply with quote

Yes, there was an incorrect reference earlier in the code producing a nil. Fixed that and it works, 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