Quote:
Originally Posted by ownedbycats
New question:
Code:
program:
if
$#lastread
&&
$$#percentread >=# 1
&&
$$#percentread <=# 99
then
'Currently Reading'
fi
Is there a "number is between 1-99" I can use instead?
|
No. There isn't any range testing operator.
Quote:
EDIT: Additionally:
[snip]
For some reason, if I have a book with a #chaptercount of e.g. 50/100, it returns blank where I expected bookmark_48.
99/100 returns add_book as expected, and any books without a slash return their expected results.
Any idea what went wrong?
|
Here is your template reformatted so I can more easily see if/then/else matching.
Code:
program:
if $#currentlyreading then
if $#fanficcat && '/' in $#chapters then
f = re($#chapters, '(.*)/.*', '\1');
s = re($#chapters, '.*/(.*)', '\1');
if (s - f) ==# 1 then
'add_book.png'
fi
else
'bookmark-48.png'
fi
elif $#readinglist then
'list.png'
elif $$#percentread == 'None' then
'whiteminus.png'
elif $$#percentread ==# 100 then
'ok.png'
elif $$#percentread ==# 0 then
'list_remove.png'
fi
With this code you can get 'bookmark-48.png' only if there is no slash in chapters. I think you want this instead:
Code:
program:
if $#currentlyreading then
if $#fanficcat && '/' in $#chapters then
f = re($#chapters, '(.*)/.*', '\1');
s = re($#chapters, '.*/(.*)', '\1');
if (s - f) ==# 1 then
'add_book.png'
else
'bookmark-48.png'
fi
fi
elif $#readinglist then
'list.png'
elif $$#percentread == 'None' then
'whiteminus.png'
elif $$#percentread ==# 100 then
'ok.png'
elif $$#percentread ==# 0 then
'list_remove.png'
fi
The 'else' block that produces 'bookmark-48.png' is moved to attach to 'if (s - f) ==# 1 then' instead of 'if (s - f) ==# 1 then'.