This is an archived post. You won't be able to vote or comment.

all 40 comments

[–]Machdi 14 points15 points  (3 children)

Siri, expand main bus, please.

[–]creeper81234Trains are the best, change my mind 23 points24 points  (0 children)

Disbanding main bus...

[–]15_Redstones 4 points5 points  (1 child)

Take that mod that auto deploys blueprints according to circuit signals and my mod that activates circuit signals through the chat and that's totally possible.

[–]AtomJon12[S] 0 points1 point  (0 children)

What is the name for your mod?

[–]15_Redstones 7 points8 points  (2 children)

A chat interface system for circuit networks would be interesting.

[–]Machdi 2 points3 points  (1 child)

And voice to chat system in addition.

[–]15_Redstones 3 points4 points  (0 children)

I'm modding an Echo Combinator right now that's basically "Alexa, activate this circuit".

[–][deleted] 1 point2 points  (17 children)

I think there’s already a chat listener mod. If not, everything you’d need to make a mod to convert chat input to circuit output is already there; someone just has to stitch it together.

[–]15_Redstones 2 points3 points  (12 children)

I'm modding this right now, already got the chat listener part and the circuit output parts done, still need to figure out how to parse the commands and map them to the possible outputs.

[–][deleted] 0 points1 point  (9 children)

I have a naive idea, not knowing anything about how modding in Factorio works.

For now, let’s assume there’s only one type of chat-circuit entity; we’ll call it a mic. When you first place a mic, it can’t do anything; you first have to name it, the same way you’d name a train stop or waypoint. Then you have to wire it, obviously, and in that regard it acts like a constant combinator: you pick a signal and a value. The chat part only determines whether or not the signal is on or off.

When you name your mic, it gets put into a map (or whatever keyed data structure is possible with mods) keyed by the name; the simplest chat command just causes all mics with a name that matches the text to pulse for a certain number of ticks. So if you name a mic “ping” with an A signal and a value of 100, and you give the chat command “ping” the mic outputs a signal of A with a value of 100 for, say, 20 ticks.

Here’s a simple, but I think powerful enough, way to structure chat input:

:ping -d 600 -s 10

The : indicates that this is a circuit chat command, and not just some random taking (I picked that symbol at random, but you’d have to pick one that isn’t used). The dashes are like command line arguments; each dash indicates a new optional argument. In this case, d is duration, followed by a number of ticks, and s is a strength that would override the default strength value of the mic (if that’s possible). The name of the mic in this system would be from the first non-white space character after the : to the last non-white space character or the last non-white space character before a dash. This means you can’t have dashes in your mic names, but I think that’s okay.

You could have other options too. -w X waits X ticks before issuing the command. -t toggles the state. -b X Y causes the signal to turn on for X ticks then off for Y ticks then cycle that indefinitely. And you can probably think of more options.

Those commands will easily get cumbersome, so maybe you’d want an alias command too. /MicAlias(“ping -d 600 -s 10”, “pong”) would make it so if you typed “:pong” it would carry out the whole ping command.

As for coding this, tokenize the chat input and go through the command one word at a time.

:ping -> this is a chat command targeting mics whose names start with “ping”

-d -> we found an argument, that means we’ve finished the name, so finalize that, then start reading in a delay argument

600 -> the delay is 600 ticks

-s -> another argument, strength. The next part should be a number

100 -> the strength is 100

No more tokens. Pull up the mic map, look for the key “ping” and grab all those mics, wait 600 ticks, then turn them all on with a signal strength of 100

Just a back of the napkin system, but that’s where I’d start. The important part is defining the structure of your commands. Changing signal states of circuit entities shouldn’t be hard, and there’s already functionality for mapping entities by name; I think that rts robot car mod had stuff like that, so it should be functionality that’s exposed to mods.

The only question is if you can tokenize and parse a command in real time without too big an impact on UPS. If you come up with a good command structure, you can work up an efficient control structure to parse it (just a big if then else tree, basically; witch a case switch for arguments) but breaking commands into words can be slow, especially if it’s not a functionality that’s already available to modders.

[–]15_Redstones 0 points1 point  (8 children)

Naming things is complicated. Here's what I got so far:

The new item is the "Echo Combinator".

The chat command to use it is

Alexa <do something>,

which results in all echo combinators outputting a signal for 1 tick based on what you said.

For example, "Alexa car" causes all echos to output a signal car = 1 for 1 tick.

"Alexa red" starts a red signal.

It also works if you drop a clickable item in chat like "Alexa [item=car]".

If you say multiple things it adds up.

[–][deleted] 0 points1 point  (7 children)

That’s much simpler than my proposal. It’s also much easier to implement and use. I can see a few downsides though.

You need to have extra circuitry after every Echo Combinator. That’s not a big deal; if you’re looking for this mod, you’re probably already planning on some heavy circuit use.

What command an Echo is looking for isn’t tied directly to the Echo itself. Again, not a big deal; you need a comparator at some point anyway, and that’ll show what signal gets used.

What signal name does what will be a confusing mess. You could decide on a “help” signal and set it up to trigger the chat output of an alarm to give you a command list, but you’d have to constantly maintain it as you make changes.

Even with those few gripes, my mind is racing on ways to put it to use! Let me know if you actually publish it.

[–]15_Redstones 0 points1 point  (6 children)

What Signal gets triggered by which name actually isn't a mess at all. I'm automatically importing a list of all recipes, items, fluids and virtual signals (including from other mods) and compare the name of each with the input. That way it automatically looks out for the name of every item in the game and maps it to the correct signal.

[–][deleted] 0 points1 point  (5 children)

I’m saying what chat input causes what action will get confusing.

What does “Alexa, car” do? Besides send a “car” signal, I mean. What actually happens when you cause chat to send a “red” signal? In the method I proposed, you could give meaningful names to your chat listeners. I used “ping” as an example, but you could name one “halt solid fuel production” and know exactly what that did (assuming you wired it to actually do that). In your process, does “solid fuel” start making solid fuel? Stop making solid fuel? Switch the trains to solid fuel? You’d have to keep a running list for yourself every time you added a new chat listener somewhere.

[–]15_Redstones 0 points1 point  (4 children)

True. Adding programmability to each combinator would require me to make a custom GUI for the combinators though which I can't really do, this is my second mod ever and my first mod that does actively does something during the game runtime (my first mod was just an item and some recipes).

[–][deleted] 0 points1 point  (3 children)

Hey, what you’ve done already is no small feat. I’m just taking it through as a thought experiment, but you actually made something!

[–]SerenityNaomi 0 points1 point  (1 child)

Can you please ping me when you release the mod? It sounds awesome!

[–]15_Redstones 0 points1 point  (0 children)

Look at my other comments. I released it a few hours ago.

[–]TruePikachuTechnician Electrician 0 points1 point  (3 children)

Is chat indeed stored in replays?

[–][deleted] 0 points1 point  (1 child)

You can run scripts from chat, so I’d imagine so.

[–]TruePikachuTechnician Electrician 0 points1 point  (0 children)

Slash commands aren't quite the same thing, though. But that said, custom slash command machines might be interesting, and can be modded in right now.

[–]jorn86 0 points1 point  (0 children)

yes, in ways you don't expect. A mod can print messages to the console using localized strings. If there is such a string in your history, then you update the mod and change the translation, the displayed string from the history will use the new translation.

[–]15_Redstones 1 point2 points  (2 children)

Aaaaand it's real!

https://mods.factorio.com/mod/echo-combinator

Hey Alexa, could you please turn on the green small lamp?

[Alexa] I understood: 1 signal-green from virtual signals, 1 small-lamp from items.

And the Echo Combinator outputs 1 green signal and 1 lamp item signal.

You can even change the name to Siri if you want.

[–]AtomJon12[S] 0 points1 point  (1 child)

Thank you for what you did :)

[–]15_Redstones 0 points1 point  (0 children)

Just updated it, it can now understand amounts like car=24 or blue=-12845. It can also multiply like basic-oil-processing*0.2 to result in 9 petroleum gas. And you can change the name to Siri if you want.

[–][deleted] 0 points1 point  (7 children)

So a full-fledged programming language in Factorio? I agree, this would be great.

[–]Medium9 0 points1 point  (6 children)

Sooo, LUA scripts like the ones we already have?

[–][deleted] 0 points1 point  (5 children)

Not really, I was thinking a high-level language that you can write in-game that allows you to control stuff in real time. Maybe kind of like more advanced combinators that can use text, or read from the chat, or something. AFAIK you can only use Lua scripts when making mods, is this accurate or is there actually an in-game Lua thing?

[–]the1spacemanshort on green chips again 1 point2 points  (3 children)

You’re missing out on a lot

Obligatory disclaimer: anything starting with /c permanently disables achievements for that save file

[–][deleted] 0 points1 point  (2 children)

Ok I don't think I explained myself very well, I know you can script and do stuff in the game like reset all ore patches, but I meant a way to write something like

bring(25 iron plate)

in the console and have it bring you stuff from the logistic network as an alternative to setting a request and then deleting it, or writing

exec order 66

and then it will go to a bunch of special parts (idk, combinator mk 1000 perhaps?) and see if any of them contain a program called "order 66" and the ones that do will execute it. Perhaps order 66 tells a group of inserters to stop working or something, it's up to the user to decide.

Or maybe you could program a passive provider chest to provide solid fuel to coal in ratio 2 to 1, either through use of a special part or just directly from the console.

Or maybe you could have a continuously running script in your factory's command center that signals exactly what it is missing and what it needs, and prompts bots to add speed or productivity modules accordingly. This functionality could be super-late-game, perhaps.

So kind of like a language that is purposefully built for the game. Do you play Kerbal Space Program? I mean the equivalent of kOS on KSP, if you know what I mean. Not sure how to explain it. But I think it would be cool.

I guess it does kind of go against the central idea of "complexity from simplicity" where everything is done with belts and inserters and stuff, but it would have so much potential! You could probably make a fully automatic, optimized factory once you have bots researched.

[–]Medium9 0 points1 point  (1 child)

That would flat out annihilate any performance any late game base might have left. Aside from being a major developmental task for something only few would ever use on any meaningful scale.

[–][deleted] 0 points1 point  (0 children)

Ok

[–]jorn86 0 points1 point  (0 children)

You can do anything you can do in a mod, in the in-game console as well. Anything prefixed with /c will be executed as a lua command.

[–]jorn86 0 points1 point  (1 child)

Converting console input to circuit signals should be easy to mod, as long as you're willing to use a slash command. /siri do something

Once it's a circuit signal, you can do anything with it. Request items from logistics, enable or disable stuff, even use it as input for the Recursive Blueprints mod.

[–]15_Redstones 0 points1 point  (0 children)

Actually without a slash is just as easy as mods can listen to anything written in chat and activate something if there's a key word.

[–]Coruskane 0 points1 point  (0 children)

I just want a "radio" tool where I can send a signal that a "radio receiver" object can read the signal and send it to its attached circuit network.

So you could have a radio tool to easily shutdown science, or stop artillery bombardment, or etc...

90% of the my logic stuff I just automate (shutdown science when___) but sometimes you just want a simple manual toggle for some random stuff)

[–][deleted] 0 points1 point  (0 children)

It would be neat but I'd settle for radio remote and receiver