Author Topic: Redirect if image can not be found.  (Read 459 times)

Technopeasant

  • Newbie
  • *
  • Posts: 17
    • Homepage
Redirect if image can not be found.
« on: July 08, 2011, 10:16:05 PM »
Greetings,

Although I am still awaiting a response to my last thread, which seems to indicate that this forum still has a bit of a way to go in its rebirth, I will post this problem of mine here as well as see what happens.  :-\

In one of my graphical engines I have been using simple shape prefabs, which I than texture to make up my game world. This is a nice easy way to create consistent and workable areas, but the idea occurs to me that I can use this to an even greater potential. I am wishing this to be a game engine that others can build up upon, and so a useful feature would be that if a room can not find its own texture it would redirect to the one in the directory of these prefabs and use its equivalent. Is there anyway to get it to do something if it can't find something?

Any thoughts would be appreciated.
Technical director,
Piga Software
http://icculus.org/piga/

Gambas (1.0.19, 2.23 & 3.0.0) coding since April 2007, focusing on game logic, graphics and artificial intelligence.
Running Fedora 15 (GNOME 3 Fallback, XFCE, LXDE) on a Dell Latitude D600 and Fedora 15 LXDE spin on a Lenovo 3000 N200.

Linux Basic

Redirect if image can not be found.
« on: July 08, 2011, 10:16:05 PM »

sholzy

  • Newbie
  • *
  • Posts: 24
    • White Island Software
Re: Redirect if image can not be found.
« Reply #1 on: July 10, 2011, 02:34:09 AM »
How about using this: gambasdoc.org/help/lang/exist

Code: [Select]
If Exist("default/image") Then
   Some code here to use it
Else
   Some other code here for alternate image
Endif

sholzy

----
Owner / Admin
White Island Software
http://whiteislandsoftware.com/

The best executive is one who has sense enough to pick good people to do what he wants done, and self-restraint enough to keep from meddling with them while they do it. - Theodore Roosevelt

Technopeasant

  • Newbie
  • *
  • Posts: 17
    • Homepage
Re: Redirect if image can not be found.
« Reply #2 on: July 10, 2011, 06:00:17 PM »
That worked great, thanks.

It is a very useful feature to have texture fall-back mode, and does somehow demonstrate the engine's workings well.  ;D
Technical director,
Piga Software
http://icculus.org/piga/

Gambas (1.0.19, 2.23 & 3.0.0) coding since April 2007, focusing on game logic, graphics and artificial intelligence.
Running Fedora 15 (GNOME 3 Fallback, XFCE, LXDE) on a Dell Latitude D600 and Fedora 15 LXDE spin on a Lenovo 3000 N200.

sholzy

  • Newbie
  • *
  • Posts: 24
    • White Island Software
Re: Redirect if image can not be found.
« Reply #3 on: July 11, 2011, 09:38:35 PM »
I always try to help if I can. I've used If Exist() in a few of my projects.
sholzy

----
Owner / Admin
White Island Software
http://whiteislandsoftware.com/

The best executive is one who has sense enough to pick good people to do what he wants done, and self-restraint enough to keep from meddling with them while they do it. - Theodore Roosevelt