[Mod] HUD Monitors API [hud_monitors]

slemon
Member
 
Posts: 100
Joined: Sun Apr 27, 2014 03:56

[Mod] HUD Monitors API [hud_monitors]

by slemon » Fri Dec 25, 2015 07:31

This mod provides simple API to add text messages on player's screen.
Image
How to use:
To add widget, use hud_monitor.place(text, id, player)
"text" is text you want to write on the player's screen
"id" is the id of your widged (you'll need it to change your widget)
"player" is the player who you want to see the widget.
Leave this blank to make all players see the widget

To change your widget, use hud_monitor.place(text, id, player)
second time using id you used the first time.

There are some examples included: https://github.com/slemonide/hud_monitor/blob/master/examples.lua
If to turn them off, change EXAMPLES = true to EXAMPLES = false in the init.lua.

Code:
WTFPL
Mod dependencies: none

View code: https://github.com/slemonide/hud_monitor
Download: https://github.com/slemonide/hud_monitor/archive/master.zip

Screenshots:
+ Spoiler
Attachments
monitor.png
(11.84 KiB) Not downloaded yet
screenshot_20151224_231519.png
(938.2 KiB) Not downloaded yet
 

sofar
Developer
 
Posts: 1766
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod] HUD Monitors API [hud_monitors]

by sofar » Fri Dec 25, 2015 07:49

Neat. I'm looking forward to see:

- a way to enable/disable some of these "monitors"
- not having this thing appear in the same location as the minimap!
- a way to print "transient" messages that disappear automatically after a while
 

slemon
Member
 
Posts: 100
Joined: Sun Apr 27, 2014 03:56

Re: [Mod] HUD Monitors API [hud_monitors]

by slemon » Sat Dec 26, 2015 07:44

sofar wrote:- a way to enable/disable some of these "monitors"

Do you mean in game?

- not having this thing appear in the same location as the minimap!

Fixed. I moved the thing a bit down.

- a way to print "transient" messages that disappear automatically after a while

There is already this mod for that: viewtopic.php?f=9&t=12720
Or do you want monitors to disappear if data in them hasn't changed for a while? Like if the player stays on the same spot?
 

User avatar
Wuzzy
Member
 
Posts: 3243
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] HUD Monitors API [hud_monitors]

by Wuzzy » Sat Nov 12, 2016 18:00

This mod seems to be very broken with 0.4.14. First, the examples are enabled in the current download which should not be the case.
And the examples don't even work. Minetest gets spammed with errors like this:
1336818 2016-11-12 18:57:30: ERROR[Main]: generateImage(): Creating a dummy image for "Real date is 11/12/16
1336819 2016-11-12 18:57:30: ERROR[Main]: --------------------------------------------------
1336820 2016-11-12 18:57:30: ERROR[Main]: Real time is 18:57:30
1336821 2016-11-12 18:57:30: ERROR[Main]: --------------------------------------------------
1336822 2016-11-12 18:57:30: ERROR[Main]: This world is 2 seconds old
1336823 2016-11-12 18:57:30: ERROR[Main]: --------------------------------------------------
1336824 2016-11-12 18:57:30: ERROR[Main]: You are in the air
1336825 2016-11-12 18:57:30: ERROR[Main]: --------------------------------------------------
1336826 2016-11-12 18:57:30: ERROR[Main]: You are 15 blocks above sea level
1336827 2016-11-12 18:57:30: ERROR[Main]: --------------------------------------------------
1336828 2016-11-12 18:57:30: ERROR[Main]: You are standing on:
1336829 2016-11-12 18:57:30: ERROR[Main]: dp_core:dirt_with_grass
1336830 2016-11-12 18:57:30: ERROR[Main]: --------------------------------------------------
1336831 2016-11-12 18:57:30: ERROR[Main]: The light level is 15 SLU
1336832 2016-11-12 18:57:30: ERROR[Main]: --------------------------------------------------
1336833 2016-11-12 18:57:30: ERROR[Main]: "
1336834 2016-11-12 18:57:31: ERROR[Main]: generateImage(): Could not load image "Real date is 11/12/16
1336835 2016-11-12 18:57:31: ERROR[Main]: --------------------------------------------------
1336836 2016-11-12 18:57:31: ERROR[Main]: Real time is 18:57:31
1336837 2016-11-12 18:57:31: ERROR[Main]: --------------------------------------------------
1336838 2016-11-12 18:57:31: ERROR[Main]: This world is 3 seconds old
1336839 2016-11-12 18:57:31: ERROR[Main]: --------------------------------------------------
1336840 2016-11-12 18:57:31: ERROR[Main]: You are in the air
1336841 2016-11-12 18:57:31: ERROR[Main]: --------------------------------------------------
1336842 2016-11-12 18:57:31: ERROR[Main]: You are 15 blocks above sea level
1336843 2016-11-12 18:57:31: ERROR[Main]: --------------------------------------------------
1336844 2016-11-12 18:57:31: ERROR[Main]: You are standing on:
1336845 2016-11-12 18:57:31: ERROR[Main]: dp_core:dirt_with_grass
1336846 2016-11-12 18:57:31: ERROR[Main]: --------------------------------------------------
1336847 2016-11-12 18:57:31: ERROR[Main]: The light level is 15 SLU
1336848 2016-11-12 18:57:31: ERROR[Main]: --------------------------------------------------
1336849 2016-11-12 18:57:31: ERROR[Main]: " while building texture
1336850 2016-11-12 18:57:31: ERROR[Main]: generateImage(): Creating a dummy image for "Real date is 11/12/16
1336851 2016-11-12 18:57:31: ERROR[Main]: --------------------------------------------------
1336852 2016-11-12 18:57:31: ERROR[Main]: Real time is 18:57:31
1336853 2016-11-12 18:57:31: ERROR[Main]: --------------------------------------------------
1336854 2016-11-12 18:57:31: ERROR[Main]: This world is 3 seconds old
1336855 2016-11-12 18:57:31: ERROR[Main]: --------------------------------------------------
1336856 2016-11-12 18:57:31: ERROR[Main]: You are in the air
1336857 2016-11-12 18:57:31: ERROR[Main]: --------------------------------------------------
1336858 2016-11-12 18:57:31: ERROR[Main]: You are 15 blocks above sea level
1336859 2016-11-12 18:57:31: ERROR[Main]: --------------------------------------------------
1336860 2016-11-12 18:57:31: ERROR[Main]: You are standing on:
1336861 2016-11-12 18:57:31: ERROR[Main]: dp_core:dirt_with_grass
1336862 2016-11-12 18:57:31: ERROR[Main]: --------------------------------------------------
1336863 2016-11-12 18:57:31: ERROR[Main]: The light level is 15 SLU
1336864 2016-11-12 18:57:31: ERROR[Main]: --------------------------------------------------
1336865 2016-11-12 18:57:31: ERROR[Main]: "


This gets repeated over and over again. And the health hotbar surely looks very strange. It constantly changes its background color, as if a missing texture would be attempted to be added here

Finally, please make sure you use a consistent shortname everywhere. Is it hud_monitors or hud_monitor (change folder names and forum thread title accordingly)? You can use mod.conf to set the definite shortname of the mod.

Some comments on the concept:
- I would use white as the default color. Red is too distracting
- The seperators don't look pretty as those are just dashes. I would like to see a real line (maybe use a simple image) here.
- I think the API should support removing an existing HUD monitor at any time. This can be useful if a HUD monitor does not apply anymore or the player has to meet a certain requirement in order to see it. Currently, all HUD monitors seem to be completely permanent which is not very flexible.
My creations. I gladly take any bitcoins you have lying around: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH
 


Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 1 guest