Rod's 'Drop-In' Markdown Notebook

Show off your RPG maps, campaigns, and tokens. Share your gaming experiences and stories under General Discussion and save this forum for things you've created that may help others run their own games. Use the subforums when appropriate.

Moderators: Azhrei, dorpond, trevor, Gamerdude

User avatar
rtakehara
Cave Troll
Posts: 37
Joined: Mon Nov 11, 2019 5:11 pm
Contact:

Re: Rod's 'Drop-In' Markdown Notebook

Post by rtakehara »

I was using it as test, It worked well as a stress test! But I already removed it!

You can set a custom image size adding a number after a space and equal sign, like this ![]([r:tableImage('tbl_Image',26)] =64 "Nildiks Room Description"), But I just updated again and by default it will display native resolution, you can change that in the now complete and fully operational preferences.
1. with code blocks it would be nice if single new lines are NOT ignored (double new lines work, but leave a lot of space which is not useful in a codeblock)
are you using the (```) or (```code) codeblock? the first one is just notation for normal info boxes with markdown syntax and all, since its easier to do and probably used more often, the second one is an actual codeblock, I also changed to use <pre> as Aliasmask suggested.

about the [r:... ops, already fixed it! And yeah I know I just need the outside one, but since I switch them on and off constantly for debugging, I just leave them by default...

ps.:That's one pretty crazy resolution Map Pin you got there :D

User avatar
wolph42
Deity
Posts: 9708
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Rod's 'Drop-In' Markdown Notebook

Post by wolph42 »

thnx. I'll delve into it. I wasn't aware of ```code, just ```, so i'll try that one. good to know how to set the image size! and yes that quite a hi res pic, but I took it straight from Nildik when I implemented his code in the BoT. Perhaps (obviously only with your permission) I'll do the same with your lib.

User avatar
rtakehara
Cave Troll
Posts: 37
Joined: Mon Nov 11, 2019 5:11 pm
Contact:

Re: Rod's 'Drop-In' Markdown Notebook

Post by rtakehara »

wolph42 wrote:
Thu Dec 05, 2019 6:16 am
thnx. I'll delve into it. I wasn't aware of ```code, just ```, so i'll try that one. good to know how to set the image size! and yes that quite a hi res pic, but I took it straight from Nildik when I implemented his code in the BoT. Perhaps (obviously only with your permission) I'll do the same with your lib.
Go for it!

User avatar
wolph42
Deity
Posts: 9708
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Rod's 'Drop-In' Markdown Notebook

Post by wolph42 »

rtakehara wrote:
Thu Dec 05, 2019 3:12 pm
Go for it!
thnx. All in due time.

for now:

This part:

Code: Select all

This function can be used for foreach() loops where the entered list contains (potentially) more then 1000 items. This will normally create an error as maximum 1000 items are allowed. This function will return an array with lists, eacht list consisting out of exactly 1000 items so: "1,2,..,1099" will return `["1,2,..1000", "1001, 1002,..1099"]`. Then you can use two foreach loops to cycle through the list.

<font color=red>**bot_delay**</font>(time)
delays the function with &#39;time&#39; ms
- **time: **milli seconds, so 1second is 1000.
ignores the double new line and just stitches it all together. Any idea why?
edit: ok I've seen the pattern: it ALWAYS ignores the new line, but most of the times it can't because of the fact that the previous section was a list or a block. Hence I guess the

Code: Select all

bla.

<font>bla</font>
Has an issue with the "<"

I've also tried using the code block:

Code: Select all

This function can be used for foreach() loops where the entered list contains (potentially) more then 1000 items. This will normally create an error as maximum 1000 items are allowed. This function will return an array with lists, eacht list consisting out of exactly 1000 items so: "1,2,..,1099" will return `["1,2,..1000", "1001, 1002,..1099"]`. Then you can use two foreach loops to cycle through the list.

``` code 
<font color=red>**bot_delay**</font>(time) 
```
delays the function with &#39;time&#39; ms
- **time: **milli seconds, so 1second is 1000.
and although the new line now is present, the code block is not. I just get ```code bot_delay...etc.
Note that I tried both ```code and ``` code. Neither work.

For stress test purposes I've again added the markup file:
Manual Functions Markup.txt
(27.8 KiB) Downloaded 85 times
this contains the BoT Functions Manual. You'll see that sometimes the newlines are shown and sometimes not. Not entirely clear why.

One other thing: close to the bottom I've tries <pre> </pre> inside a block and that works...however I get a couple of newlines at the start of the block, not really nice.

Also when using rank 3 title, the text is very close to the title bar, again not very nice to look at.

edit: one last thing, I noticed when I use the cyberpunk theme that the </font> use in my markup turns teh text back to black making it unreadable. Could you have a look and make a suggestion how I can properly (that is: using markup) display them, like I now do in bold-red, but then with native markup makeup? thnx!

User avatar
rtakehara
Cave Troll
Posts: 37
Joined: Mon Nov 11, 2019 5:11 pm
Contact:

Re: Rod's 'Drop-In' Markdown Notebook

Post by rtakehara »

That's exactly it, the code does have a problem with <, I did it because I couldn't find a way to differentiate paragraphs from any other text separated by an empty line, so I made it place a paragraph on every empty line, and then I removed the ones followed by a < (since it was one of the last steps, so tables, lists and other html elements are already in place), and then added exceptions, probably making a regex expression that detects paragraphs flawlessly would be ideal, but I am new to regex and adding exceptions every time something goes wrong will eventually be flawless, right? Already added "<font" as an exception, should work properly.

Oh, and also since the code tries to keep intact everything between <text>anything here</text>, I was wondering why it worked with <font> but it happened because <font color= etc...> is not identical to </font>, I will improve the code to just include the first part, like <font and <table...

about the ```code, you tried with and without space? because it was ignoring spaces before, but it worked well without space. it work fine now.

the space it is adding is because paragraphs are separated by empty lines, but when you add ```then a new line, it wont add a paragraph because it doesn't have any empty lines, and then text inside those boxes would have the first line unaligned and, so those boxes add a <p> automatically now, for now I can only think of over-complicated ways to fix that, but you could get the same effect without the space with:

Code: Select all

```
```code
[H: '&lt;!- ONTOKENMOVE MACROS - &gt;']
[defineFunction("self", "[email protected]:OnTokenMove",1,1)]
[defineFunction("nself", "[email protected]:OnTokenMove",1,1)]
[defineFunction("all", "[email protected]:OnTokenMove",1,1)]
[defineFunction("gm", "[email protected]:OnTokenMove",1,1)]
[defineFunction("ngm", "[email protected]:OnTokenMove",1,1)]
[defineFunction("selfgm", "[email protected]:OnTokenMove",1,1)]
[defineFunction("nselfgm", "[email protected]:OnTokenMove",1,1)]
[defineFunction("ownergm", "[email protected]:OnTokenMove",1,1)]
[defineFunction("nownergm", "[email protected]:OnTokenMove",1,1)]
```
```
Oh! About the text, I cracked my head for sometime about that, it happens because you didn't leave a space between the code block and the paragraph (probably...) and the css color is set to affect text inside <p> and was wondering if there is a way to affect it globally, probably setting it to <body> instead should work. (an hour later) Yeah, it did!

About the rank 3 title, what text? the paragraph the title, if its the paragraph, it may be because of the <font> tags that caused paragraphs to not exist, so that text has no margins and end up too close, if it's the title itself, I don't know how to make it render farther away =/ but there are a lot of css functions that doesn't work on maptool

Markdown doesn't support color as default, but HTML should do fine, or as the guy who idealized it said
HTML is a publishing format; Markdown is a writing format. (...) For any markup that is not covered by Markdown’s syntax, you simply use HTML itself.


User avatar
rtakehara
Cave Troll
Posts: 37
Joined: Mon Nov 11, 2019 5:11 pm
Contact:

Re: Rod's 'Drop-In' Markdown Notebook

Post by rtakehara »

Nice

User avatar
wolph42
Deity
Posts: 9708
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Rod's 'Drop-In' Markdown Notebook

Post by wolph42 »

ok I'm advancing the manual (adding new sections) and now I get a :
net.rptools.parser.ParserException: getMacroProps(): first argument must be a number.
when I click 'setup'. Attached the new lib.
Lib_Notebook.rptok
(924.83 KiB) Downloaded 15 times
edit: apparently its the "," in the 'doors' section. something for you to look at and catch that error either by giving a warning (don't do that) or creating a workaround (e.g. find and replace before you parse it).

With that fixed I ran into the 2nd issue: all the chapters are placed under: "1. Welcome". Creating a new chapter under option yields no result!!

edit: I noticed that I didn't use the latest version, but the issues in the last version are the same. Also HOW can you place the the content on another lib and then use it in the notebook? (or is this not yet possible?)

edit2: and I ran in yet another issue in the latest version:
Lib_Notebook2.rptok
(898.27 KiB) Downloaded 15 times
in this version I get ANOTHER 'first argument must be a number' (different spot). I've added a pause() function which might render an error when you test it, but I would definitely check it out with the pause as it apparently skips a couple of menu items in the parsing (no clue why) but as you use roll.count you end up with an empty value as you've reached the end of the list.
If you don't have pause installed, use this one:
lib_pause.rptok
(139.52 KiB) Downloaded 14 times
. run 'oncampaignload' macro before use (or save and reload the campaign).

User avatar
rtakehara
Cave Troll
Posts: 37
Joined: Mon Nov 11, 2019 5:11 pm
Contact:

Re: Rod's 'Drop-In' Markdown Notebook

Post by rtakehara »

Oh yeah, I see the error "," error, it happens because when sorting, the index it uses "," as delim, fixed it by replacing "'," with "&#44;" before sorting, should work fine now.

Also changed how the index organizes itself to require less input from the user, now it will/should show the group name, then any heading 1, then headings 2, in the order they appear in the macro list.
Also HOW can you place the the content on another lib and then use it in the notebook?
Just place any empty (or with markdown macros) Lib token and when you click Setup, put the name of that token, instead of notebook, It will add a green and red macros to open and change preferences of that token. You can also drag those macros to the campaign macros.

Also also, while setting up the last token you sent, I was getting a weird error that I couldn't fix BUT if you set the token properties to Basic it worked, no idea why, but it works with new ones, and after fixing it I could even change the properties back and it still worked fine, so I assume (and hope) it will not cause any more trouble


User avatar
wolph42
Deity
Posts: 9708
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Rod's 'Drop-In' Markdown Notebook

Post by wolph42 »

ok, it does 'work' but I noticed that you didn't carefully check my suggestion using pause(). As it turns out your tool is still skipping certain macro and don't add them to the index. Again this is due to the use of (). Removing those fixes that.

Next issue I run into is that the order is incorrect. I've ordered the main topics as 1,2,3,4 etc. and subtopics first one appearing under 4, which I give order number 4a, 4b, etc, but this topic appears under 3!!. I''l finish the work and then share the lib. Edit here it is:
Lib_Manual.rptok
(47.15 KiB) Downloaded 15 times

What you'll see is that the 'special pads' sub-section ends up one topic higher (reported mishaps); dito for events and utilities.

I've also moved it now to its own library: that works great!!

edit: hmm I also now notice that out of nowhere there all of a sudden a lot of lib:notebooks. Apparently everytime I click 'manual' it creates a new lib... which I can't repeat anymore...must have been a fluke

Finally another thingie, it takes too long to load. You can remedy this my storing the end (rendered) result in a token property and call that in the form. And ONLY render when stuff has changed and I would suggest to just have a macro for that: '(re)render index'.

edit: apparently not 'finally' as there's more... I've switched theme to Github (options-> preference -> github) and I got a nice 'loading...' screen...and thats it. Nothing further happens except for an error in the chat:
Can not find map "Grasslands" in function "setCurrentMap".
I've also had a look at your calculator code, which was quite unreadable, I've done the indentation, now Im gonna have a look at the actual code:

Code: Select all

[h:formula=getStrProp(macro.args,"formula")]
[h:output=getStrProp(macro.args,"output")]
[h:entry=getStrProp(macro.args,"entry")]
[h:lastentry=getStrProp(macro.args,"lastentry")]
[h:memory=getStrProp(macro.args,"memory")]
[h:edit=getStrProp(macro.args,"edit")]

[h,if(entry==lastentry),code:{
	[h:repeat=string(if(entry=="+"||entry=="-"||entry=="*"||entry=="/","",entry))]
	[h:formula=formula+string(repeat)]
};{
	[h:formula=formula+string(entry)]
}]

[h:numbercolor="#ddd8d0"]
[h:dicecolor="#d0cac3"]
[h:delcolor="#ec2626"]
[h:signalcolor="#FFBD77"]
[h:equalcolor="#FFAD56"]

[h,if(output==1),code:{
	[h:memory=eval(string(if(formula=="",0,formula)))]
};{}]

[h:share=memory]

[h,if(edit==1):res=input("formula|"+formula+"||text|span=true width=30");res=1]
[h:abort(res)]

[dialog("Calculator","width=251; height=402; temporary=0; input=1; noframe=0"): {
	<table width=226 border=0 align=center valign=middle>
		<tr bgcolor=#e3dcd1>
			<td width=25%>
				<font color=#4C4C4C size=2 style="text-decoration:none">
				[r:macroLink("edit","[email protected]","","edit=1;formula="+formula+";memory="+memory)]
			<td colspan=3 height=35 width=75% align=right>
				<font size=[r:if(length(formula)<19,4,if(length(formula)<22,3,if(length(formula)<26,2,1)))]>
				[r:replace(replace(formula,"\\*","x"),"/","&divide;")]
			</td>
		</tr><tr>
			<td>
				<font color=#4C4C4C size=2 style="text-decoration:none">
				[r:macroLink("share","[email protected]","all","share="+share+";formula="+formula+";memory="+memory)]
			</td>
		</tr>
			<td colspan=3 height=55 align=right>
				<font size=[r:if(length(memory)<8,7,if(length(memory)<12,6,if(length(memory)<15,5,4)))]>
				[r:if(length(memory)<15,"","<b>")]
				[r:memory]
			</td>
		</tr><tr>
			<td height=35 align=center bgcolor=[r:dicecolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;d%&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=d100;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:dicecolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;dx&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=d;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:delcolor]>
				<font color=white size=4 style="text-decoration:none"><b>
				[h:delformula=substring(formula,0,if(length(formula)==0,0,length(formula)-1))]
				[r:macroLink("&nbsp;&nbsp;del&nbsp;&nbsp;","[email protected]","","formula="+delformula+";memory="+memory)]
			</td><td align=center bgcolor=[r:delcolor]>
				<font color=white size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;AC&nbsp;&nbsp;&nbsp;","[email protected]","","")]
			</td>
		</tr><tr>
			<td align=center height=35 bgcolor=[r:dicecolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;d4&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=d4;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:dicecolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;d6&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=d6;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:dicecolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;d8&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=d8;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:signalcolor]>
				<font color=white size=5 style="text-decoration:none">
				[r:macroLink("&nbsp;&nbsp;&nbsp;&divide;&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=/;lastentry="+entry+";memory="+memory)]
			</td>
		</tr><tr>
			<td align=center height=35 bgcolor=[r:dicecolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;d10&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=d10;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:dicecolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;d12&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=d12;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:dicecolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;d20&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=d20;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:signalcolor]><b>
				<font color=white size=5 style="text-decoration:none">
				[r:macroLink("&nbsp;&nbsp;&nbsp;&#215;&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=*;lastentry="+entry+";memory="+memory)]
			</td>
		</tr><tr>
			<td align=center height=35 bgcolor=[r:numbercolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;&nbsp;7&nbsp;&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=7;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:numbercolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=8;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:numbercolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;&nbsp;9&nbsp;&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=9;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:signalcolor]>
				<font color=white size=5 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=-;lastentry="+entry+";memory="+memory)]
			</td>
		</tr><tr>
			<td align=center height=35 bgcolor=[r:numbercolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=4;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:numbercolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=5;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:numbercolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=6;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:signalcolor]>
				<font color=white size=5 style="text-decoration:none">
				[r:macroLink("&nbsp;&nbsp;&nbsp;+&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=+;lastentry="+entry+";memory="+memory)]
			</td>
		</tr><tr>
			<td align=center height=35 bgcolor=[r:numbercolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=1;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:numbercolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=2;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:numbercolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=3;lastentry="+entry+";memory="+memory)]
			</td><td align=center rowspan=2 bgcolor=[r:equalcolor]>
				<font color=white size=3 style="text-decoration:none">
				[r:macroLink("&nbsp;<br>&nbsp;&nbsp;<font size=6>=</font>&nbsp;&nbsp;<br>&nbsp;","[email protected]","","formula="+formula+";output=1;lastentry="+entry+";memory="+memory)]
			</tr><tr>
			<td align=center height=35 bgcolor=[r:numbercolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=0;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:dicecolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=(;lastentry="+entry+";memory="+memory)]
			</td><td align=center bgcolor=[r:dicecolor]>
				<font color=black size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;&nbsp;)&nbsp;&nbsp;&nbsp;&nbsp;","[email protected]","","formula="+formula+";entry=);lastentry="+entry+";memory="+memory)]
			</td>
		</tr>
	</table>
}]

[r,if(formula==""),code:{};{
	<table width="170px"  style="border:1px solid black;">
		<tr>
			<td bgcolor=#4C4C4C valign=middle height=20>
				<font color=white><b>
				&nbsp;
				Calculator
			</td>
		</tr><tr>
			<td></td>
		</tr>
		
		<table width=100% bgcolor=#ece9d8>
			<tr>
				<td align=right valign=middle bgcolor=#e3dcd1 height=25>
					[r:replace(replace(formula,"\\*","x"),"/","&divide;")]
					&nbsp;
				</td>
			</tr><tr>
				<td align=right height=35>
					<font size=6>
					[r:share]
				</td>
			</tr>
		</table>
	</table>
}]
update (in progress):

Code: Select all

[h:formula		= getStrProp(macro.args,"formula")]
[h:output		= getStrProp(macro.args,"output")]
[h:entry		= getStrProp(macro.args,"entry")]
[h:lastentry	= getStrProp(macro.args,"lastentry")]
[h:memory		= getStrProp(macro.args,"memory")]
[h:edit			= getStrProp(macro.args,"edit")]

[h,if(entry==lastentry),code:{
	[h:repeat=string(if(entry=="+"||entry=="-"||entry=="*"||entry=="/","",entry))]
	[h:formula	= formula+string(repeat)]
};{
	[h:formula	= formula+string(entry)]
}]

[h:numbercolor	= "#ddd8d0"]
[h:dicecolor	= "#d0cac3"]
[h:delcolor		= "#ec2626"]
[h:signalcolor	= "#FFBD77"]
[h:equalcolor	= "#FFAD56"]
[h:font			= "<font color=black size=4 style='text-decoration:none'><b>"]
[h:button		= "
		<td height=35 align=center bgcolor=%s>
		<font color=%s size=4 style='text-decoration:none'><b>
		<a href='macro://[email protected]:test//Impersonated?formula=%{formula}&entry=%s&lastentry=%{entry}&memory=%{memory}'>&nbsp;&nbsp;&nbsp;%s&nbsp;&nbsp;&nbsp;</a>
		</td>
"]

[h,if(output==1):memory=eval(string(if(formula=="",0,formula)))]

[h:share=memory]

[h,if(edit==1): abort(input("formula|"+formula+"||text|span=true width=30"))]

[dialog("Calculator","width=251; height=402; temporary=0; input=1; noframe=0"): {
	<table width=226 border=0 align=center valign=middle>
		<tr bgcolor=#e3dcd1>
			<td width=25%>
				<font color=#4C4C4C size=2 style="text-decoration:none">
				[r:macroLink("edit","[email protected]","","edit=1;formula="+formula+";memory="+memory)]
			<td colspan=3 height=35 width=75% align=right>
				<font size=[r:if(length(formula)<19,4,if(length(formula)<22,3,if(length(formula)<26,2,1)))]>
				[r:replace(replace(formula,"\\*","x"),"/","&divide;")]
			</td>
		</tr><tr>
			<td>
				<font color=#4C4C4C size=2 style="text-decoration:none">
				[r:macroLink("share","[email protected]","all","share="+share+";formula="+formula+";memory="+memory)]
			</td>
		</tr>
			<td colspan=3 height=55 align=right>
				<font size=[r:if(length(memory)<8,7,if(length(memory)<12,6,if(length(memory)<15,5,4)))]>
				[r:if(length(memory)<15,"","<b>")]
				[r:memory]
			</td>
		</tr><tr>
				[r:strformat(button, dicecolor, "black", "d100", "d%")]
				[r:strformat(button, dicecolor, "black", "d", "dx")]
			<td align=center bgcolor=[r:delcolor]>
				<font color=white size=4 style="text-decoration:none"><b>
				[h:delformula=substring(formula,0,if(length(formula)==0,0,length(formula)-1))]
				[r:macroLink("&nbsp;&nbsp;del&nbsp;&nbsp;","[email protected]","","formula="+delformula+";memory="+memory)]
			</td><td align=center bgcolor=[r:delcolor]>
				<font color=white size=4 style="text-decoration:none"><b>
				[r:macroLink("&nbsp;&nbsp;&nbsp;AC&nbsp;&nbsp;&nbsp;","[email protected]","","")]
			</td>
		</tr><tr>
				[r:strformat(button, dicecolor, "black", "d4", "d4")]
				[r:strformat(button, dicecolor, "black", "d6", "d6")]
				[r:strformat(button, dicecolor, "black", "d8", "d8")]
				[r:strformat(button, signalcolor, "white", "/", "&divide;")]
		</tr><tr>
				[r:strformat(button, dicecolor, "black", "d10", "d10")]
				[r:strformat(button, dicecolor, "black", "d12", "d12")]
				[r:strformat(button, dicecolor, "black", "d20", "d20")]
				[r:strformat(button, signalcolor, "white", "*", "&#215;")]
		</tr><tr>
				[r:strformat(button, numbercolor, "black", "7", "7")]
				[r:strformat(button, numbercolor, "black", "8", "8")]
				[r:strformat(button, numbercolor, "black", "9", "9")]
				[r:strformat(button, signalcolor, "white", "-", "-")]
		</tr><tr>
				[r:strformat(button, numbercolor, "black", "4", "4")]
				[r:strformat(button, numbercolor, "black", "5", "5")]
				[r:strformat(button, numbercolor, "black", "6", "6")]
				[r:strformat(button, signalcolor, "white", "+", "+")]
		</tr><tr>
				[r:strformat(button, numbercolor, "black", "1", "1")]
				[r:strformat(button, numbercolor, "black", "2", "2")]
				[r:strformat(button, numbercolor, "black", "3", "3")]
			</td><td align=center rowspan=2 bgcolor=[r:equalcolor]>
				<font color=white size=3 style="text-decoration:none">
				[r:macroLink("&nbsp;<br>&nbsp;&nbsp;<font size=6>=</font>&nbsp;&nbsp;<br>&nbsp;","[email protected]","","formula="+formula+";output=1;lastentry="+entry+";memory="+memory)]
		</tr><tr>
				[r:strformat(button, numbercolor, "black", "0", "0")]
				[r:strformat(button, dicecolor, "black", "(", "(")]
				[r:strformat(button, dicecolor, "black", ")", ")")]
		</tr>
	</table>
}]

[r,if(formula==""),code:{};{
	<table width="170px"  style="border:1px solid black;">
		<tr>
			<td bgcolor=#4C4C4C valign=middle height=20>
				<font color=white><b>
				&nbsp;
				Calculator
			</td>
		</tr><tr>
			<td></td>
		</tr>
		
		<table width=100% bgcolor=#ece9d8>
			<tr>
				<td align=right valign=middle bgcolor=#e3dcd1 height=25>
					[r:replace(replace(formula,"\\*","x"),"/","&divide;")]
					&nbsp;
				</td>
			</tr><tr>
				<td align=right height=35>
					<font size=6>
					[r:share]
				</td>
			</tr>
		</table>
	</table>
}]

User avatar
rtakehara
Cave Troll
Posts: 37
Joined: Mon Nov 11, 2019 5:11 pm
Contact:

Re: Rod's 'Drop-In' Markdown Notebook

Post by rtakehara »

ok, it does 'work' but I noticed that you didn't carefully check my suggestion using pause(). As it turns out your tool is still skipping certain macro and don't add them to the index. Again this is due to the use of (). Removing those fixes that.
yeah, I don't really get how this pause works, I will give it a look when I get some time
Next issue I run into is that the order is incorrect. I've ordered the main topics as 1,2,3,4 etc. and subtopics first one appearing under 4, which I give order number 4a, 4b, etc, but this topic appears under 3!!
Yeah I give it some test, and it appears maptool sort its macros in a different way than it's sort function (natural or alphabetical), I may be wrong, but I couldn't make it sort the same way... It works if you use just numbers, but as soon as you put letters it sorts weird... needs more testing...
Finally another thingie, it takes too long to load. You can remedy this my storing the end (rendered) result in a token property and call that in the form. And ONLY render when stuff has changed and I would suggest to just have a macro for that: '(re)render index'.
OH? great idea! It was bothering me how slow it gets, that should solve it!
edit: apparently not 'finally' as there's more... I've switched theme to Github (options-> preference -> github) and I got a nice 'loading...' screen...and thats it. Nothing further happens except for an error in the chat:
Oh, it probably thinks its library location is on another map, try hitting setup again

Sorry for the late response, I am on vacation and not having much time

User avatar
wolph42
Deity
Posts: 9708
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Rod's 'Drop-In' Markdown Notebook

Post by wolph42 »

yeah, I don't really get how this pause works, I will give it a look when I get some time
just place the lib:toke in your campaign i gave earlier. and run the code i gave as well. you will get pop-ups with the value of the variables at the position in the code where 'pause' was inserted. Its a debug method.
Yeah I give it some test, and it appears maptool sort its macros in a different way than it's sort function (natural or alphabetical), I may be wrong, but I couldn't make it sort the same way... It works if you use just numbers, but as soon as you put letters it sorts weird... needs more testing...
you can sort both on A+ and N+ (IRC) but by all means read the wiki.!

enjoy your vacation!

Bernie_McGee
Kobold
Posts: 1
Joined: Sun Apr 26, 2020 1:21 pm

Re: Rod's 'Drop-In' Markdown Notebook

Post by Bernie_McGee »

Hi Rod! Thanks for your work on this macro, it really fills in a feature I was looking for.

Is it possible to create a link to other notebook entries? I tried

Code: Select all

[link]([email protected]:Notebook)
which of course didn't work (I didn't really expect it too). I also tried

Code: Select all

[link]([email protected]:Notebook "libName=1.Welcome;libLocation=Lib:Notebook")
but that didn't work either. I'm brand new to macros in Maptool, so I apologize if the answer is somewhat obvious!

User avatar
rtakehara
Cave Troll
Posts: 37
Joined: Mon Nov 11, 2019 5:11 pm
Contact:

Re: Rod's 'Drop-In' Markdown Notebook

Post by rtakehara »

Bernie_McGee wrote:
Sun Apr 26, 2020 1:26 pm
Hi Rod! Thanks for your work on this macro, it really fills in a feature I was looking for.

Is it possible to create a link to other notebook entries? I tried

Code: Select all

[link]([email protected]:Notebook)
which of course didn't work (I didn't really expect it too). I also tried

Code: Select all

[link]([email protected]:Notebook "libName=1.Welcome;libLocation=Lib:Notebook")
but that didn't work either. I'm brand new to macros in Maptool, so I apologize if the answer is somewhat obvious!
I don't know which version you are using, but the latest one (2.4.3) supports linking to itself, yes!

it would be like this

Code: Select all

[Setup Page](note "1. Getting [email protected]")
were "Notes" after the "@" is the name of the notebook, and "1. Getting Started" is the title of the page

It can be done in the old version (1.22.2) too, probably, but its more complicated and I kinda abandoned that version, the new one uses the same syntax though so you should be fine, here's the link

Post Reply

Return to “User Creations”