Hello Everyone!
I'm a bit of a novice when it comes to html/perchance scripting and I've been bashing my head against trying to get something to work in perchance that I could solve pretty easily outside of perchance.
Fundamentally, all I want is to be able to input a number and it roll on a table that number of times and add the results together to an output. This is for individual treasure that I am doing in my D&D game, and I'm just tired of pressing the buttons and adding the values together. I've scrounged around other loot gens in perchance, none of them seem to do this that I could lift anything from, and any form of LLM doesn't understand perchance scripting at all...
Currently, my old set up for this is pretty basic.
PERCHANCE
dice = {import:dice-plugin} excludeItems = {import:exclude-items-plugin} joinLists = {import:join-lists-plugin} filterList = {import:filter-list-plugin} consumableListLoop = {import:consumable-list-loop-plugin} image = {import:text-to-image-plugin} tap = {import:tap-plugin} rollTable = {import:roll-table-plugin} clicked = terrain
output3 [rollTable(itreasureone, dice("1d100"))] ^[clickedtreasure == "CR0+"] [rollTable(itreasuretwo, dice("1d100"))] ^[clickedtreasure == "CR5+"] [rollTable(itreasurethree, dice("1d100"))] ^[clickedtreasure == "CR11+"] [rollTable(itreasurefour, dice("1d100"))] ^[clickedtreasure == "CR17+"]
itreasureone 1-30, [dice("5d6")] Copper Pieces 31-60, [dice("4d6")] Silver Pieces 61-70, [dice("3d6")] Electrum Pieces 71-95, [dice("3d6")] Gold Pieces 96-100, [dice("1d6")] Platinum Pieces
itreasuretwo 1-30, [dice("4d6") * 100] Copper Pieces and [dice("1d6") * 10] Electrum Pieces 31-60, [dice("6d6") * 10] Silver Pieces and [dice("2d6") * 10] Gold Pieces 61-70, [dice("3d6") * 10] Electrum Pieces and [dice("2d6") * 10] Gold Pieces 71-95, [dice("4d6") * 10] Gold Pieces 96-100, [dice("2d6") * 10] Gold Pieces and [dice("3d6")] Platinum Pieces
itreasurethree 1-20, [dice("4d6") * 100] Silver Pieces and [dice("1d6") * 100] Gold Pieces 21-35, [dice("1d6") * 100] Electrum Pieces and [dice("1d6") * 100] Gold Pieces 36-75, [dice("2d6") * 100] Gold Pieces and [dice("1d6") * 10] Platinum Pieces 76-100, [dice("2d6") * 100] Gold Pieces and [dice("2d6") * 10] Platinum Pieces
itreasurefour 1-15, [dice("2d6") * 1000] Electrum Pieces and [dice("8d6") * 100] Gold Pieces 16-55, [dice("1d6") * 1000] Gold Pieces and [dice("1d6") * 100] Platinum Pieces 56-100, [dice("1d6") * 1000] Gold Pieces and [dice("2d6") * 100] Platinum Pieces
HTML
My initial thoughts was to add in something in html like this
and just use the "num" value as a decreasing value in a while loop, though I can't find anything on the syntax for the while loop use case in perchance even though it seems to be working well enough to crash?
Ultimately, been trying to get it to output (in case of like 6 rolls being made) something basic like
55cp, 0sp, 15ep, 10gp, 4pp
Any pointers would be appreciated!