View Single Post
Old 12-20-2021, 02:07 PM   #237
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
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
chaley is offline   Reply With Quote