Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TedMar, AndrewAMD), 1,344 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
on_error event / callback? #309565
02/10/10 01:18
02/10/10 01:18
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Hi is it possible to add an event like 'on_error' that allows us to execute a function when an error occurs. I could really use this for my scripting app.

Preferably parameters such as 'line_number' and 'current_module' would be passed to the function. By 'current_module' I mean the object/function that the error occured in.

If there was a way to hook this up when compiling a script too that would be awesome. Right now 'ackerr.txt' only prints the first error it finds.

Last edited by DJBMASTER; 02/10/10 01:50.
Re: on_error event / callback? [Re: DJBMASTER] #309608
02/10/10 08:31
02/10/10 08:31
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
The compiler can not continue after an error. That's why you only get the first error on compiling.

Re: on_error event / callback? [Re: jcl] #309639
02/10/10 14:49
02/10/10 14:49
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
hmm, well what about at runtime, eg when trying to use a NULL pointer. You get an error box shown up, so is there a way to hook an event to that?

Re: on_error event / callback? [Re: DJBMASTER] #309663
02/10/10 16:15
02/10/10 16:15
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Yes, through the debugging interface when calling the engine through C++. You can pass a callback function pointer to engine_open. You'll find details in the comment in afuncs.h. There is no such mechanism in lite-C.

Re: on_error event / callback? [Re: jcl] #309925
02/11/10 22:54
02/11/10 22:54
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
would it be possible to add a mechanism for lite-c?

Re: on_error event / callback? [Re: DJBMASTER] #310694
02/16/10 15:45
02/16/10 15:45
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
It certainly would, but is sort of complicated. I will think about a solution. But don't hold your breath, this is getting a low priority due to a low cost-benefit ratio.

Re: on_error event / callback? [Re: jcl] #310734
02/16/10 18:48
02/16/10 18:48
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Why is it a low cost-benefit ratio?

I am regularly annoyed that lite-c has no capability of "trapping" errors.

The amount of duplicated code needed to "dodge" errors could be greatly
reduced with a simple "on_error" event in the engine.

Being able to trap and handle errors with our own code should IMHO be manditory.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: on_error event / callback? [Re: EvilSOB] #310762
02/16/10 20:27
02/16/10 20:27
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
I'd prefer try...catch

Re: on_error event / callback? [Re: FBL] #311627
02/21/10 02:10
02/21/10 02:10
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Yeh, try/catch/finally would be great, but for my purposes I wanted to be able to refer the user, back to my scripting application and highlight the line that crashed, replicating VS's functionality. So 'on_error' would be great.


Moderated by  aztec, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1