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 


Scan value type double throu combobox

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

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Nov 08, 2015 12:06 am    Post subject: Scan value type double throu combobox Reply with quote

Hi guys,

I tried to do this as shown below, but not work :

Code:

function findDoubleValueAndReplace(findValue, replaceWith)
  memscan = createMemScan()
  foundlist = createFoundList(memscan)
  protectionflags = "-W*X-C"
  memscan.firstScan(soExactValue, vtDouble, rtTruncated, findValue, nil,
               "0","7fffffff",protectionflags,
               fsmAligned,"4",
               false, false, false, false)
  memscan.waitTillDone()
  foundlist.initialize()
  for i=0,foundlist.Count-1 do
   fullAccess(  getAddress(foundlist.Address[i])  , 8)
   writeDouble(  foundlist.Address[i], replaceWith)
  end
  sleep(50)
  foundlist.destroy()
  sleep(50)
  memscan.destroy()
end
------
items = combobox_getItems(MyForm.cbbox)
strings_add(items, "Idle...")
MyForm.cbbox.ItemIndex = 0

tbl_array = {
{IndexNo="16777215",IdName="Code1"},
{IndexNo="1110100",IdName="Code2"},
}

for i,v in ipairs(tbl_array) do
  strings_add(items, v.IdName)
end

---
function cbboxOnChange()
 index = getProperty(MyForm.cbbox, "ItemIndex")
 index = tbl_array[index]
 if index == nil or MyForm.cbbox.ItemIndex == 0 then
  MyForm.cbbox.ItemIndex = 0 end
 if index == 1 then
  scandbl = tonumber(index.IndexNo)
  findDoubleValueAndReplace(scndbl, 16777215) end
 if index == 2 then
  scandbl = tonumber(index.IndexNo)
  findDoubleValueAndReplace(scndbl, 78005020) end
end
setMethodProperty(MyForm.cbbox, "OnChange", cbboxOnChange)


Any solution ?. Thanks in advance

Regard
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 941

PostPosted: Sun Nov 08, 2015 1:20 am    Post subject: Reply with quote

Most ce userdata's collection data return zero-based index.
May try:
Code:
index = tbl_array[index+1]


<oops, ignore above, I overlook you've a item before insert tbl_array element into the stringlist>

...but then index now is an entry of tbl_array which is also a table.
Your following 'index==some number' will always fail.

btw, try properly use 'local' declaration, your fixed codes may still have problem, ie. try click other option in list before 1st scan end...

bye~

_________________
- Retarded.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Nov 08, 2015 9:39 am    Post subject: Reply with quote

Thanks Panraven,

First I tested this function

Code:

function findDoubleValueAndReplace(findValue, replaceWith)
..
..


it's work with change this "-W*X-C" to "+W*X-C"".

Next, as you said use trick to manipulating array Index then I am use a label (set to visible) as a reception / temp label (get caption from cbbox.index.IndexNo) as position of array index and then the function of function findDoubleValueAndReplace(findValue, replaceWith) will refer from that temp label as value to scan.

Then the code :
Code:

function cbboxOnChange()
  index = getProperty(MyForm.cbbox, "ItemIndex")
  index = tbl_array[index]
 if index == nil or index == 0 then
    control_setCaption(MyForm.Temp_Label,"idle...")
 end
  take_code = control_setCaption(MyForm.Temp_Label, index.IndexNo)
  get_code = control_getCaption(MyForm.Temp_Label)
  get_code = tostring(get_code)
   if index == 1 then
    findDoubleValueAndReplace(get_code, 16777215) end
   if index == 2 then
    findDoubleValueAndReplace(get_code, 16776960) end
   if index == 3 then
    findDoubleValueAndReplace(get_code, 14822282) end
...
...
...  ---- next script
end
-------- maybe better use command  for..do  to handle that if..if..if


and so far it work properly.

Regards
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