Blockland Forums > Modification Help

PyBLS (Blockland Save File Library for Python)

Pages: << < (5/5)

Chrono:

If you really don't want to go through all that colorset stuff by following simple instructions, grab it from one of your saves.

Ipquarx:

I could probably make something like this in C#, but with less manual stuff and more brick options, like events and naming.

Port:

Why the hell are you stating the colorset in a file? Define a type for storing the colorset which you can pass to the instanciator or in a method call to a "save file instance" in order to apply it. Also, don't use such a static structure. Use a class that represents a "virtual brick space" with methods to add, modify, remove, save and load bricks.

For example, how usage should be like:


--- Code: ---# Import modules.
import blsavelib, os

# Define a 64-color colorset filled with (200, 200, 200, 255) as a list.
c = [(200, 200, 200, 255) for x in range(64)]

# Create a brick container, passing the colorset.
a = blsavelib.BrickContainer(c)

# Create a brick.
b = a.add_brick('32x Baseplate', (0, 5.5, 3))

# Set it's color.
a.set_property(b, 'color', 5)

# Add an event to the brick.
a.add_event(b, 'onActivate', 'Player', 'Kill')

# Save everything.
a.save(os.path.join(os.curdir, 'myfile.bls'))

--- End code ---

If you want to be really fancy, use kwargs, such as:
a.add_brick(name='32x Baseplate', position=(0, 0.5, 3), rotation=2, ...)

Pages: << < (5/5)

Go to full version