How to check if a file is not found?

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
I just want to know how to check if a certain file is not found in your scene? For example, I created a sprite that shows a representation of my actor every time. I changed my actor and currently, I have no image that shows the actor's representation. Normally, it says in the console that such file is not found and an error message appears. However, I was wondering if there's a way to check if the current image needed is not found, so I can skip showing the sprite, if the image is found, display the image.


TIA.
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
858
First Language
German
Primarily Uses
You will throw an error, if you request a file that doesn't exist and there's nothing in the base scripts, that would prevent it. There has to be a different reason for your actor to be invisible.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Yeah it throws me an error because the bitmap isn't present. But I was wondering if there's a way to check if the bitmap is not present, so I can do bunch of stuff inside the true clause.
 

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,695
Reaction score
924
First Language
English
Primarily Uses
N/A
Well, if it throws an error when the file can't be found, just have a catch block to catch the error and handle it.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Out of sudden, snow. Everywhere.
Blech. I hate coming up with stories. Making gameplay is fun but coming up with lore and reasons for these areas/mechanics just makes me sleepy.
40 card deck size, the plugin seems more sluggish.
Village theme I composed for a commission!

Forum statistics

Threads
94,568
Messages
921,954
Members
124,433
Latest member
h4ck3rsaavedra
Top