Harvesting OtFBM tokens from NPC lists

Be sure to read and follow the guidelines for our forums.

Nov 14, 2021 5:23 pm
1. Grab your NPCs BBCode.

2. Visit https://token.otfbm.io/. It'll say "Thar be tokens here". It's like a premonition or something.

3. Press F12 and paste this code into the console window:

var npcs=`
[npcs="SKT"]
Augrek Brighthelm | https://imgur.com/MzE6Gur.jpg
Beldora | https://imgur.com/4GeTTJq.jpg
Darathra Shendrel | https://imgur.com/fkNf03l.jpg
Darz Helgar | https://imgur.com/8R6gykU.jpg
Duvessa Shane | https://imgur.com/gYvBfrY.jpg
Ghelryn Foehammer | https://imgur.com/E1ZrAOg.jpg
Lifferlas | https://imgur.com/q58uOwc.jpg
Markham Southwell | https://imgur.com/54cqnh6.jpg
Miros Xelbrin | https://imgur.com/V2UE8wz.jpg
Narth Tezrin | https://imgur.com/MO5aiLP.jpg
Naxene Drathkala | https://imgur.com/mUCQK3u.jpg
Oren Yogilvy | https://imgur.com/kKnPl5M.jpg
Othovir | https://imgur.com/wSqDRTP.jpg
Shalvus Martholio | https://imgur.com/FiQIhlf.jpg
Sir Baric Nylef | https://imgur.com/yaZzYTR.jpg
Sirac of Suzail | https://imgur.com/MHCAvLr.jpg
Urgala Meltimer | https://imgur.com/vgPgSz0.jpg
Yuan-ti | https://imgur.com/xbEiTYr.jpg
Zi Liang | https://imgur.com/2azZgwI.jpg
[/npcs]
`;

var npcRegEx=/^\\s*(.*)\\s*\\|\\s*(.*)\\s*$/igm;
var npcList=npcRegEx.exec(npcs);
document.body.innerHTML='[snippets="OtFBM tokens"]<br/>';

var npcObjects=[];

do {
    m = npcRegEx.exec(npcs);
    if (m) {npcObjects.push({name:m[1].trim(),avatar:m[2].trim()});}
} while (m);

function fetchNextNpc(i){
	fetch("https://token.otfbm.io/meta/"+btoa(npcObjects[i].avatar), 
		{method: 'GET',headers: {},mode: 'no-cors'})
	.then(function (response){
			response.text().then(function (text) {
			var regexBody=/<body>(.*)<\\/body>/g;
			var arr = regexBody.exec(text);
			document.body.innerHTML=document.body.innerHTML
								+'#'+npcObjects[i].name
								+'<br/>/a1-'+npcObjects[i].name
								+'~'+arr[1]+'<br/>';
			if((i+1)<npcObjects.length)
				{fetchNextNpc(i+1);}
			else
				{document.body.innerHTML=document.body.innerHTML+'[/snippets]'}
		})});
};

fetchNextNpc(0);

But replace the blue bit of text with your own NPC list, and press return.

4. The screen will show you your snippet list to paste into your custom character sheet.

https://i.imgur.com/w71iP3U.png
Now to use them.

Inside a map tag, your OtFBM tokens will be available as snippets.

https://i.imgur.com/V60PDpM.png
Last edited November 16, 2021 9:32 pm
Nov 14, 2021 5:34 pm
GPers says:
Adam! Are you serious? That's much too complicated!

I just wanted to turn a single image into a token, not mess about with snippets and npc lists.
1. Visit https://token.otfbm.io/. It'll say "Thar be tokens here".

2. Press F12 and paste this code into the console window, replacing the imageUrl value with your own image url:
var imageUrl='https://imgur.com/t1G6VLV.jpg';

fetch("https://token.otfbm.io/meta/"+btoa(imageUrl), 
	{method: 'GET',headers: {},mode: 'no-cors'})
	.then(function (response){
			response.text().then(function (text) {
			var regexBody=/<body>(.*)<\\/body>/g;
			var arr = regexBody.exec(text);
			document.body.innerHTML='/a1-Chappy~'+arr[1];
		})});

It'll come back with just that token.

https://i.imgur.com/GGSqTAl.png
Last edited November 16, 2021 9:33 pm

You do not have permission to post in this thread.