[Solved] Message Broadcaster - Has anyone done this yet?

This is the place to request new mods or give ideas about what could be done.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

[Solved] Message Broadcaster - Has anyone done this yet?

Post by Mooncat »

Has anyone created a mod that has Message Broadcaster or Signal Notifier or whatever it's called - a device that can display message on console when network condition is fulfilled?

When I was managing my factory in 0.12, I often faced a same problem: oil fields are depleted but I only know after the 60k tanks are empty. I have connected lamps to indicate stored oil is less than 20k, but I often missed the lamps while using Avatars to develop outposts that are really far away.

So, I want to make a small device that can warn me when something happened. And I saw some requests for this idea that were written in 2014, but still couldn't find any mod has this device. Just to make sure no one has done it or is doing it and it worths me to spend some time on.

Besides displaying message on console, I have some more ideas for this device. :lol:

Edit: question was quickly answered, see the link below.
Last edited by Mooncat on Tue Jul 12, 2016 9:33 am, edited 1 time in total.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Message Broadcaster - Has anyone done this yet?

Post by Nexela »

I am working on fixing up an old mod that does this. I hope to have something soon!
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Message Broadcaster - Has anyone done this yet?

Post by Nexela »

Choumiko wrote:Something like this: viewtopic.php?f=92&t=13937 ?

:)
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: Message Broadcaster - Has anyone done this yet?

Post by Mooncat »

Thanks for link! None of my keywords match that mod name. :lol:

Since Nexela is working on this, I guess I will just leave it here and concentrate on my existing mod.
Allow me to write down my ideas here:

- in additional to displaying the message on console, there are 2 more options: display the message as flying-text (reference), or display the message as a popup (each player can stack up to 5 popup messages, before the latest one gets replaced).
(So they make the new "use color" option in lamps meaningful, as text on flying-text and popups can have customised colors.)

- receiver filters:
  • force: same force / all players
  • distance: players that are close / all players
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Message Broadcaster - Has anyone done this yet?

Post by Nexela »

I might be out of town for the remainder of the day but when I get back I am gonna do a quick fix for this (I might even have done before I leave but no promises!) then start on a combination of combinator mods and roll em into 1.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: Message Broadcaster - Has anyone done this yet?

Post by Mooncat »

Nexela wrote:I might be out of town for the remainder of the day but when I get back I am gonna do a quick fix for this (I might even have done before I leave but no promises!) then start on a combination of combinator mods and roll em into 1.
Best of luck. :D

I really want to try improving the UI. I'm thinking about replacing that single-lined text-field into a text-box. (API doc doesn't have that, but you can see the text-box style in style.lua) Not sure whether it is possible. Maybe I post the code here once I have finished that. :lol:
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [Solved] Message Broadcaster - Has anyone done this yet?

Post by Nexela »

Well good news... I have it sort of working :) and bad new... It is only sort of working but. but it shouldn't take much longer to get it to a workable state. I should have a working presentation after I get back later tonight/tommorow
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [Solved] Message Broadcaster - Has anyone done this yet?

Post by Mooncat »

Nexela wrote:Well good news... I have it sort of working :) and bad new... It is only sort of working but. but it shouldn't take much longer to get it to a workable state. I should have a working presentation after I get back later tonight/tommorow
Take your time. :D
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [Solved] Message Broadcaster - Has anyone done this yet?

Post by Nexela »

I shoulda took a nap now I am gonna be tired!!!!

It loads, it works. now I just have to figure out where my typo is causing it not to save :). and then after that I need to logicify a lot of stuff. Why did there have to be so many changes from .12.1 to .13!!!!

And I agree on the UI. It needs help. One of the first things I am gonna do after I get it functional is switch it around so it pops up with the default UI. Then I am gonna take two asprin and work on the gui layout and possibly get rid of the tacky window at the top or if I keep it make it more YARM Like. Ohhhh popups gonna have to look into how that works!


One of the things I had actually started commenting into the code before I even seen your additional requests was TODO - Force/All? for messages.
I also am going to add in unit/player alarms to trigger when people/biters get in range. And also as per your request broadcast a distance. Since I don't have the code in front of me ATM I might have to bump up the delay a bit to keep script timers down. pseudo message table:

{id{msg, alert{popup,console,flying,sillydefaultgui}, broadcast{person/force/surface/world?}, Lampposition{x,y}}

So Many Ideas!!!!

After this is all functional or least basicly functional It will get revamped into a new mod with additional combinator related stuff based on a couple more older mods. Mostly related to trains. 1st one being an individual cargo-wagon/loco cargo reader. and the second one that adds/remove tracks based on signal conditions so setting a train signal to red will finally do something more usefull then close a gate. And lets not forget I still want to do a GUI for autofill! Busy Busy beaver
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [Solved] Message Broadcaster - Has anyone done this yet?

Post by Mooncat »

Nexela wrote:I shoulda took a nap now I am gonna be tired!!!!

It loads, it works. now I just have to figure out where my typo is causing it not to save :). and then after that I need to logicify a lot of stuff. Why did there have to be so many changes from .12.1 to .13!!!!

And I agree on the UI. It needs help. One of the first things I am gonna do after I get it functional is switch it around so it pops up with the default UI. Then I am gonna take two asprin and work on the gui layout and possibly get rid of the tacky window at the top or if I keep it make it more YARM Like. Ohhhh popups gonna have to look into how that works!


One of the things I had actually started commenting into the code before I even seen your additional requests was TODO - Force/All? for messages.
I also am going to add in unit/player alarms to trigger when people/biters get in range. And also as per your request broadcast a distance. Since I don't have the code in front of me ATM I might have to bump up the delay a bit to keep script timers down. pseudo message table:

{id{msg, alert{popup,console,flying,sillydefaultgui}, broadcast{person/force/surface/world?}, Lampposition{x,y}}

So Many Ideas!!!!

After this is all functional or least basicly functional It will get revamped into a new mod with additional combinator related stuff based on a couple more older mods. Mostly related to trains. 1st one being an individual cargo-wagon/loco cargo reader. and the second one that adds/remove tracks based on signal conditions so setting a train signal to red will finally do something more usefull then close a gate. And lets not forget I still want to do a GUI for autofill! Busy Busy beaver
haha, thanks for considering my ideas. I am still studying the UI APIs. Very disappointed by how we are restricted to create left-aligned buttons while the default buttons in Factorio are right-aligned. :?

As for the UI display problem, I think you can use LuaPlayer.opened to check whether the entity is selected in on_tick. I see this method used in some other mods, including Choumiko's SmartTrains. ;)
And yesterday, I saw this mod too: https://mods.factorio.com/mods/Zinal/Custom_Events. I haven't looked into it yet but based on its description, it seems to be exactly for this purpose.

For popup message, I am thinking about just add a "frame" on player.gui.center with a "label" and "button" inside it. But maybe also need to add a "flow" to contain the frames vertically. I will show you the preview or even the code when I get the time to make it. :D

No need to rush. I am busy on making mods too. I have many crazy ideas but don't know whether they are doable or not. Before 0.13 becomes stable, I will concentrate on developing mods instead of actually playing the game. :lol:
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [Solved] Message Broadcaster - Has anyone done this yet?

Post by Mooncat »

Hi, I am back here now. It has been some time since I have started trying to make a GUI for the mod. It looks like this now.
message_broadcaster.png
message_broadcaster.png (79.23 KiB) Viewed 8016 times
No actual functionality yet, except the picker.
I think it will be cool if users can choose message color via the color picker. And I realized I will also use the color picker for another mod. So I am thinking of making the color picker as a separated mod so it can be shared by different mods. What do you think? :lol:
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: [Solved] Message Broadcaster - Has anyone done this yet?

Post by aubergine18 »

How are you doing the colour picker? Lots of separate sprites, or using a tint on a single sprite? Is the code avail in github?
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [Solved] Message Broadcaster - Has anyone done this yet?

Post by Mooncat »

aubergine18 wrote:How are you doing the colour picker? Lots of separate sprites, or using a tint on a single sprite? Is the code avail in github?
One single sprite with different colors. Then create lots of styles from different parts of the sprite. I think sprite tint is not supported for GUI style.
I will put it up after everything is ready.

Edit: correction - sprite tint is supported. So I can just use a complete white sprite for all palettes. However, different styles are still needed because there is no API for changing tint in runtime.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [Solved] Message Broadcaster - Has anyone done this yet?

Post by Nexela »

Now you are making me feel like a slacker!

I will work on this some more tonight and I might be able to post up a quick demo of what I have so far.

That GUI is awesome. complicated but awesome.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [Solved] Message Broadcaster - Has anyone done this yet?

Post by Mooncat »

Nexela wrote:Now you are making me feel like a slacker!

I will work on this some more tonight and I might be able to post up a quick demo of what I have so far.

That GUI is awesome. complicated but awesome.

lol... but what I have done in the last 2 weeks is just this UI. I have probably spent too much time on it. :lol:
I should go back to creative mode right after this is done.

I have forgotten that lamp, if you are using lamp for the prototype, can accept color from circuit signal. So the color picker is not really necessary. :?
But I will still keep it so you can decide whether use it or not.

By the way, have you finished the part for broadcasting the messages? If so, I won't implement it here, so I can give the UI to you sooner. ;)
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [Solved] Message Broadcaster - Has anyone done this yet?

Post by Nexela »

I made a little progress on it tonight. I swear I have ADHD or something. I did a couple of extra things not even related to the alert messages part :). I also spent a lot of time cleaning the code up as I lrn2lua. It is basically a complete re-write.

Right now I have the prototypes done and also a decent framework I think. I have a generic message creator and just a print spitter-outer

If you want to check out what I have so far https://github.com/Nexela/CircuitTools/tree/develop
I might be able to get a lot more done tonight.

P.S. Creative Mode does need a tool for placing ores and enemy units.
Last edited by Nexela on Tue Aug 09, 2016 3:43 am, edited 1 time in total.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [Solved] Message Broadcaster - Has anyone done this yet?

Post by Mooncat »

Wow, I see you are going to make more than just the message creator. "rail-cargo-reader", "rail-switch-signal"! :o
Can't wait to see what you are going to do. But take your time. Don't be like me that worked too hard and made myself sick for a whole week. :lol:

Anyway, I have completed the code for broadcasting message, and also published the Color Picker mod.

Here is the UI with some related functionalities:
message-broadcaster_0.0.1.zip
(13 KiB) Downloaded 140 times
(Have to use with Color Picker)
You can try it by placing a lamp and clicking on it to open the UI. Feel free to change and use it in your mod. ;)
Search "TODO" for the parts you will be mostly interested to.
For test purpose, the Apply button will also broadcast the message.

And yea, Creative Mode needs something that can really "create" things.
Last edited by Mooncat on Mon Aug 08, 2016 2:14 am, edited 1 time in total.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: [Solved] Message Broadcaster - Has anyone done this yet?

Post by aubergine18 »

Mooncat wrote:Edit: correction - sprite tint is supported. So I can just use a complete white sprite for all palettes. However, different styles are still needed because there is no API for changing tint in runtime.
From vague memory (I could be wrong) tint can be applied at runtime - see nixie tubes mod. Looks like in addition to the sprite you also need a mask image, and it's the mask (I think?) that gets tinted. I'm not sure if that approach works in the GUI, or only on map elements.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [Solved] Message Broadcaster - Has anyone done this yet?

Post by Mooncat »

aubergine18 wrote:
Mooncat wrote:Edit: correction - sprite tint is supported. So I can just use a complete white sprite for all palettes. However, different styles are still needed because there is no API for changing tint in runtime.
From vague memory (I could be wrong) tint can be applied at runtime - see nixie tubes mod. Looks like in addition to the sprite you also need a mask image, and it's the mask (I think?) that gets tinted. I'm not sure if that approach works in the GUI, or only on map elements.
It is different. The Nixie Tubes are actually lamp entities (and also dummy cars?). Changing the lamp color is a built-in feature from Factorio. But I don't see any API to change tint of GUI in runtime, neither in LuaGuiElement nor LuaStyle. It would be great if we can do so.
PS: besides GUI, I think entity doesn't support changing tint in runtime either. No color-related properties in LuaEntity except color, which is used for changing the color of character or rolling stock only.
Last edited by Mooncat on Mon Aug 08, 2016 4:01 am, edited 1 time in total.
Post Reply

Return to “Ideas and Requests For Mods”