SexScripts : Suppress Image Not Found - https://ss.deviatenow.com:443/viewtopic.php?f=6&t=497 Page 1 of 1

Suppress Image Not Found

kb215 [ Thu May 14, 2015 12:45 am ]

Could we suppress file not found errors by default if the user is not an author? Instead just showing no image if the resources section failed to import the images?

I'm having terrible trouble trying to fill out the resources section in my scripts and as a result users are getting errors.

Can we also do a wildcard to say import all images in this folder rather than having to add each file to a new line in the resources?

Many thanks

Re: Suppress Image Not Found

doti [ Thu May 14, 2015 11:48 am ]

kb215 wrote:
Could we suppress file not found errors by default if the user is not an author? Instead just showing no image if the resources section failed to import the images?

I'm having terrible trouble trying to fill out the resources section in my scripts and as a result users are getting errors.


No, silent errors are worse, but...


kb215 wrote:
Can we also do a wildcard to say import all images in this folder rather than having to add each file to a new line in the resources?

Many thanks


...it already works - see here.

Re: Suppress Image Not Found

Liz [ Thu May 14, 2015 1:39 pm ]

kb215 wrote:
Could we suppress file not found errors by default if the user is not an author? Instead just showing no image if the resources section failed to import the images?


You could have a wrapper function such as:

Code:
def ShowImage = { img_name ->
  if (new File("images/"+img_name).exists())
    setImage(img_name)
  else
    setImage(null)
}


Then just use ShowImage("image.jpg") instead of setImage and it will just not display an image if it does not exist.

Sorry Doti if this is not good practice :roll:

Re: Suppress Image Not Found

kb215 [ Mon May 18, 2015 4:43 am ]

Excellent thank you for the help. I hate to leave users with errors.

I have now in the main file of campdrain:
Code:
/*
* Resources
* scripts/campdrain.groovy
* scripts/campdrain/Functions.groovy
* scripts/campdrain/drainers.groovy
* scripts/campdrain/day7.groovy
* scripts/campdrain/day6.groovy
* scripts/campdrain/day5.groovy
* scripts/campdrain/day4.groovy
* scripts/campdrain/day2.groovy
* scripts/campdrain/day1.groovy
* images/campdrain/*
* images/milovana/12017/*
* images/milovana/17645/*
* images/milovana/17661/*
* images/milovana/17662/*
* images/milovana/17664/*
* images/milovana/17687/*
*/


Does this look right?

Re: Suppress Image Not Found

doti [ Mon May 18, 2015 7:24 pm ]

YOu can even do :
Code:
/*
* Resources
* scripts/campdrain.groovy
* scripts/campdrain/*
* images/campdrain/*
* images/milovana/12017/*
* images/milovana/17645/*
* images/milovana/17661/*
* images/milovana/17662/*
* images/milovana/17664/*
* images/milovana/17687/*
*/

Page 1 of 1 All times are UTC + 1 hour [ DST ]
https://ss.deviatenow.com:443/
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010, 2011