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 


[Delphi] Cheat Engine 5.4 Custom New Scan and Next Scan

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

Joined: 01 Nov 2007
Posts: 218

PostPosted: Sat Nov 29, 2008 2:49 am    Post subject: [Delphi] Cheat Engine 5.4 Custom New Scan and Next Scan Reply with quote

I am trying to add a button that does a custom New Scan and another button that does a custom Next Scan.

For example, the custom New Scan button would do an exact double scan for the value 143 and the custom Next Scan button would do an exact double scan for value 234.

Would I need to copy and paste all of the original code from the original scan buttons and modify the scanvalue, ScanType, and VarType?

Is there a way to just modify the scanvalue, ScanType, VarType, and call the scanning function?

Example code and other methods to do this task are appreciated.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25788
Location: The netherlands

PostPosted: Sat Nov 29, 2008 10:44 am    Post subject: Reply with quote

yes, you can just edit that.

you didn't specify a rounding type so I guess the default and fastest.
Truncated.

newscan:
Code:

foundlist.Deinitialize;
progressbar1.min:=0;
progressbar1.max:=1000;
progressbar1.position:=0;

memscan.newscan; //clear old scan results
memscan.firstscan(soExactValue, vtDouble, rtTruncated, '143', '', scanStart, scanStop, fastscan, scanreadonly, HexadecimalCheckbox.checked, rbdec.checked, cbunicode.checked, cbCaseSensitive.checked, SelectedCustomScanData, SelectedCustomScanType);
DisableGui;
SpawnCancelButton;


nextscan:
Code:

foundlist.Deinitialize;
progressbar1.min:=0;
progressbar1.max:=1000;
progressbar1.position:=0;

memscan.nextscan(soExactValue, vtDouble, '234', '', scanStart, scanStop, fastscan, scanreadonly, HexadecimalCheckbox.checked, rbdec.checked, cbunicode.checked, cbCaseSensitive.checked, SelectedCustomScanData, SelectedCustomScanType);

DisableGui;
SpawnCancelButton;

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ElitestFX
Expert Cheater
Reputation: 0

Joined: 01 Nov 2007
Posts: 218

PostPosted: Sun Nov 30, 2008 7:40 pm    Post subject: Reply with quote

Dark Byte, thank you very much for your time and knowledge. I really appreciate the code.

In the hotkey settings on CE 5.4, the values of the speed hack don't save, but it is great that the hotkey works. Was that done on purpose?

I was thinking about learning how to fix it. I understand that the settings are stored in the Windows Registry. Would the fix just involve returning the value of the speed hack key in the Registry?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25788
Location: The netherlands

PostPosted: Tue Dec 02, 2008 10:30 pm    Post subject: Reply with quote

Could be anything. Didn't even know saving/loading the hotkeys didn't work. (never use that much more than once every 3 months)

Check loading the registry as well. It could be it's saved, but just not loaded

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ElitestFX
Expert Cheater
Reputation: 0

Joined: 01 Nov 2007
Posts: 218

PostPosted: Thu Dec 04, 2008 11:35 pm    Post subject: Reply with quote

The settings are saving to the Registry. They are not loading into Edit2.Text and Edit3.Text though.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25788
Location: The netherlands

PostPosted: Tue Dec 09, 2008 2:19 pm    Post subject: Reply with quote

I've just fixed this bug:
http://ce.colddot.nl/changeset/143/Cheat%20Engine/formsettingsunit.pas

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ElitestFX
Expert Cheater
Reputation: 0

Joined: 01 Nov 2007
Posts: 218

PostPosted: Wed Dec 10, 2008 11:00 pm    Post subject: Reply with quote

Thank you very much for the bug fix. I tried to use ChangeValue to write a button to change the value of the selected address on the cheat table to a static value of 69.

Am I missing anything important in this code? It seems to work.

Code:
procedure TMainForm.Button1Click(Sender: TObject);
var i: Integer;
begin
  for i:=0 to numberofrecords-1 do
  begin
    if selected[i] then
      ChangeValue(i, '69');
  end;

  updatelist;
end;


I need some help writing a procedure for a button to compare address offsets in the foundlist to filter out two out of the three addresses leaving one to add to the cheat table.

For example:

There are always 3 addresses when the scans are complete. Two of the addresses are only 0x10 away from each other. The third address is relatively far from the other two. I want this button to add the third address to the cheat table.

Example Foundlist:

00400040 (Don't add)
00400050 (Don't add)
005000B0 (Add to cheat table)

or

00600040 (Add to cheat table)
007000C0 (Don't add)
007000D0 (Don't add)
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25788
Location: The netherlands

PostPosted: Fri Dec 12, 2008 5:07 am    Post subject: Reply with quote

Code:

a:=address1 and $FFFFFF00;
b:=address2 and $FFFFFF00;
c:=address3 and $FFFFFF00;

if b=c then rightaddress:=address1;
if a=c then rightaddress:=address2;
if a=b then rightaddress:=address3;


what it does: It changes the last 2 digits to 0 and then compares with eachother
00400040 would turn into 00400000
00400050 would turn into 00400000
005000b0 would turn into 00500000

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ElitestFX
Expert Cheater
Reputation: 0

Joined: 01 Nov 2007
Posts: 218

PostPosted: Fri Dec 12, 2008 11:59 am    Post subject: Reply with quote

That was exactly what I needed. Just to understand a little more about how to use the bitwise AND operator...

00400040 AND $FFFFFF00 -> 00400000
00400050 AND $FFFFFF00 -> 00400000
005000B0 AND $FFFFFF00 -> 00500000

Would the following also work? I'll test this when I get home.

00400045 AND $FFFFFF0F -> 00400005
00400055 AND $FFFFFF0F -> 00400005
005000B5 AND $FFFFFF0F -> 00500005

I understand that using a bitwise AND with 0 will make that bit 0. Does using a bitwise AND with F make that bit not change?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25788
Location: The netherlands

PostPosted: Fri Dec 12, 2008 4:42 pm    Post subject: Reply with quote

a 0 means: 0000
a F means: 1111

bit and 1 means the result will be the value of the bit
bit and 0 means the result will be the value 0

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ElitestFX
Expert Cheater
Reputation: 0

Joined: 01 Nov 2007
Posts: 218

PostPosted: Fri Dec 12, 2008 8:14 pm    Post subject: Reply with quote

I'm still having trouble making it work. How do I store the three addresses from the foundlist to the variables address1,2,3. I'll looking at AddToRecord() and it's an Integer. Would I be calling AddToRecord() in this case?

Code:
procedure TMainForm.Button1Click(Sender: TObject);
var a,b,c: dword;
    address1: dword;
    address2: dword;
    address3: dword;
begin
  if foundlist3.Items.Count=3 then
  begin
    a:=address1 and $FFFFFF00;
    b:=address2 and $FFFFFF00;
    c:=address3 and $FFFFFF00;
    if b=c then AddToRecord(0);
    if a=c then AddToRecord(1);
    if a=b then AddToRecord(2);
  end;
end;


Last edited by ElitestFX on Sun Dec 14, 2008 5:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25788
Location: The netherlands

PostPosted: Sat Dec 13, 2008 8:50 am    Post subject: Reply with quote

You need to use the GetAddress method of the foundlist class to get the address

Code:

if foundlist3.Items.Count=3 then
begin
  address1:=foundlist.GetAddress(0);
  address2:=foundlist.GetAddress(1);
  address3:=foundlist.GetAddress(2);

  a:=address1 and $FFFFFF00;
  b:=address2 and $FFFFFF00;
  c:=address3 and $FFFFFF00;
  if b=c then AddToRecord(0);
  if a=c then AddToRecord(1);
  if a=b then AddToRecord(2);
end;

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ElitestFX
Expert Cheater
Reputation: 0

Joined: 01 Nov 2007
Posts: 218

PostPosted: Sat Dec 13, 2008 10:29 pm    Post subject: Reply with quote

Thank you, Dark Byte. foundlist.GetAddress() is working flawlessly. I really appreciate your time.
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 Source 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