This uses Nilathanka's series to calculate pi. However, scratch rounds decimals to the nearest hundred quadrillionth or something, so it's not really accurate after a while.
@djpro for the text engine I can't really remember the calculate script, maybe it's from the scratch wiki Pi ≈ 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535