| View previous topic :: View next topic |
| Author |
Message |
Xanatos I post too much
Reputation: 18
Joined: 06 May 2007 Posts: 2559 Location: US
|
Posted: Fri Aug 03, 2007 9:30 am Post subject: [issue] error D: |
|
|
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 |
|
 |
DeltaFlyer Grandmaster Cheater
Reputation: 0
Joined: 22 Jul 2006 Posts: 666
|
Posted: Fri Aug 03, 2007 9:44 am Post subject: |
|
|
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 |
|
 |
Xanatos I post too much
Reputation: 18
Joined: 06 May 2007 Posts: 2559 Location: US
|
Posted: Fri Aug 03, 2007 9:47 am Post subject: |
|
|
| 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 |
|
 |
DeltaFlyer Grandmaster Cheater
Reputation: 0
Joined: 22 Jul 2006 Posts: 666
|
Posted: Fri Aug 03, 2007 9:53 am Post subject: |
|
|
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 |
|
 |
Xanatos I post too much
Reputation: 18
Joined: 06 May 2007 Posts: 2559 Location: US
|
Posted: Fri Aug 03, 2007 9:59 am Post subject: |
|
|
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 |
|
 |
Nigtronix Cheater
Reputation: 0
Joined: 18 May 2007 Posts: 45
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Sat Aug 04, 2007 12:23 pm Post subject: |
|
|
Or you could've just initialized the variables to 0 on runtime...
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sat Aug 04, 2007 3:14 pm Post subject: |
|
|
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.
|
|
| Back to top |
|
 |
|