Boundless Creative mode Lua scripting documentation

puts on his ps4 sad panda hat

Please post videos of cool things so us ps4 second class citizens can live vicariously through you (Iā€™m just teasing but kinda true, I know itā€™s not WSā€™s fault though)

2 Likes

I was able to do this by starting modifying Daves tree code. Without that helping setBlock function setting coordinates would have been really painful to me.

Donā€™t know how to rotate signs properly but was able write on those and set facing to wall when there were block. Really interesting to see what kind of stuff there will be done with lua :smiley:

7 Likes

Cyberpunk 2077 delayed? Just start scripting and build own Night Cityā€¦ Itā€™s anyway already 2020!

Actually these are just piling pcx image top of itself to several locations. Never before I have been trying play with binary files but now I had to.

9 Likes

You deserve a unique badge for this @almund !!

If youā€™re not much for the video making bitā€¦ i would love to start showcasing mods of any kindā€¦ see if we canā€™t drum up some extra interest in creative/modding :grin:

10 Likes

I was going to make a video about it for just this reason. But I bow to the king!! I will gladly move aside and assist you in any way I can to make this video so that we can raise awareness. Iā€™ll send you my pics and videos and scripts hopefully this weekend.

2 Likes

Not trying to discourage anyone from making their own videosā€¦ Boundless can use all the content creators it can get. Just offering my services in case anyone would rather focus on other projects ^^

7 Likes

I am getting this with inventory example.
bad argument #1 to 'ipairs' (table expected, got userdata)

I am able access inventory by elements, for example way to get capacity.
containerEntity.inventory[1]:capacity()
But I canā€™t output inventory name properly. I donā€™t know is this way proper to do but example wasnā€™t enough for me.

Here is way I did copy player inventory to barrel that was also generated.

--From Daves Arena
function setBlock(x, y, z, blockType, color, meta)
    if meta == nil then
        meta = 0;
    end
    local p = boundless.wrap(boundless.UnwrappedBlockCoord(x, y, z))
    local c = boundless.ChunkCoord(p)
    boundless.loadChunkAnd8Neighbours(c, function (chunks)
        local v = boundless.getBlockValues(p)
        v.blockType = blockType
        v.blockMeta = meta
        v.blockColorIndex = color
        boundless.setBlockValues(p, v)
    end)
end

--
--https://stackoverflow.com/a/26777901
function round(x)
    return x>=0 and math.floor(x+0.5) or math.ceil(x-0.5)
end
--
function inventoryContainer() 
    for c in boundless.connections() do
        local e = boundless.getEntity( c.id );
        local containerType = boundless.blockTypes.STORAGE_WOOD_STYLISH;
        -- containerType = boundless.blockTypes.CONTAINER_STORAGE_BASE;    --stone storage block
        -- containerType = boundless.blockTypes.CONTAINER_STORAGE_SHELF;   --wood shelf
        local signType = boundless.blockTypes.SIGN_METAL_BASE;
        local signColor = 2; -- IRON

        if e then
            local pos = e.position:copy();--:withYOffset(0.5)
            local y = math.floor(pos.y) + 1;
            local x = math.floor(pos.x);
            local z = math.floor(pos.z);

            local sinr = round( math.sin( e.facing )); --NS
            local cosr = round( math.cos( e.facing )); --WE
            
            z = z + 2*sinr;
            x = x + 2*cosr;
            
            setBlock( x, y, z, containerType, math.random(255) );
            setBlock( x, y, z-1, signType, signColor, 6 );   --placing sign to north side and setting it on south wall
            -- sign meta 
            --1 = west
            --2 = east
            --3 = ground
            --4 = ceiling
            --5 = north
            --6 = south
            
            local containerBlockCoord = boundless.wrap(boundless.UnwrappedBlockCoord(x, y, z))
            local containerEntity = boundless.getEntity( containerBlockCoord );
            
            if( containerEntity ~= nil ) then
                local containerCapacity = containerEntity.inventory[1]:capacity();
                for i=1, containerCapacity do
                    if( e.inventory[1][i] ~= nil ) then
                        local copyI = e.inventory[1][i]:copy();
                        containerEntity.inventory[1][i] = copyI;
                    end
                end
            else
                print( "Error with container entity!" )
            end
            
            local signEntity = boundless.getEntity( boundless.wrap(boundless.UnwrappedBlockCoord(x, y, z-1)))
            if( signEntity ~= nil ) then
                signEntity.text = c.username;
                signEntity.additionalText = os.utctime();
            end
        end
    end
end

I did start playing with inventory because of @Nitloc did mention that creative wonā€™t allow spawning undo and lattice chisels from menu. At least with deep-copying items forged items can be duplicated :slight_smile:

Below way to copy just 1st slot from inventory which is probably more useful for forged items.

for c in boundless.connections() do
    local e = boundless.getEntity( c.id );
    if e then
        if( e.inventory[1][1] ~= nil ) then
            local copyI = e.inventory[1][1]:copy();
            boundless.spawnItem( copyI, e.position )
        end
    end
end
1 Like

Am sure you could do a much better job of those :wink:

2 Likes
1 Like

Just started on a skyblock style mod. Still needs work (like not having to wait 2 hours until you can place liquids for a cobblestone generator!). But thought Iā€™d put it up here if anybody wants to see more example (very hacky weekend) code.

12 Likes

Boundless Trialsā€¦? Sounds familiar. Lol.

does it? was just the first thing I thought of :stuck_out_tongue:

1 Like

Well it does have a nice ring to it. Lol.
So what are these trials you speak of.

Trial of the century, the leader of the infamous Reapers gang has been accused of torturing other players.

5 Likes

any way to slow daylight/night cycle down?

I actually just bought a PC just so I can begin learning to mod this game. LOL I was wondering about affecting day/night cycle as well as gravity.

1 Like

I have to get a virtual machine going on my mac I do believe before I can do any of this; but simple tutorials could be a thing once everything is steadyā€¦ python can just process input without it being a program tho I donā€™t know if that works outside data science/statcrunchery and I keep forgetting itā€™s not pythonā€¦ i think I get stuck on python from Godot or my brain just crashed

Itā€™s possible to speed up/slow down the entire cycle youā€™re seeing on the client side but not individually edit the length of either day or night. Hereā€™s a 30 second day/night cycle haha

1 Like

i hope soo can do on server as well :stuck_out_tongue: