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 (select and) copy all values on the list?

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

Joined: 27 Jul 2008
Posts: 51

PostPosted: Fri Jul 14, 2017 12:28 pm    Post subject: How to (select and) copy all values on the list? Reply with quote

I saw that i can use lua script for selecting values but i don't know anything about this. Please, give me step-by-step instructions. I have CE 6.6.


copythis.png
 Description:
 Filesize:  11.06 KB
 Viewed:  6904 Time(s)

copythis.png


Back to top
View user's profile Send private message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 54

Joined: 06 Jul 2014
Posts: 1815
Location: Arcadian Suburbia

PostPosted: Fri Jul 14, 2017 1:00 pm    Post subject: Reply with quote

Code:
local al = getAddressList()
local vals = {}
for i=0, al.Count-1 do
  vals[#vals+1] = al[i].Value
end
writeToClipboard(table.concat(vals,'\n'))

_________________
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
tedomedo
Advanced Cheater
Reputation: 0

Joined: 27 Jul 2008
Posts: 51

PostPosted: Fri Jul 28, 2017 3:34 pm    Post subject: Reply with quote

Thanks for this.
Another wish about this: can values be copied automatically after any value's change?
Back to top
View user's profile Send private message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 54

Joined: 06 Jul 2014
Posts: 1815
Location: Arcadian Suburbia

PostPosted: Fri Jul 28, 2017 3:51 pm    Post subject: Reply with quote

If you still want it copied to the clipboard, you could put that code in a timer and have it run periodically.
Code:
t = createTimer()
t.Interval = 500
t.OnTimer = function(t)
  -- code here
end

_________________
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
tedomedo
Advanced Cheater
Reputation: 0

Joined: 27 Jul 2008
Posts: 51

PostPosted: Sat Jul 29, 2017 5:55 am    Post subject: Reply with quote

Thanks a lot. Now weird question: Is there a code to see sum of all values?
Back to top
View user's profile Send private message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 54

Joined: 06 Jul 2014
Posts: 1815
Location: Arcadian Suburbia

PostPosted: Sat Jul 29, 2017 9:29 am    Post subject: Reply with quote

Code:
local al = getAddressList()
local total = 0
for i=0, al.Count-1 do
  total = total + (tonumber(al[i].Value) or 0)
end
print('total:',total)

_________________
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
tedomedo
Advanced Cheater
Reputation: 0

Joined: 27 Jul 2008
Posts: 51

PostPosted: Sat Jul 29, 2017 5:13 pm    Post subject: Reply with quote

I bet i'm boring you, cause i have another noob question: how can i disable timer? I tried with interval 60000 but i can't copy something outside the game, when i paste, i get values from the game. I tried with timer_setEnabled(t, false) but i noob don't know where (between lines) should i place this command.
Back to top
View user's profile Send private message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 54

Joined: 06 Jul 2014
Posts: 1815
Location: Arcadian Suburbia

PostPosted: Sat Jul 29, 2017 5:36 pm    Post subject: Reply with quote

Code:
t.Enabled = false

I don't know where you want to put it either. If you just want to execute it, paste it in the Lua engine window (Ctrl + Alt + Shift + L, or memory view -> tools -> Lua engine) and click on the "Execute" button.


Take note that if you execute the script that creates the timer more than once, you'll have multiple timers running in the background. If you don't want multiple timers, destroy the previous timer if it exists:
Code:
if t then t.destroy() end
t = createTimer()
...

_________________
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
tedomedo
Advanced Cheater
Reputation: 0

Joined: 27 Jul 2008
Posts: 51

PostPosted: Sun Jul 30, 2017 3:06 am    Post subject: Reply with quote

I tried this:

Code:
if t then t.destroy() end
t = createTimer()
t.Interval = 1000
t.OnTimer = function(t)
local al = getAddressList()
local vals = {}
for i=0, al.Count-1 do
  vals[#vals+1] = al[i].Value
end
writeToClipboard(table.concat(vals,'\n'))
end


But i still can't copy and paste something else.
How can i destroy all timers in background and stop script instantly?
Back to top
View user's profile Send private message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 54

Joined: 06 Jul 2014
Posts: 1815
Location: Arcadian Suburbia

PostPosted: Sun Jul 30, 2017 8:39 am    Post subject: Reply with quote

Restart CE.

If you want a hotkey to enable / disable the timer, you can use this:
Code:
if hk then hk.destroy() end
hk = createHotkey(function() t.Enabled = not t.Enabled end, VK_CONTROL, VK_SHIFT, VK_C)

Copy and paste this code after the timer code, and change the hotkeys to whatever you want (look in defines.lua in the main CE directory for VK_ keycodes).

_________________
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
mgr.inz.Player
I post too much
Reputation: 148

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

PostPosted: Tue Aug 01, 2017 10:28 am    Post subject: Reply with quote

@ParkourPenguin, do not forget to nil variables when destroying objects.
Code:
if hk then hk.destroy(); hk=nil end

_________________
Back to top
View user's profile Send private message MSN Messenger
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 54

Joined: 06 Jul 2014
Posts: 1815
Location: Arcadian Suburbia

PostPosted: Tue Aug 01, 2017 10:47 am    Post subject: Reply with quote

A new userdata object is assigned just after the old one is destroyed. What more does assigning nil to the variable do?
_________________
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
mgr.inz.Player
I post too much
Reputation: 148

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

PostPosted: Wed Aug 02, 2017 7:20 am    Post subject: Reply with quote

It's a good habit to nil Lua variables which had lightuserdata or heavyuserdata, after calling destroy method.

Especially for global Lua variables.

_________________
Back to top
View user's profile Send private message MSN Messenger
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 54

Joined: 06 Jul 2014
Posts: 1815
Location: Arcadian Suburbia

PostPosted: Wed Aug 02, 2017 2:30 pm    Post subject: Reply with quote

It's as good of a habit as assigning null to deleted pointers. Unless something happens between the call to destroy and the assignment of the new userdata in my example, assigning nil seems to be little more than a formality.

I was more concerned with memory leak. If it's light userdata, it's not Lua's job to clean anything up, so assigning nil won't do anything. If it's full userdata, the reference count to the destroyed object is decremented when anything else is assigned to the variable- whether it's nil or new userdata doesn't matter. I can see several obvious problems if I didn't assign anything new to it, but assigning nil seems unnecessary in this case.

This isn't a significant and/or formal project- it's a short example script. As long as it doesn't fail in some way (e.g. memory leak), I don't mind ignoring formalities.

_________________
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