Author Topic: Show an image if an object doesnt exists  (Read 3920 times)

qqplayer

  • Sr. Member
  • ****
  • Posts: 301
    • View Profile
Show an image if an object doesnt exists
« on: October 14, 2017, 01:11:35 PM »
I`m working on a little "pdf reader" plugin.
The main idea is read our game manuals from the layout.
So I need some help to show a little png, icon or somthing when there isnt pdf manual on the respective folder.

This is how it looks.

https://www.youtube.com/watch?v=CO16rOauGgU

What I want is as I said to show some info on the layout if the game hasn´t a pdf manual.

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Show an image if an object doesnt exists
« Reply #1 on: October 14, 2017, 06:12:41 PM »
sorry im no help but,  i had to chime in and say,  this is bad ass,  cant wait to try
good out side the box idea!
help a friend....

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: Show an image if an object doesnt exists
« Reply #2 on: October 14, 2017, 08:42:29 PM »
Try:

fe.load_module("file");
function file_exist(fullpathfilename)
   {
   try {file(fullpathfilename, "r" );return true;}catch(e){return false;}
   }

qqplayer

  • Sr. Member
  • ****
  • Posts: 301
    • View Profile
Re: Show an image if an object doesnt exists
« Reply #3 on: October 15, 2017, 04:03:20 AM »
Thanks @jedione is almost finished , the code isn´t perfect but works great :)

@keilmillerjr , thanks , I saw this code yet but... you know... can you please make me something more "usefull" I can´t even imagine how to convert this  to my purpose :)
I just want the layout.nut to check some path and if founds the "romname.pdf" inside shows a little icon.
« Last Edit: October 15, 2017, 09:39:10 AM by qqplayer »

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: Show an image if an object doesnt exists
« Reply #4 on: October 15, 2017, 08:06:47 AM »
Thanks @jedione is almost finished , the code isn´t perfect but works great :)

@keilmillerjr , thanks , I saw this code yet but... yout know... can you please make me something more "usefull" I can´t even imagine how to convert this  to my purpose :)
I just want the layout.nut to check some path and if founds the "romname.pdf" inside shows a little icon.

Well, I'm on a trip for the day so I can not provide a full example right now. However, I can tell you my approach was and maybe you get a head start.

Load file midule
Include file exists function
Create transition to new selection or filter
If file exists returns true, image path is image path
If file exists returns false, image path is ""