Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Single use custom function stored in a cell [closed]

$
0
0

I'm creating a Google spreadsheet that contains every spell in the TTRPG game, D&D. Each spell has different effects, some of which include damage. The damage isn't a flat amount but scales based on level (a bit oversimplified but it's enough). Because it's not a flat amount and scales differently for each spell, I can't include numbers in the row or use some formula that I expect to work for everything as there will be hundreds of exceptions.

My initial idea was to have a column in each row that's effectively its own custom function that takes a level input and can return whatever it needs to for that spell. Something akin to the following in JavaScript:

const spells = [  {    spell: 'Fireball',    damage: function(level) { return 'some value' },  },]

As far as I know, however, this isn't possible. Am I correct in my assumption or is there a way to do something like this that I'm not aware of?

To get ahead of a possible suggestion, I cannot create custom functions within Google Sheets as I'd need to be able to reference the function with a string, and there are over 500 spells so it's not exactly a feasible option either.


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>