![]() |
#211 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,024
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thanks. Inlist worked.
![]() Would inlist also work for pulling from formats? (Also, would stickying this thread make sense? There's already quite a few stickies already though.) Last edited by ownedbycats; 12-11-2021 at 06:05 PM. |
![]() |
![]() |
![]() |
#212 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
I don't see any reason to sticky this thread. As you say there are enough of them. |
|
![]() |
![]() |
![]() |
#213 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
EDIT: never mind, I see it now. You want something like Code:
program: if $series then if $#series then strcat($series, ' [', $series_index, '/', $#series_index, ']') else strcat($series, ' [', $series_index, ']') fi fi EDIT 2: This also works, should you prefer Single Function Mode templates. Code:
{series}{series_index:| [|}{#series_index:|/|]}{#series_index:test(,])} Last edited by chaley; 12-11-2021 at 07:17 PM. |
|
![]() |
![]() |
![]() |
#214 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 896
Karma: 810834
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
|
Quote:
Last edited by dunhill; 12-11-2021 at 09:18 PM. |
|
![]() |
![]() |
![]() |
#215 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,024
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
New question:
Code:
program: if $#lastread && $$#percentread >=# 1 && $$#percentread <=# 99 then 'Currently Reading' fi EDIT: Additionally: 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 99/100 returns add_book as expected, and any books without a slash return their expected results. Any idea what went wrong? Last edited by ownedbycats; 12-12-2021 at 04:40 AM. |
![]() |
![]() |
![]() |
#216 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
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 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 |
||
![]() |
![]() |
![]() |
#217 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,024
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
That fixed books with slashes.
![]() Any idea what's going on? |
![]() |
![]() |
![]() |
#218 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
if $#fanficcat && '/' in $#chapters then Code:
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 else 'exploding-book.png' fi |
|
![]() |
![]() |
![]() |
#219 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,024
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I'm wondering now if a flowchart would help...
|
![]() |
![]() |
![]() |
#220 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Sure. Use whatever tools help. My problem with flowcharts is ensuring that the chart represents the actual code. I have made the mistake of 'seeing what should be there instead of what is there' more times than I care to admit.
I often use breakpoints to trace the execution path. Set breaks on every line and run it with various books. This technique can also help determine why when you have a book that produces the wrong value. |
![]() |
![]() |
![]() |
#221 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,024
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Would adding a range operator test make sense? I'm not sure how much need there is for one, considering $$#percentread >=# 1 && $$#percentread <=# 99 does the job well enough.
EDIT: Also, not exactly template-related, but do I need to use "add icon" button to properly add the icon, or will just throwing the file into cc_icons folder work? Mostly because "add icon" isn't accessible via the stored template dialog and it really doesn't make much sense to add it there. ANOTHER EDIT: Is there a better way to phrase this 'if #number is defined as 0' template? One of my templates was misbehaving a bit with an undefined #percentread... Code:
program: if $$#number==# '0' && $$#number !='None' then 'True' fi Last edited by ownedbycats; 12-13-2021 at 07:49 AM. |
![]() |
![]() |
![]() |
#222 | ||||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Of course you can get fancy in some cases. Example: this checks if a number is defined and is between 0 and 99 inclusive. Code:
if $#myint && floor($#myint / 100) == 0 then 'y' else 'n' fi Quote:
But to answer your question and assuming you are talking about icons used in rules: yes, icon display picks up whatever is in that folder. The add button does convert the image to 128x128, so it would be best if the added image was already that. Quote:
Code:
if $#myint && $#myint ==# 0 then 'y' else 'n' fi Quote:
|
||||
![]() |
![]() |
![]() |
#223 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,024
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I have a few iconsets that are identical for both emblems and column icons. Instead of maintaining two copies of them, I make a stored template and call that instead. Likely not the intended use for stored templates, but it works.
Last edited by ownedbycats; 12-13-2021 at 09:56 AM. |
![]() |
![]() |
![]() |
#224 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
You might make the process easier if when you create the rule that uses the stored template you pass the icon name(s) as parameters to the template. That way you would use the ability in the rules editor to add icons and get their names. The stored template would get the file names from the parameter list. With this technique you can have the code in one place but have different icons depending on the context. |
|
![]() |
![]() |
![]() |
#225 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,024
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Code:
if $rating ==# 0 && $#fanficstatus != '(In-Progress|Abandoned)' && $#vls !='Documentation & Manuals' then 'rating.png' Also, #vls should be an inlist. How do I set a "is not inlist"? ![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Library Management: various questions not worth their own thread | ownedbycats | Library Management | 220 | Today 10:58 AM |
[Metadata Source Plugin] Questions regarding parse select, docs and ref templates | Boilerplate4U | Development | 13 | 07-07-2020 02:35 AM |
Questions on Kobo [Interfered with another thread topic] | spdavies | Kobo Reader | 8 | 10-12-2014 11:37 AM |
[OLD Thread] Some questions before buying the fire. | darthreader13 | Kindle Fire | 7 | 05-10-2013 09:19 PM |
Thread management questions | meme | Feedback | 6 | 01-31-2011 05:07 PM |