[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: 1194
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: 1194
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 7465 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: 1194
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: 1194
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: 1194
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 129 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: 1194
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.

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 »

Ok I am diving into this again now, I have updated the README with an overview/roadmap

[edit] PS Mooncat, you should throw color picker up on github :)
Last edited by Nexela on Tue Aug 09, 2016 3:44 am, edited 1 time in total.

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

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

Post by Mooncat »

You should have already known this, but in case other people are interested, here is the thread for the Color Picker mod.
The github link is there too.

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 »

LOL I looked at the thread and totally missed the link!

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

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

Post by Mooncat »

Maybe it was added just after you have read. :lol:
It is on the header part.

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 »

The alerter stuff is almost finished, needs a bit more polish around the edges and put the message parsing back in but right now it is functional

https://github.com/Nexela/CircuitTools/tree/develop
Last edited by Nexela on Tue Aug 09, 2016 3:45 am, edited 1 time in total.

User avatar
hitzu
Filter Inserter
Filter Inserter
Posts: 530
Joined: Tue Sep 09, 2014 5:55 pm
Contact:

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

Post by hitzu »

I am impatiently waiting forward for this mod! :)

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 »

The Alerter should be buttoned up tonight. the rest of it I am hoping to have it finished before the weekend!

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

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

Post by Mooncat »

Good to hear! Right now, I have to go back to my Creative Mode. The performance issue is really bugging me.
Hope my code helps you. Happy modding. ;)

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 »

Mooncat wrote:Hope my code helps you.
Very much! Thank you for that.
I am tweaking it a little bit to work with color picker as an optional dependency. If color picker exists use the picker otherwise open up a window for specifying rgb values. I should have most of the night to knock out a bunch of work on this.

Also made some changes to the github repo and Changed the name of the mod.

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

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

Post by Mooncat »

Nexela wrote:I am tweaking it a little bit to work with color picker as an optional dependency. If color picker exists use the picker otherwise open up a window for specifying rgb values.
That's great idea! It doesn't force users to install another mod (which I was afraid of when making Color Picker. I personally don't like to install library mod unless it is wildly used) but also brings additional feature if the user has the mod. ;)

Post Reply

Return to “Ideas and Requests For Mods”