09-05-2017, 10:40 AM
I just stumped upon Deji's SuperVars and this was mentioned in readme
I don't know what exactly it's means
but i make a quick test by trying make 1024 additional vars and found no problem. So, i've decided to share this. Might come in handy for coders. Removing limitations of vars
Quote:I originally created the script 'ExtraVars' which demonstrated
a way to extend the limitations on variable usage by directly
accessing memory using var arrays. A little example:
1@(31@,1i)
...
However, this method wasn't without fault. I started noticing
crashes caused by the index falling to certain values and
causing the game to write to a bad section of memory.
I don't know what exactly it's means
but i make a quick test by trying make 1024 additional vars and found no problem. So, i've decided to share this. Might come in handy for coders. Removing limitations of vars
Code:
0A90: [email protected] = 4 * 1024 // int
0AC7: [email protected] = var [email protected] offset // get the pointer to the last usable variable
0AC8: [email protected] = allocate_memory_size [email protected]
0A8F: [email protected] = [email protected] - [email protected] // get the offset from variable [email protected] to the memory
0016: [email protected] /= 4 // divide by array size to get the index
0085: [email protected] = [email protected] // (int)
0006: [email protected] = 0
0006: [email protected] = 0
//fill extra var [email protected]([email protected],4i) - [email protected]([email protected],4i)
for [email protected] = 0 to 1023 step 1
0A90: [email protected] = [email protected] * 2 // int
0085: [email protected]([email protected],4i) = [email protected] // (int)
0AD1: show_formatted_text_highpriority "[Offset: %d]~n~[%[email protected]: %d]" time 500 [email protected] [email protected] [email protected]([email protected],4i)
wait 0
000A: [email protected] += 1
end
//compare variable and value
while true
wait 0
0AD1: show_formatted_text_highpriority "[Offset: %d]~n~[[email protected]: %d][[email protected]: %d][[email protected]: %d]~n~[[email protected]: %d][[email protected]: %d][[email protected]: %d]~n~[[email protected]: %d][[email protected]: %d]" time 2000 [email protected] [email protected]([email protected],4i) [email protected]([email protected],4i) [email protected]([email protected],4i) [email protected]([email protected],4i) [email protected]([email protected],4i) [email protected]([email protected],4i) [email protected]([email protected],4i) [email protected]([email protected],4i)
end