You will only be making things worse by trying to re-use globals like that. Just have a big list of globals at the top of your script file, they aren't really hard to keep track of.
Every script I write has a big block like this at the top:
Code: Select all
global variable(0, recursion)
global variable(1, growth cycles)
global variable(3, effects)
global variable(4, hero atk frames)
global variable(5, metadata)
global variable(6, find x)
global variable(7, find y)
global variable(8, generating)
global variable(9, stairs ignore)
global variable(10, update counter)
global variable(11, spawn x)
global variable(12, spawn y)
global variable(13, meters)
global variable(14, health meter)
global variable(15, stamina meter)
global variable(16, monster meter)
global variable(17, monster meter ticks)
global variable(18, regen state)
global variable(19, select menu done)
global variable(20, current monster hp)
global variable(21, current monster max)
global variable(22, spawn cultist x)
global variable(23, spawn cultist y)
global variable(24, spawn misa x)
global variable(25, spawn misa y)
global variable(26, spawn bacontologist x)
global variable(27, spawn bacontologist y)
global variable(28, baconthulhu dead)
global variable(29, monster kills on date)
global variable(30, death count)
global variable(31, c:recursion)
global variable(32, c:not okay)
global variable(33, c:okay)
global variable(34, c:zone)
global variable(35, chalk meter)
global variable(36, chalk decay)
global variable(37, jiffy level)
global variable(38, jiffy meter)
global variable(39, cur floor variant)
global variable(40, repel level)
global variable(41, repel meter)
global variable(42, force save steps)
global variable(43, money sl)
global variable(44, passage ms)
global variable(45, baconthulhu anim)
global variable(46, step count)
global variable(47, v:hour)
global variable(48, v:min)
global variable(49, v:sec)
Don't worry about running out of globals.
If you want to keep them semi-organized, you could group them by number, like starting the globals for one purpose at 1000, and the globals for another purpose at 2000