Quote:
Originally Posted by ownedbycats
EDIT: I think I figured it out. I should've set the 'not set' check as a separate check first. Then if it passed make another if with the other checks. Something like this (I probably messed up the indents.)
Code:
program:
f = re($#chapters, '(.*)/.*', '\1');
s = re($#chapters, '.*/(.*)', '\1');
if
$#chapters != 'Not Set'
then if and(
$$#fanficcat,
check_yes_no('#onkobo', '', 1, 1),
$$#percentread ==#100,
(s - f) ==# 1
)
then '98'
else $$#percentread
fi
fi
|
If using this method, which BTW is a good one, then for performance it would be better to move the s and f calculations into the inner if. Something like this (I didn't try to run/compile it):
Code:
program:
if
$#chapters != 'Not Set'
then
f = re($#chapters, '(.*)/.*', '\1');
s = re($#chapters, '.*/(.*)', '\1');
if and(
$$#fanficcat,
check_yes_no('#onkobo', '', 1, 1),
$$#percentread ==#100,
(s - f) ==# 1
)
then '98'
else $$#percentread
fi
# IS SOMETHING SUPPOSED TO GO HERE?
# In the original template this would return $$#percentread
# The new code returns the empty string
fi