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 


[Help] [Delphi] GetVariable error

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
LolSalad
Grandmaster Cheater
Reputation: 1

Joined: 26 Aug 2007
Posts: 988
Location: Australia

PostPosted: Sun Sep 30, 2007 1:17 am    Post subject: [Help] [Delphi] GetVariable error Reply with quote

In my flash trainer made in Delphi, I'm trying to put a GetVariable on a timer so that it constantly gets a variable and puts it into an edit box. Then, another timer reads from the edit box and runs something if the text is '999999999'.

Thing is, when the variable doesn't exist, I instantly get an error. I need it to do nothing if the variable doesn't exist. However, I have no idea how to do this. Help please? Confused

I tried 'try' and 'except', but I still get the same error on the same line.

Here's the code:
Code:
procedure TTrainer.GetVarTimer(Sender: TObject);
var exp2lvl : string;
var maxhp : string;
begin
  try
    begin
      exp2lvl := Game.GetVariable('_level0.questreward.intExpToLevel');
      maxhp := Game.GetVariable('_level0.character.origStats.intMaxHP');
      VarExport1.Text := exp2lvl;
      VarExport2.Text := maxhp;
    end;
  except
    on E : Exception do
    begin
      VarExport1.Text := 'Unavailable';
      VarExport2.Text := 'Unavailable';
    end;
  end;
end;

_________________
Back to top
View user's profile Send private message MSN Messenger
compactwater
I post too much
Reputation: 8

Joined: 02 Aug 2006
Posts: 3923

PostPosted: Sun Sep 30, 2007 1:55 am    Post subject: Reply with quote

Try
Code:
MessageBox(Self.Handle, PChar(String(error.Message)), PChar(String(error.ClassName)), MB_OK);
instead.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming 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