Signal Display

by AckEmma

Allows Display Panels and Programmable Speakers to show the value associated with a signal from the circuit network.

Utilities
9 days ago
2.0
2.07K
Circuit network

b [Fixed] Non-Recoverable Error on enabling Rich Text Items

11 days ago

What happened:
- I was playing the game and editing the message on a display (with this mod active).
- I was trying to get the message to show the value of a signal (T), after showing the value of an item (iron-gear-wheels). The line I was trying to use looked like this: "[item=iron-gear-wheel][] of [item=signal-t]". (T was for total capacity of the container holding the gears.)
- No matter what I did, I could not get it to show the icon for a signal, or display its value. I tried 'signal-t', 'Signal-T', 't', 'T', and many others for the item name. Nothing worked.
- I came to the discussion board, and read about how Rich Text items are disabled by default, so I went into the mod settings (without closing the game) and enabled them. Upon confirming those changes the game instantly crashed upon resuming it, complaining about a non-recoverable error. It gave the following message:

Error while running event signal-display::on_nth_tick(2)
Unknown item name: signal-t
stack traceback:
[C]: in function 'get_signal'
signal-display/scripts/display.lua:198: in function 'update_display'
signal-display/scripts/events.lua:41: in function <signal-display/scripts/events.lua:10>

I hope this helps you fix something.

Also, as an aside, what on earth IS the proper naming convention to use for displaying the icons and values of signals, as opposed to craftable in-game items?

9 days ago
(updated 9 days ago)

Hi Rancara,

Thanks for the report.

The error comes because my code identified '[item=signal-t]' as a valid object for substitution, but as it is invalid is causes a built-in function to error.
You can tell it is invalid as it appears yellow or orange in the text box.

For signals you would need to use the rich text format '[virtual-signal=signal-T]'. You can also press the image icon in the bottom of the textbox to open a panel which will automatically set the correct format for you. For Rich text you will also need a '[]' after the rich text tag for the mod to populate the value in.

See https://wiki.factorio.com/rich_text

I've added an additional safeguard so it shouldn't cause an error with invalid rich text.
Fixed v1.5.3

9 days ago
(updated 9 days ago)

Awesome. I'll have to download the update and see if I can break it (lol). Also thanks for the tips.

A tip of my own that I figured out, for anyone else having trouble getting the correct rich text for an item:
Use the icon insertion button at the bottom right of the dialog, in game. Then select the icon it creates, and copy it with Ctrl+C. Now tab out of the game, back to your desktop, and paste the copied item into a plain text (not rich text) editor, like Windows Notepad. It will show you the correct syntax for that item.

Another tip, you can also do cool stuff like changing the color of your text with stuff like '[color=red]Red Alert! All personel to battle stations![/color]'. I haven't figured out what all can actually be done, but the color thing was an easy guess.

I'm guessing that the wiki page you linked shows how to do more. Unfortunately, that website is broken and inaccessible. Any link to it that I click simply refuses to load. It won't even leave the page I'm on, as if the text wasn't even a link. Copying and pasting anything for wiki.factorio in the address bar also results in the browser doing absolutely nothing. Always. So I can't use that resource.

9 days ago

Haha, always appreciate someone trying to break it! Means more fixes

9 days ago

Edited my reply while you were replying btw. You might want to refresh the page to see what I added.

9 days ago

Interesting, there should be a wiki tab at the top of this page, can you access via that?

Colours are cool!

Copying the signals into a text doc is exactly how I figured out all the rules! Fun fact, most icons and signals share the same prefix but some are named slightly different as icons vs signal names. E.g Signal vs Virtual-Signal

9 days ago

I just tried again, since it's been a day or two since I had the wiki problem. It seems to work now.

9 days ago

Awesome, my bets are on DNS….
It’s always DNS :P

New response