View Single Post
Old 06-29-2021, 12:48 PM   #110
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,135
Karma: 77213683
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Question: Due to that composite column recursion glitch, I did this to avoid using variables in the template:

Code:
program:
	if 
			$#fanficcat 
		&& 
			$#currentlyreading 
		&& 
			$#kobobookmark
	then		
		 strcat(format_number(subtract((re($#kobobookmark, '.*\/file(\d+).*', '\1')), 1), '{0:,d}'), '/',$$#chaptercount)

	fi
Now that it's fixed in source, would changing them back to variables make the template run any more efficiently?
Code:
program:
input = $#kobobookmark;
a = re(input, '.*\/file(\d+).*', '\1');


	if 
			$#fanficcat 
		&& 
			$#currentlyreading 
		&& 
			$#kobobookmark
	then
		
		strcat(format_number(subtract(a, 1), '{0:,d}'), '/',$$#chaptercount)

	fi
Context: This template shows how many chapters of a fanfic I've read compared to how many exist. It checks that the book is a fanfic that's currently being read, then it extracts the number and since I pause at chapter beginnings it subtracts one:

Click image for larger version

Name:	2021-06-29 13_57_33-calibre — __ My Books __ Fanfiction __.png
Views:	1688
Size:	10.1 KB
ID:	187933

ideally, it'd also check that $#kobobookmark starts with OEBPS/file but I've not quite figured out how to get it working yet.

Last edited by ownedbycats; 06-29-2021 at 01:01 PM.
ownedbycats is online now   Reply With Quote