View Single Post
Old 12-13-2021, 09:06 AM   #222
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,461
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
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.
I think that range operators should be avoided. They introduce problems with specifying whether the range is inclusive or exclusive, on both ends. They also can be hard to read. A pair of relational value checks such as your example permits specifying what is wanted at the edges.

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:
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.
Why do you want to add an icon when editing a stored template? There is nothing in that dialog that manipulates icons.

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:
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
That works well. Another way you can use if #number isn't formatted is
Code:
	if $#myint && $#myint ==# 0 then 'y' else 'n' fi
Quote:
STILL ANOTHER: Is it intended that custom functions appear as normal text in the template tester?
Yes. Calls to built-ins are shown differently, from calls to stored templates and custom functions.
chaley is offline   Reply With Quote