 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Look-Familiar Newbie cheater
Reputation: 0
Joined: 03 Jun 2008 Posts: 19 Location: US
|
Posted: Tue Jul 21, 2009 7:58 pm Post subject: Problem with Delphi integers |
|
|
So this is my Source Code:
| Code: |
procedure TForm1.Edit1Change(Sender: TObject);
var
yourName, ID: HWND;
yay: String;
i: Integer;
begin
if Edit1.Text <> '' then
begin
yay := IntToStr(StrToInt(Edit1.Text) * 8);
yourName := FindWindow('TMainForm', 'Cheat Engine 5.5');
if yourName <> 0 then
begin
ID := FindWindowEx(yourName, 0, 'TPanel', nil);;
yourName := FindWindowEx(ID, 0, 'TEdit', nil);
SendMessage(yourName, EM_SETSEL, 0, -1);
for i := 1 to Length(yay) do
begin
SendMessage(yourName, WM_CHAR, Word(yay[i]), 0);
end;
end;
end
else if Edit1.Text = '' then
begin
yay := '';
yourName := FindWindow('TMainForm', 'Cheat Engine 5.5');
if yourName <> 0 then
begin
ID := FindWindowEx(yourName, 0, 'TPanel', nil);;
yourName := FindWindowEx(ID, 0, 'TEdit', nil);
SendMessage(yourName, EM_SETSEL, 0, -1);
SendMessage(yourName, WM_CHAR, VK_BACK, 0);
end;
end
end;
|
The desired effect is to take whatever I type into that EditBox and multiply it by 8 and put it into Cheat Engine's search box.
Now it works all until I make it to the 11th character and then it says:
"NumberYouTypedIn" is not a valid integer value.
I am not a beginner with Delphi Programming but I am not an expert either. Is there something I can be doing that will not cause the error mentioned?
I'm using CodeGear Delphi 2009. The program only has that one EditBox.
Note: My variables are just temp until I finish the program. That's just how I do.
_________________
Good times =D |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 475
Joined: 09 May 2003 Posts: 26004 Location: The netherlands
|
Posted: Tue Jul 21, 2009 8:51 pm Post subject: |
|
|
you do know you can use the custom scantype to do that for you right ? (shl scanvalue with 3)
anyhow, use a try/except around it, or use trystrtoint, or use val
a 11th character integer is too big
_________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Look-Familiar Newbie cheater
Reputation: 0
Joined: 03 Jun 2008 Posts: 19 Location: US
|
Posted: Tue Jul 21, 2009 10:59 pm Post subject: |
|
|
I didn't know that I could do that or that the custom scantype even existed so thank you for the suggestion. I don't know what you mean by shl by three but I might figure it out on my own.
As for the program solution I opted to go with a two pronged fix since I can't have an integer that large; I made the EditBox's MaxLength 9 and I put a try/except around the code to catch the exceptions.
Thank you for the info Dark Byte
_________________
Good times =D |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 475
Joined: 09 May 2003 Posts: 26004 Location: The netherlands
|
Posted: Wed Jul 22, 2009 5:05 pm Post subject: |
|
|
I've just posted a custom scan script that does this in the flash section: http://forum.cheatengine.org/viewtopic.php?t=439459
_________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
|
|
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
|
|