Calculator Community > The Axe Parser Project

Buff() Command Help

(1/1)

Pixilized:
In Axe, there is a Buff() command to make a custom buffer. It takes an input of a size, and an optional fill with constant, and returns a pointer to the new buffer.

However, when I run programs using the command, the size I choose doesn’t seem to affect how it runs, even when I choose a buffer size of one byte.

Why does the buffer size matter if it doesn’t affect the program? Or does it affect the program and I’m just to dense to notice it?

In addition, is the constant it can be filled with a hexadecimal code of an entire screen? Because I think that’s how it works, from what I’ve seen in the source code of Cookie Clicker Axe.

Thanks in advance!

E37:
Axe's documentation uses 'buffer' to mean 'a pointer to some data'. Any command that takes a buffer is really asking for a pointer. As long as the data you are pointing to is big enough for whatever operation the command is doing, it is happy.

Buff() makes a buffer by adding bytes to your program. If you make one with a size of 1000, it adds 1000 bytes to your program's size. The lines :Data(0, 0, 0, 0, 0)->X and Buff(5, 0)->X both do the same thing. Buff() is just a convenience if you want a lot of space.
It is a way to get more scratch memory if you run out of space in L1-L6 and don't want to use GetCalc() to create a temporary file to store data in. For example, if you want to store a screenshot (which is 768 bytes) and you are using L3 and L6 for something else, you could use Buff(768)->oScreenshotStorage to have a place to store your data. Since DispGraph can take a pointer, DispGraph(oScreenshotStorage) would display the contents of the buffer. (Of course you would probably want to put something there first)

I can give more detailed help or suggestions if you tell me what you are trying to do.

Pixilized:
Okay, thank you, that information was very helpful.

As for what I wanted to do with it, I’m planning on making a game that has a striped background, and I wanted to put it on a separate buffer to save space so I can use the main and back buffers for more important objects. (I have no code to show, as I haven’t started the project yet).

And if it just returns normal data, does that mean that the following hexadecimal, when stored to a pointer, can be drawn as a buffer with a line on the left side of the screen?

[800000000000000000000000 (repeat shown hexadecimal for 63 additional rows, total of 64 rows)…]

E37:

--- Quote from: Pixilized on October 01, 2023, 08:34:44 pm ---And if it just returns normal data, does that mean that the following hexadecimal, when stored to a pointer, can be drawn as a buffer with a line on the left side of the screen?

[800000000000000000000000 (repeat shown hexadecimal for 63 additional rows, total of 64 rows)…]

--- End quote ---
Yes. DispGraph(ptr to that data) would display a blank screen with a line on the left side.

In general, unless you are really hurting for speed, you can get away with redrawing everything each frame. Axe's drawing routines (except for text) are very fast.

Pixilized:
Okay, thanks! I really appreciate your help and it has given me a a better understanding of Axe.

Navigation

[0] Message Index

Go to full version