So im trying to do my own little function here thats partly working. the idea is to save the integers as strings within an array each of up to 1000000000
im getting it to add to the first one then create another in its at 1000000000 but it seems to be adding the whole remaining amount to the created length when it should be only going to 1000000000 then making another if needed
/// Project: guilgui
// Created: 23-05-09
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "guilgui" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 )
global tokennum as string[0]
global addtokens as integer
global done as integer
done = 0
tokennum[0] = "900000000"
addtokens = 1900000000
do
local i as integer
if done = 0
repeat
DoMathTokens(addtokens, 'add')
done = 1
until done = 1
endif
for i = 0 to tokennum.length
print (tokennum[i])
next i
Sync()
loop
` Add commas
function DoMathTokens( InNum as integer, math as string )
` local variables
local s as integer
local temptk as integer
local temp as integer
select math
case 'add':
repeat
for s = 0 to tokennum.length
temptk = val(tokennum[s])
if InNum > 0
if temptk < 1000000000
temp = 1000000000 - temptk
if InNum >= temp
InNum = InNum - temp
tokennum[s] = str(val(tokennum[s]) + temp)
elseif InNum < temp
tokennum[tokennum.length] = str(val(tokennum[tokennum.length]) + temp)
InNum = InNum - temp
endif
endif
if s = tokennum.length and val(tokennum[s]) = 1000000000
tokennum.length = s + 1
tokennum[s + 1] = str(InNum)
InNum = InNum - InNum
endif
endif
next s
until InNum = 0
endcase
endselect
endfunction
edit : i have figured it out! now im one step closer to managing large token numbers!
/// Project: guilgui
// Created: 23-05-09
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "guilgui" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 )
global tokennum as string[0]
global addtokens as integer
global done as integer
done = 0
tokennum[0] = "900000000"
addtokens = 1900000000
do
local i as integer
if done = 0
repeat
DoMathTokens(addtokens, 'add')
done = 1
until done = 1
endif
for i = 0 to tokennum.length
print (tokennum[i])
next i
Sync()
loop
` Add commas
function DoMathTokens( InNum as integer, math as string )
` local variables
local s as integer
local temptk as integer
local temp as integer
local maxtokens as integer
maxtokens = 1000000000
select math
case 'add':
repeat
for s = 0 to tokennum.length
temptk = val(tokennum[s])
if InNum > 0
if temptk < maxtokens
temp = maxtokens - temptk
if InNum >= temp
InNum = InNum - temp
temptk = val(tokennum[s]) + temp
elseif InNum < temp
temptk = val(tokennum[s]) + InNum
InNum = 0
endif
tokennum[s] = str(temptk)
elseif s = tokennum.length and temptk = maxtokens
tokennum.length = tokennum.length + 1
endif
endif
next s
until InNum = 0
endcase
endselect
endfunction
also eventually i will have incoming amounts that are higher then 1000000000 so next i need to figure out how to break that down into smaller strings then "do math" with the current tokennums