#LUA moonlogic 2

1 messages · Page 1 of 1 (latest)

pale perch
#

i need someone that is a chad in the moon logic 2.0 space i have a huge project that im on the verge of helping bring back to life LUA issues (self building mega base)

#

trying to help this 2 year old project back to life i think i found a lot of issue solved just cant get the lua right

heady perch
#

would help to post the issues you're having with the code

pale perch
#

im working with this right now it will accept the building of megatile but wont start the build working on it now

karmic star
#

Have you tried putting debug print statements around the logic that is failing to check the values? As I assume Factorio does not have a built-in step-by-step debugger for Lua.

pale perch
#

this is the senerio as far as i can get it trying to update it all now all im stuck on is getting the bots and radar to survy a spot based off what the mega base need if anyone can figure out howto automate this and get back working would be amazing

spiral talon
# karmic star Have you tried putting debug print statements around the logic that is failing t...

There's a VS Code extension that lets you debug/step through factorio mods. I haven't used it since 1.x but it looks like it has 2.0 support. https://github.com/justarandomgeek/vscode-factoriomod-debug

GitHub

Factorio Mod Tool Kit. Contribute to justarandomgeek/vscode-factoriomod-debug development by creating an account on GitHub.

pale perch
#

it has to be a actual wireing issue if someone is a good wiring guy then it might be able to do something

kind spruce
#

the whole thing doesnt need lua in the first place and could all just be combinators trianglepupper

karmic star
kind spruce
#

recursive blueprints doesnt
maybe this is doing more than i thought ?

karmic star
kind spruce
#

not sure
but from what i can see te LUA combinator is just used as a shortcut for all the logic
the actual outputs are converted back to normal signals and then given to recursive blueprints

karmic star
#

That seems kind of redundant when Lua could place the blueprints directly. Hmmm.

kind spruce
#

no ?

#

pretty sure the lua combinator cant do blueprints on its own

karmic star
#

Well that must be a bug with the Lua combinator then, since Factorio Lua can as it is my understanding that is how recursive blueprints is implemented.

pale perch
#

[UPDATE 2025-03-17]: As of Factorio 2.0, it looks like the scenarios no longer work and many mods are no longer compatible. If the mods situation stabilizes and it looks like it wouldn’t be too hard to get this all running again I may try, but for now I just wanted to let y’all know that I’m aware these scenarios don’t currently run.

Ch...

▶ Play video
#

this is the OG vid with the 1.0v of this maybe this will show more why you need the lua

karmic star
#

I am not arguing that Lua is needed. Lua is the sensible way to make this since combinators are stupid in comparison.

pale perch
#

ive tried time and time im just stuck where it wont survy the surronding tiles to build what it needs for tier one max and then go next

#

its like its stuck on blue print deployment witch the first one should be to cut trees

kind spruce
#

why does it even have solar if theres reactors...

karmic star
#

Solar is also more reliable than other power sources. No matter how much you mess up, power still comes back in the day.

karmic star
#

If you have a save showing the issue, such as it being at the stage it is stalled, I could try looking into it later this week.

kind spruce
karmic star
#

Ops, forgot that existed.

pale perch
#

god speed @karmic star

karmic star
#

The scenario in test.rar loads with missing entity/data errors, likely due to mods. There is no button to sync mods with a scenario it seems.

kind spruce
#

i thought its a save file

karmic star
#

No. It seems to be a scenario as it is missing files to be a save.

#

At least when I put it in the save folder.

kind spruce
#

ah, right, that was probably why i didnt test it yet either

karmic star
#

BAD Chest uses completely different signal API from the 1.0 recursive blueprint chest.

kind spruce
#

yup

pale perch
#

hold you got it working was i being a slow brain

#

if you do send a save file id love to see what i did wrong ❤️

karmic star
#

It is still not perfect. Something is causing it to try and build over macroblock units.

#

For some reason you removed critical logic?!
Original (1.0)

                -- If we're good on power, but light on oil products,
                -- build an oil processing megatile
            elseif lastSignal ~= 110 and
                (red['petroleum-gas-barrel'] < 0 or red['light-oil-barrel'] < 0 or
                    red['heavy-oil-barrel'] < 0) then
                game.print((currently_constructed_megatiles + 1) ..
                               '[img=item.oil-refinery] [img=fluid.petroleum-gas] [img=fluid.light-oil] [img=fluid.heavy-oil]')
                newSignal = 110
                var.tilesBuilt = var.tilesBuilt + 8 <- WHY DID YOU REMOVE THIS?!

Yours:

            elseif lastSignal ~= 110 and
                ((red['petroleum-gas-barrel'] or 0) < 0 or
                 (red['light-oil-barrel']     or 0) < 0 or
                 (red['heavy-oil-barrel']     or 0) < 0) then
                game.print((currently_constructed_megatiles+1) .. ' oil')
                newSignal = 110
#

You also removed a lot of comments making it a lot less readable.

pale perch
#

sorry that was me going crzy with the lua trying to pin point the main issue im self taught so im not to good right now

heady perch
#

instead of a whole bunch of

if var.tilesBuilt == nil then var.tilesBuilt = 0 end

you might find

var.tilesBuilt = var.tilesBuilt or 0

interesting