Page 1 of 1
Eos programming question
Posted: Sat Apr 11, 2020 5:23 pm
by sirveillance
Hi, i am working on a tease. There are always two connected images - one censored, one uncensored. My Idea was this:
I have a image folder with images-a and one with images-b and the files are named the same.
when loading images-a/image1.jpg i want to save the filename and load later the same filename from images-b
but it seems there is no way to access or read the filenames? is there a workaround?
Re: Eos programming question
Posted: Sat Apr 11, 2020 6:11 pm
by fapnip
Unfortunately, as far as I know, you can't dynamically reference image paths. But you can dynamically reference pages.
Best thing I've found is to have a bunch of simple pages that are dedicated to rendering the image. Then define global functions/variables in your global init script to manage them like:
In your Global Init Script
Code: Select all
var imageMode = 'nude'
var loadedImagePagePath = null
var imageCaller = null
// sets image mode
setNudeNonNude(nude) {
imageMode = nude ? 'nude' : 'nonnude'
}
// Loads image page (image page will need to call: returnToImageCaller())
loadImage(image) {
var imagePagePath = 'images-' + imageMode + '-' + image
if (loadedImagePagePath !== imagePagePath) {
// we need to load this image
imageCaller = pages.getCurrentPageId()
loadedImagePagePath = imagePagePath
pages.goto(imagePagePath)
}
}
// Clears loaded image. Should be called if you've loaded an image not using loadImage(...).
clearLoadedImage() {
loadedImagePagePath = null
}
// Returns to loaded image caller
returnToImageCaller() {
pages.goto(imageCaller )
}
In each of your 'images-[nude/nonnude]-[name/number]' pages.
1. Add your image action
2. Add an Eval:
At the start of any non 'images-[nude/nonnude]-[name/number]' page that you want to load a dynamic image:
Add an Eval:
Code: Select all
loadImage(imageName) // where image name is the [name/number] portion of your image page path.
In any non 'images-[nude/nonnude]-[name/number]' page where you load a non-dynamic image
After your image action, add an Eval:
Never directly go to any of your 'images-[nude/nonnude]-[name/number]' pages. Always should be handled by loadImage(...), and always before you do anything else of consequence on your page, because if the image isn't already loaded, you'll be directed away from then back to the page you're calling loadImage(...) from.
Hope that makes sense.
Re: Eos programming question
Posted: Sat Apr 11, 2020 9:18 pm
by undeniable_denial
What I like to do, is nest each image in an if-action, with a condition such as
Then you can kind of script images, by setting showImg before all the ifs.
The downside is that it can be tedious to insert all these actions. If you know your way around a code editor you can edit the json-backup-file directly, though.
Re: Eos programming question
Posted: Sun Apr 12, 2020 8:34 am
by sirveillance
I will try that - thank you both!