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 Studio Chat / Request: GetErrorMode() function

Author
Message
Wizard Ranch
2
Years of Service
User Offline
Joined: 24th Dec 2021
Location:
Posted: 8th Feb 2022 18:34 Edited at: 8th Feb 2022 19:24
Hello,

as asked by The Next in his 'Requesting Features' thread, I first post the request here before creating an issue on github.

I would like to get a GetErrorMode() function.
That gives you an awful lot more flexibility when you do error checking for example.

So I can save the ErrorMode, then set it to 0, run some error tests and then set the error mode back to whatever it was before.
It's for example useful for testing if some images exist that you're trying to load.

Edit: I'm not sure if this belongs in the AppGameKit or AppgameKit Studio Forum section though.

Edit 2: Also I would like to request that you can change the Error Mode during the game. Apparently you can set it only once, from what I've just tried...
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 9th Feb 2022 12:53
Quote: "It's for example useful for testing if some images exist that you're trying to load"

Are you aware of GetImageExists()
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th Feb 2022 20:51
Maybe something like this
Wizard Ranch
2
Years of Service
User Offline
Joined: 24th Dec 2021
Location:
Posted: 9th Feb 2022 21:17 Edited at: 9th Feb 2022 21:24
Hi Scraggle and blink0k,

thanks for the ideas.

Scraggle I am aware of that function. GetImageExists() tells me if an image has already been loaded into the system.
But what I'm trying to do is to load an image and see if it exists at all (e.g. LoadImage("example.png")) and then catch the error message manually if it doesn't exist.

blink0k, I would like an internal GetErrorMode command so I can reset it to whatever mode it was in the beginning.
For my fully automated animation functions I would like to be able to simply get whatever error mode the game is currently on, then set the mode to 0, and once the loading process is finished set the mode back to what it was before.
I would like anyone and myself to be able to use the animation functions without having to play around with the error mode at all.
So if I create a custom function like yours', everyone would have to use that funtion once in the beginning so I have that mode saved, which is suboptimal. I'd like it to be all automatic.

Edit: Forget about the second part of my request. You can set error modes multiple times. I somehow didn't test it right sorry.
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 9th Feb 2022 22:39
Quote: " I am aware of that function. GetImageExists() tells me if an image has already been loaded into the system.
But what I'm trying to do is to load an image and see if it exists at all (e.g. LoadImage("example.png")) and then catch the error message manually if it doesn't exist."

So, GetFileExists () then?
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 10th Feb 2022 00:18
Quote: "blink0k, I would like an internal GetErrorMode command so I can reset it to whatever mode it was in the beginning."

SetErrorMode is set to to 2 at the beginning of the template used when you create your project.
There is also GetLastError() and GetErrorOccured()

I agree with scraggle though: Prevention is better than cure
adambiser
AGK Developer
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 10th Feb 2022 01:44
Sometimes it's better to ask forgiveness than permission.

GetErrorMode() is something that I've also wanted for awhile. Sometimes I want to disable whatever the regular error handling is set at for a large section of code and do my own, then flip back.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 10th Feb 2022 03:33
Tell me how writing your own function does not afford you that functionality
adambiser
AGK Developer
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 10th Feb 2022 03:53
I never said that it doesn't. It's what I've done thus far. I just see it as a hack for something that would be simple to add to the AppGameKit language.
Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 10th Feb 2022 14:02 Edited at: 10th Feb 2022 14:04
adambiser wrote: " I just see it as a hack for something that would be simple to add to the AppGameKit language."


Sadly, I think the chances of frequent updates which deliver notable additions to the core language are gone. The now quarterly updates only seem to address Android, IOS , or Studio IDE issues. For those not targeting Android or IOS I believe the last new command added was IndexOf, which was last September, and before that we have to go back a year (2021.02.09) for additions to the core language. Feature Requests
adambiser
AGK Developer
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 10th Feb 2022 18:51
indexOf() uses the last field in the type to search as far as i can see
adambiser
AGK Developer
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: US
Posted: 10th Feb 2022 22:17 Edited at: 10th Feb 2022 22:20
indexOf is using the alphabetically last field from the fields that are the same type as the first field's type instead of just using the first field in the type like "find" does.
Wizard Ranch
2
Years of Service
User Offline
Joined: 24th Dec 2021
Location:
Posted: 12th Feb 2022 22:13
Scraggle,
GetFileExists only works with folder functions and thus absolute path ways, which means that it does not work with html games.
That's the whole problem in the first place.
I changed my whole animation functions because file functions are not supported in html. You cannot generate aboslute paths.

adambiser
Okay, that's good if there already is demand for that function.

Scraggle, do you want to make other suggestions?

Otherwise I will create the issue on github.
I don't know how they adress issues or how long it takes to change something, but at least that way the issue exists.
Wizard Ranch
2
Years of Service
User Offline
Joined: 24th Dec 2021
Location:
Posted: 15th Feb 2022 18:09
This is the github issue link:

https://github.com/TheGameCreators/AGK-Studio/issues/945

adambiser feel free to leave a comment on the issue on github. It will increase the likelihood of it being implemented.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 15th Feb 2022 18:11
Quote: " It will increase the likelihood of it being implemented"

so will including a link to this discussion in the Request
Wizard Ranch
2
Years of Service
User Offline
Joined: 24th Dec 2021
Location:
Posted: 15th Feb 2022 22:01 Edited at: 15th Feb 2022 22:01
Okay, I added a link to the comment in the issue!

Login to post a reply

Server time is: 2024-04-26 04:52:46
Your offset time is: 2024-04-26 04:52:46