Moon Logic deprecated

by mk-fg

Adds Lua-programmable circuit network combinator. Based on Sandboxed LuaCombinator and LuaCombinator2 mods. Probably won't work in multiplayer games.

Content
2 years ago
1.0 - 1.1
4.97K
Circuit network

g [lua-qiz] Variable misspelling issue

2 years ago

I'm trying to use ota_update_from_uid with the goal of updating multiple combinators that have the same code. As a test I'm trying copy code from one combinator to the other but that's not working. This is what I have:

update_ota_from_uid =1324787

When I save that in a combinator nothing happens. Is there something more than just adding that line? I'm getting the value from the other combinator title (Moon Logic [1324787]) - is that correct? I guess I may be confused about the behavior - should that actually present as a change in the combinator editor?

2 years ago

I think the issue is that you're using incorrect variable name - should be ota_update_from_uid = 1324787.
Where did you get "update_ota_from_uid" name for it btw? Help window should say "ota_update_from_uid".

2 years ago

Though I think the issue highlights an unfortunate design where it's possible to make such mistake.
It'd probably be better if all "special" variables like that had some special syntax, e.g. @ota_update_from_uid, where if you misspell it in any way, error about unknown special variable will be raised, instead of just nothing happening.
Wouldn't be incompatible with current syntax either, so guess something to add in the future...

2 years ago

Thanks for the quick response.

Looks like there was a typo in the example code in this thread, I must have copied that: https://mods.factorio.com/mod/Moon_Logic/discussion/5f5c7a5f2348f529f9d07a92

So that worked, the editor refreshed, replacing the code with the source combinator code. Is this a one time update? Is there a way to have it do that when the source combinator changes?

2 years ago

Is this a one time update? Is there a way to have it do that when the source combinator changes?

Yup.

But you can script it to not be, ofc, e.g. if uid ~= 1324787 and game.tick % (5*60*60) == 0 then ota_update_from_uid = 1324787 end to have all things using that code (except the uid=1324787 master) update themselves every 5 minutes (at game speed=1.0).

Or you can build a big red pushbutton "Deploy to Production" switch that sends a signal over the wires that will make code set that variable instead.
Or maybe have "code version" input signal, and have MLCs update themselves when it gets incremented past the current one they have hardcoded.
Etc etc.

Isn't Factorio all about designing this kind of things, anyway? :)

2 years ago

That's the sort of thing I'm looking for...but when I test it clears out any reference to the ota_update_from_uid call - how do I keep the code that does the update after the update happens?

2 years ago

Oh wait I see, you embed that in the source. That works - thanks!

New response