Hello i'm making a game that uses url variables to locate img that should be displayed.
The one problem i have is number of images contained in folder.
<<set $imgmax to 15>>
<<set $imgnmb to random(1,$imgmax)>>
I need $imgmax to be replaced with variable from 'n.txt' placed in $txturl.
It doesn't sounds complicated but i can't get trough jquery to complete this.
Thanks for any help
Comments
Why that step?
Can't you just use <img src=$imgnmb>
If that is correct then my question is, will your story HTML file be hosted/located on the same web-server as the text file?
One more time:
vars:
pc: dog;
place: park;
cond: fog;
action: peeing;
Some trigger;
get number from txt to 'maxrand'
var imgnmb = get random number(1, $maxrand)
Display image from "$place/$cond/$pc/$action/$imgnmb" + ".jpg"
So it will be img from park/fog/dog/43.jpg for example and it works fine but for so many folders and couple of admins that will want to update img content its pointles to CREATE every folder number of contained imgs.
I think i can't explain it more clear.
Sorry for my english.
So something like the following could be added to a custom macro (v1 custom macro):
Beyond that, ideally, instead of trying to parse some custom format in your loading code, it would be better if whatever is creating the n.txt file would generate a JSON file (e.g. n.json) instead, so that JSON.parse() could be used. If it's an automated script, then it shouldn't be an issue, or if it's being created by hand, then it still shouldn't be an issue.