View Single Post
Old 03-31-2021, 05:58 PM   #7
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,398
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
The problem seems to be you using '=' instead of '==' to do comparisons. The first does an assignment and returns the value being assigned. The second does the comparison.

Does this template do what you expect? I changed lines 15, 16, 20, and 21. Sorry I didn't notice the error before post #2.
Code:
program:
ids = $identifiers;
if select(ids, 'url') then
	status = $#fanficstatus;
	publisher = $publisher;
	a = select(ids, 'ao3');
	f = select(ids, 'ffnet');
	if
		(a || f)
		&& '(Archive of Our Own|Fanfiction.net)' in publisher
		&& '(Completed|Abandoned|Oneshot)' in status
		then "metadata.png:"
	elif
		!a
		&& publisher == 'Archive of Our Own'
		&& status == 'In-Progress'
	then "metadata.png:"
	elif
		!f
		&& publisher == 'FanFiction.net'
		&& status == 'In-Progress'
		then "metadata.png:"
	fi
fi
FWIW: people have mistaken assignment for equality since forever. That is one reason why "newer" languages don't allow assignment as an expression or use a different operator such as ":=". It is too late for me to make either change because it would surely break existing templates.
chaley is offline   Reply With Quote