Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Displaying Errors

Author
Message
Joey Panda
10
Years of Service
User Offline
Joined: 30th Oct 2013
Location:
Posted: 30th Oct 2013 16:51
I've been trying to figure out how to display errors. The example code is incomplete. I've been messing around with it for a few hours...no matter what I do the error displays whether it's set to 0 1 or 2
I have included the example code.


No better time than the present to learn how to code!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 30th Oct 2013 19:51
Using zero for SetErrorMode makes it ignore any errors.

According to the help page, if there is an error it will be reported in the 'appropriate debug console'.

This means you need to run the app while attached to the device you are running on. There is no debug console in Windows if you are using Tier 1 (which it looks like you are).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 30th Oct 2013 20:10 Edited at: 30th Oct 2013 20:11
something like this?

global error$
error$="bla"
showerror=1
if showerror then displayerror()

function displayerror()

do
print(error$)
if getpointerpressed() then exit
sync()
loop

endfunction

AGK 108 B19 : Windows 8 Pro 64 Bit : AMD Radeon HD 6670
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 30th Oct 2013 20:50
You can also use the GetErrorOccurred() command to detect if an error has happened and then the GetLastError() to display the command.

Maybe something like this:


Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Joey Panda
10
Years of Service
User Offline
Joined: 30th Oct 2013
Location:
Posted: 30th Oct 2013 20:53
Ah, so you can't have it display something on screen if there's an error?

I don't remember which language I had used, but I usually had both...the debug console and printed something on screen just for debugging purposes.

No better time than the present to learn how to code!
Joey Panda
10
Years of Service
User Offline
Joined: 30th Oct 2013
Location:
Posted: 30th Oct 2013 23:14
Ah, so you can't have it display something on screen if there's an error?

I don't remember which language I had used, but I usually had both...the debug console and printed something on screen just for debugging purposes.

So would using SetErrorMode just be for ide debugging?

No better time than the present to learn how to code!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 31st Oct 2013 14:34
SetErrorMode really only works when connected to Xcode or Eclipse. So, yes, only for IDE debugging.

I think you are better off making your own routines (something like the one I posted) that let you check for and display AppGameKit errors on whatever device is actually running.

In Mac, Windows and iOS, you could use the Message command to pop up a message. It will pause whatever is going on until cleared. In Android, a Message popup only appears for a little bit and then clears itself.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Joey Panda
10
Years of Service
User Offline
Joined: 30th Oct 2013
Location:
Posted: 31st Oct 2013 16:05
Thanks a lot Ancient Lady and Markus.

Very much appreciated

No better time than the present to learn how to code!

Login to post a reply

Server time is: 2024-05-20 05:31:31
Your offset time is: 2024-05-20 05:31:31