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 


[issue] error D:

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Xanatos
I post too much
Warning
Reputation: 18

Joined: 06 May 2007
Posts: 2559
Location: US

PostPosted: Fri Aug 03, 2007 9:30 am    Post subject: [issue] error D: Reply with quote

I'm getting an "unspecified error" when I do certain actions with a trainer I made. The thing is, I want these errors to be ignored, and if possible not to show up at all. However I have no clue as how I should go about to doing this.

Anways the error occurs because my trainer calls a variable that hasn't been declared/initialized and it will be at a certain point of the game, which I want to change at that specific time, by having a timer running constantly calling and changing. However you get quite a few errors along the way, so is it possible to ignore these?

Also if you'd like to see what I'm doing you can see my trainer here.

_________________
Back to top
View user's profile Send private message
DeltaFlyer
Grandmaster Cheater
Reputation: 0

Joined: 22 Jul 2006
Posts: 666

PostPosted: Fri Aug 03, 2007 9:44 am    Post subject: Reply with quote

The best way according to good programming practices is to simply initialize all of your variables at the beginning of the code, or a constructor in an object, to an initial default value. I haven't seen in any popular programming languages where you could declare a variable at runtime and is accessible to the global scope, so the undeclared variables shouldn't be a runtime problem.

If you're too lazy to initialize the variables to a default value, you could always use a try-catch block to catch the exceptions generated. These will depend on which language you're using and whether it supports the try blocks.

_________________

Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for?
Back to top
View user's profile Send private message
Xanatos
I post too much
Warning
Reputation: 18

Joined: 06 May 2007
Posts: 2559
Location: US

PostPosted: Fri Aug 03, 2007 9:47 am    Post subject: Reply with quote

DeltaFlyer wrote:
The best way according to good programming practices is to simply initialize all of your variables at the beginning of the code, or a constructor in an object, to an initial default value. I haven't seen in any popular programming languages where you could declare a variable at runtime and is accessible to the global scope, so the undeclared variables shouldn't be a runtime problem.

If you're too lazy to initialize the variables to a default value, you could always use a try-catch block to catch the exceptions generated. These will depend on which language you're using and whether it supports the try blocks.


Thanks for the feedback.

I'm using Delphi and my trainer loads from a URL, to Dragonfable. DF runs on multiple .swf files and contains variables unique to each one, so when the .swf is loaded/executed it would declare the variable. This would happen by doing somehting in the game (finishing a quest etc.).

So how would a catch block work in Delphi?

_________________
Back to top
View user's profile Send private message
DeltaFlyer
Grandmaster Cheater
Reputation: 0

Joined: 22 Jul 2006
Posts: 666

PostPosted: Fri Aug 03, 2007 9:53 am    Post subject: Reply with quote

Are the variables you mentioned the variables in the swf files? Then it should be the flash object's role to handle the exceptions.

Try blocks in Delphi is actually not a try-catch, but a try-except. Here is some information:
http://www.delphibasics.co.uk/RTL.asp?Name=Try

Try a plain try-except block on the part where the error occurs.

_________________

Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for?
Back to top
View user's profile Send private message
Xanatos
I post too much
Warning
Reputation: 18

Joined: 06 May 2007
Posts: 2559
Location: US

PostPosted: Fri Aug 03, 2007 9:59 am    Post subject: Reply with quote

Yeah the vars are in the .swf

Basically the game runs through a function to assign an item ID to a variable and I want to change that ID.

EDIT: So should I include an except and put nothing in its parameters? Also will this prevent the error message from displaying?

Thanks for your help, +rep, I think I can handle it from here.

_________________
Back to top
View user's profile Send private message
Nigtronix
Cheater
Reputation: 0

Joined: 18 May 2007
Posts: 45

PostPosted: Sat Aug 04, 2007 10:14 am    Post subject: Reply with quote

You can also look into SEH

http://www.microsoft.com/msj/0197/Exception/Exception.aspx
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Sat Aug 04, 2007 12:23 pm    Post subject: Reply with quote

Or you could've just initialized the variables to 0 on runtime... Rolling Eyes
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sat Aug 04, 2007 3:14 pm    Post subject: Reply with quote

Screw 0, initialize them as null.

It really is stupid--you have to actually SAY that it equals null, you can't just put out a variable name without a value.

I guess in Delphi, it's nil, or something. Rolling Eyes
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