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 


how to use addresslist as variable for lua script

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

Joined: 24 May 2015
Posts: 49

PostPosted: Sun Jul 17, 2016 9:39 pm    Post subject: how to use addresslist as variable for lua script Reply with quote

I want to have memrec entry that specific to be used as variable only.
Not refreshed

So i can use it as variable to my lua script only.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Jul 17, 2016 9:43 pm    Post subject: Reply with quote

Code:
[ENABLE]
alloc(myvar,8)
registersymbol(myvar)
[DISABLE]
unregistersymbol(myvar)
dealloc(myvar)
Back to top
View user's profile Send private message
WndDrgn
Cheater
Reputation: 0

Joined: 24 May 2015
Posts: 49

PostPosted: Sun Jul 17, 2016 11:01 pm    Post subject: Reply with quote

Zanzer wrote:
Code:
[ENABLE]
alloc(myvar,8)
registersymbol(myvar)
[DISABLE]
unregistersymbol(myvar)
dealloc(myvar)


thank you.

But that still affected by target process when disable.

What i need is to use value in record in addresslist, only as variable to my lua script. Not affect to target process when activated, or affected by target process when deactivated.

So i can change value, without build any form.
Just directly manipulate value or status in addresslist from ce.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Jul 17, 2016 11:09 pm    Post subject: Reply with quote

So remove the code under [DISABLE]?

You know you use the following in your Lua to get the value of that variable:
Code:
readInteger("myvar")


Not sure what you want.

Code:
myvar = "value"

Now you can use myvar in your Lua...

You can save it to disk and reload it the next time you open your table.
Back to top
View user's profile Send private message
WndDrgn
Cheater
Reputation: 0

Joined: 24 May 2015
Posts: 49

PostPosted: Sun Jul 17, 2016 11:36 pm    Post subject: Reply with quote

Sorry for my english.


When we add record to addresslist in ce, we use "Add Address Manually".
That rec, will refreshed at some interval that set in setting.

What i need is a record that have no relation to target process.
So it is not refreshed every time by target process.
Nor it will write to target process memory when we activate it.

So i can use it as variable to my lua script.

Below is ct file when we add a record with name "Test"

Code:

<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="18">
  <CheatEntries>
    <CheatEntry>
      <ID>0</ID>
      <Description>"Test"</Description>
      <Color>80000008</Color>
      <VariableType>Byte</VariableType>
      <Address>005AFF18</Address>
    </CheatEntry>
  </CheatEntries>
</CheatTable>


I want that record named "Test" is not refreshed when value in memory of target process are changed.
Even though the status is not freeze.

How i can do that?

Offcourse i can always change ce source to disable refresh-value process
But i think it is not appropriate.
When i can do it in script, why i need to edit the ce source, right?
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Jul 18, 2016 6:35 pm    Post subject: Reply with quote

Then my first script sounds like what you need.
You have to attach CE to the game and then you can enable that script.
Once enabled, you can Add Address Manually and give the entry an address of "myvar" without quotes.
The game will never touch that address, only the CE user and your other scripts can change it.

Code:
<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
  <CheatEntries>
    <CheatEntry>
      <ID>0</ID>
      <Description>"Create Variable "myvar""</Description>
      <LastState Activated="1"/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]
alloc(myvar,8)
registersymbol(myvar)
[DISABLE]
dealloc(myvar)
unregistersymbol(myvar)
</AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <ID>1</ID>
          <Description>"myvar"</Description>
          <LastState Value="0"/>
          <VariableType>4 Bytes</VariableType>
          <Address>myvar</Address>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
</CheatTable>
Back to top
View user's profile Send private message
WndDrgn
Cheater
Reputation: 0

Joined: 24 May 2015
Posts: 49

PostPosted: Tue Jul 19, 2016 8:24 am    Post subject: Reply with quote

Zanzer wrote:
Then my first script sounds like what you need.
You have to attach CE to the game and then you can enable that script.
Once enabled, you can Add Address Manually and give the entry an address of "myvar" without quotes.
The game will never touch that address, only the CE user and your other scripts can change it.


Yes, that is what i need.

Thank you Very Happy
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