#Lua Summation for BlackATM
1 messages · Page 1 of 1 (latest)
ahoy hoy
so, here
this shows the sort of operation you're wanting to do
I mean the thing eremel sent works just fine
Unless the summation changes it's function at least
As long as it's always 1+2+3+...+x then (x/2)(x+1) is always right
anyway, I thought the post might be helpful for understanding the procedure, but I'm picky about actually understanding what I'm doing before I do it
there's always a simple calculation for linearly increasing sequences
i was looking into how to use that, i presumed it was something like card.ability.extra.final_value = (card.ability.extra.chips/2) * (card.ability.extra.chips+1)
(autism ™️)
mood af
you need the multiply symbol
So, if you want 1+2+3+4= 10, you can also use the equation
( N x ( N + 1 )) / 2
which, again, someone already probably posted.
probably 😭
but if you don't need to iterate over every chip taken, this is the way to do it imo
iterating over 400 chips every time you score a hand sounds like hell
it does, i would go and make it an actual scoring type but i had trouble with this 😭
thank you all for your help though 
i do need to learn loops, like badly
please never use a loop to do a summation of a linear sequence
yeah no,, that sounds like a massive performance hit
the above formula will let you quickly do it, so you'd just sub in Chips for N and then reset chips to 0 afterwards I think.
oh i dont even need to reset it, it works perfectly fine