Hi everybody I haven't been on here in a while and I have been outlining a new game concept. I am wondering does Megazeux support any kind of Array constructs? One dimension, two dimensional arrays? If so where do I find the information on it? If not is there something similar tip trick that you can do? Thanks
Page 1 of 1
Arrays? Does Megazeux have Arrays?
#2
Posted 07 January 2013 - 04:19 AM
Not quite, but there are two similar things you can do:
#1 Interpolation in counter names
You can interpolate counters into the names of other counter names to simulate things like arrays. You can also do this when sending labels, to create something like a switch/case statement.
#2 String indexing
With this method, you create a string and index its bytes. This consumes less memory and makes save files smaller but is limited to values 0-255. It is also limited to one dimension unless you use interpolation in the string name itself (as above) or flatten the addressing with something like ('y'*'width'+'x').
#1 Interpolation in counter names
You can interpolate counters into the names of other counter names to simulate things like arrays. You can also do this when sending labels, to create something like a switch/case statement.
loop start set "items&LOOPCOUNT&" "LOOPCOUNT" loop 9
#2 String indexing
With this method, you create a string and index its bytes. This consumes less memory and makes save files smaller but is limited to values 0-255. It is also limited to one dimension unless you use interpolation in the string name itself (as above) or flatten the addressing with something like ('y'*'width'+'x').
set "COMMANDS" 10000
set "$string.321" 'a'
loop start
if "$string.('LOOPCOUNT')" = 'a' "foundIt"
loop "('$string.length'-1)"
* "Didn't find 'a' in the string."
end
: "foundIt"
* "Found 'a' at &LOOPCOUNT&!"
end
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"
xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
Share this topic:
Page 1 of 1

Help





