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 


Code a table "Active" with a check and/or clear ch

 
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: Sun Apr 13, 2014 4:18 pm    Post subject: Code a table "Active" with a check and/or clear ch Reply with quote

I know it must be possible but I've no clue as to the code steps to either put a check in the "Active" box on cheat engine or clear one that may be there?

I know how to make a entry in the table constant, but that is not what I'm asking

So what would the code steps be?
Back to top
View user's profile Send private message Yahoo Messenger
mgr.inz.Player
I post too much
Reputation: 218

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

PostPosted: Sun Apr 13, 2014 6:06 pm    Post subject: Reply with quote

Active property of MemoryRecord Class.
Code:
Active: boolean - Set to true to activate/freeze, false to deactivate/unfreeze




Edit: Hmm, looks like main.lua (documentation file) is not complete. There are few memoryrecord class methods missing:
'getType'
'setType'
'getValue'
'setValue'
'getScript'
'setScript'
'getActive'
'setActive'
'getChild'
'isSelected'
'delete'
'getHotkeyCount'

_________________


Last edited by mgr.inz.Player on Sun Apr 13, 2014 6:16 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: 577

PostPosted: Sun Apr 13, 2014 6:12 pm    Post subject: Reply with quote

Like this?

AL = getAddressList()
boxtofreeze = addresslist_getMemoryRecordByDescription(AL, "Gold")
boxtofreeze.Status = True
Back to top
View user's profile Send private message Yahoo Messenger
mgr.inz.Player
I post too much
Reputation: 218

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

PostPosted: Sun Apr 13, 2014 6:18 pm    Post subject: Reply with quote

Like this:
Code:
AL = getAddressList()
boxtofreeze = AL.getMemoryRecordByDescription("Gold")
boxtofreeze.Active = true


Edit,
Also, I don't see "allow increase", "allow decrease" in new main.lua (from CE6.3)


so, if you want to freeze and allow increase, use this code
Code:
AL = getAddressList()
boxtofreeze = AL.getMemoryRecordByDescription("Gold")
memoryrecord_freeze(boxtofreeze, 1)



from main.lua from CE6.2:
Code:
memoryrecord_freeze(te, updownfreeze OPTIONAL): sets the entry to frozen state. updownfreeze is optional. 0=freeze, 1=allow increase, 2=allow decrease



(CE6.3 has almost all old functions from CE6.2)

_________________


Last edited by mgr.inz.Player on Mon Apr 14, 2014 2:27 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: 577

PostPosted: Sun Apr 13, 2014 6:34 pm    Post subject: Reply with quote

Oh the allow increase might be nice, I'll try that.
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Mon Apr 14, 2014 10:25 am    Post subject: Reply with quote

Using the 1 option the behavior was wildly erratic, increasing much more than the adds from battle/finds during the game.
If 0 sets the freeze what code would unset it---after being set?
Back to top
View user's profile Send private message Yahoo Messenger
mgr.inz.Player
I post too much
Reputation: 218

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

PostPosted: Mon Apr 14, 2014 10:29 am    Post subject: Reply with quote

bknight2602 wrote:
If 0 sets the freeze what code would unset it---after being set?



Code:
boxtofreeze.Active = False


or

Code:
memoryrecord_unfreeze(boxtofreeze)

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

Joined: 08 Oct 2012
Posts: 577

PostPosted: Mon Apr 14, 2014 11:00 am    Post subject: Reply with quote

duh, of course.
thanks
Back to top
View user's profile Send private message Yahoo Messenger
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Mon Apr 14, 2014 12:44 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
bknight2602 wrote:
If 0 sets the freeze what code would unset it---after being set?



Code:
boxtofreeze.Active = False


or

Code:
memoryrecord_unfreeze(boxtofreeze)

It should be false, since False seems to lua as variable, and it holds value nil (since it never been defined).

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private 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: Mon Apr 14, 2014 2:24 pm    Post subject: Reply with quote

@DaSpamer, thats correct.


If look at memoryrecord_setActive function inside LuaMemoryRecord.pas, you will see
Code:
function memoryrecord_setActive(L: PLua_State): integer; cdecl;
var
  memrec: TMemoryRecord;
begin
  result:=0;
  memrec:=luaclass_getClassObject(L);

  if lua_gettop(L)>=1 then
    memrec.active:=lua_toboolean(L, 1);
end;


lua_toboolean function should convert nil to false.





But this won't work as expected (True is a non initialized variable):
Code:
boxtofreeze.Active = True



It is better to not mix False,false,True,true

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

Joined: 08 Oct 2012
Posts: 577

PostPosted: Mon Apr 14, 2014 2:35 pm    Post subject: Reply with quote

Both appear to work in 9.3
Back to top
View user's profile Send private message Yahoo Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Tue Apr 15, 2014 11:05 am    Post subject: Reply with quote

DaSpamer here is the file.


HEROES3_63.CT
 Description:

Download
 Filename:  HEROES3_63.CT
 Filesize:  1.43 MB
 Downloaded:  1153 Time(s)

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