[Mod] List Items [listitems] (v0.7)

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

[Mod] List Items [listitems] (v0.7)

by AntumDeluge » Post

listitems chat command

Description:

Adds chat commands to list registered items, entities, & more.

Usage:

Chat commands:
  • list: Lists registered items or entities available in the game.
    • Invocation: /list type [options] [string1] [string2] ...
      • type: List type (e.g. "items", "entities", etc.).
      • options: Switches to control output behavior.
        • -v: Display description (if available) after object name.
        • -s: Use shallow search (don't search in descriptions)
      • string[1,2] ...: String parameter(s) to filter output.
      • Without any string parameters, all objects registered in game are listed.
      • With string parameters, only objects matching any of the strings will be listed.
Global Functions:
  • listitems.list: Displays list of registered items or entities available in the game to player.
    • Invocation: listitems.list(player, l_type, switches, params, nocase)
      • player: (string) Player name to whom the list is displayed.
      • l_type: (string) Which supported list to iterate ("items", "entities", etc.)
      • switches: (string) Options that affect output.
        • -v: Display description (if available) after object name.
        • -s: Use shallow search (don't search in descriptions)
      • params: (string) Item names to refine output list.
      • nocase: (boolean) Make search case-insensitive (default: true).
Available Settings:
  • listitems.bullet_list (boolean) Displays items in a bulleted list (default: enabled).
  • listitems.enable_singleword (boolean) Enable singleword commands (example: /listitems, default: enabled).


Image

Licensing:



Requirements:

Depends:
  • Required: none
  • Optional: mobs_redo (registers "mobs" type if available)


Privileges:
  • Required: none


Links:

Last edited by AntumDeluge on Tue May 18, 2021 21:18, edited 23 times in total.

User avatar
DS-minetest
Member
Posts: 1162
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: DS-minetest
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [Mod] List Items [0.1] [listitems]

by DS-minetest » Post

It would be nice if it would also count how many items were found.
Note that I've recently renamed myself on github and co. to "Desour". (I'm bad at naming things.)
Feel free to call me DS.

Chibi ghost
Member
Posts: 845
Joined: Fri Jan 08, 2016 21:17
In-game: Ghost

Re: [Mod] List Items [0.1] [listitems]

by Chibi ghost » Post

o0 I can only imagine how long my list would be

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] List Items [0.1] [listitems]

by AntumDeluge » Post

DS-minetest wrote:It would be nice if it would also count how many items were found.
You mean how many registered items, or how many of a specific item exists in world?

User avatar
DS-minetest
Member
Posts: 1162
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: DS-minetest
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [Mod] List Items [0.1] [listitems]

by DS-minetest » Post

AntumDeluge wrote:
DS-minetest wrote:It would be nice if it would also count how many items were found.
You mean how many registered items, or how many of a specific item exists in world?
I mean how many item names are shown by the chatcommand with the given params.
Note that I've recently renamed myself on github and co. to "Desour". (I'm bad at naming things.)
Feel free to call me DS.

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] List Items [0.1] [listitems]

by AntumDeluge » Post

DS-minetest wrote:I mean how many item names are shown by the chatcommand with the given params.
Good idea.

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

Re: [Mod] List Items [0.1] [listitems]

by Wuzzy » Post

This mod is surprisingly useful. Thanks!
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] List Items [0.1] [listitems]

by AntumDeluge » Post

Wuzzy wrote:This mod is surprisingly useful. Thanks!
That makes me really happy to hear!
Last edited by AntumDeluge on Sun Jul 23, 2017 19:49, edited 1 time in total.

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] List Items [0.1] [listitems]

by AntumDeluge » Post

I'm not very experienced with using regular expressions, but I think the mod could benefit from it quite a bit for refining searches.

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] List Items [0.1] [listitems]

by AntumDeluge » Post

UPDATED!

Now displays number of items listed. Thank you DS-minetest for the suggestion.

listitems @ Git commit 7184a14

Note: I also changed it to display a bullet character (•) before each listed item, to try & make the output clearer & look nicer.

listitems @ Git commit 03e4c2c

Does anyone know of any instances where writing out the raw bullet character to the chat log might cause issues for the client or server? I believe that the bullet character is within the scope of the ANSI specification, & I believe that Minetest supports UTF-8. So I'm guessing that there wouldn't be any issue.

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

Re: [Mod] List Items [0.2] [listitems]

by Wuzzy » Post

The bullet point character displays for me.

I heard Russians often have problems with encodings in Minetest in general (I don't know if it affects your mod), you may want to talk to them.
But this may be a Minetest problem, I often heard Minetest does not have a working UTF-8 support yet (I hope it will get fixed someday).
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] List Items [0.2] [listitems]

by AntumDeluge » Post

Wuzzy wrote:I often heard Minetest does not have a working UTF-8 support yet
I may be mistaken then. I assumed it already fully supported UTF-8 as it seems to support multiple languages with the intllib mod.

--- Edit ---

That reminds me, I should probably add intllib support.

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

Re: [Mod] List Items [0.2] [listitems]

by Wuzzy » Post

Or maybe the UTF-8 bugs got already fixed. No idea, I haven't tracked this for a long time. You should talk to Minetest developers.

By the way: I think this mod is ready for release.
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
Lone_Wolf
Member
Posts: 2458
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: Lone_Wolf or LoneWolfHT
In-game: Lone_Wolf
Location: Not there, THERE!

Re: [Mod] List Items [0.3] [listitems]

by Lone_Wolf » Post

Great mod! Would love to see this as a CSM also.
My ContentDB -|- Working on Voxel Knights -|- Minetest Forums Dark Theme!! (You need it)

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] List Items [0.4] [listitems]

by AntumDeluge » Post

Wuzzy wrote:Or maybe the UTF-8 bugs got already fixed. No idea, I haven't tracked this for a long time. You should talk to Minetest developers.

By the way: I think this mod is ready for release.
Added intllib support, in which the bullet character can be changed.

listitems @ Git commit 66d8a09

Also, requested topic move for mod release.
Lone_Wolf wrote:Great mod! Would love to see this as a CSM also.
I might think about doing this in the future.

--- Edit ---

Added config setting listitems.bullet_list to enable/disable displaying items in bulleted list (default: true).

listitems @ Git commit fe5718d

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

Re: [Mod] List Items [0.4] [listitems]

by Wuzzy » Post

Idea: Also add a “listentities” command. Same syntax as listitems, but lists all registered entities instead.

Idea: For items, also write the description in brackets (only if not nil, of course).

Maybe idea: For items, also search through the descriptions when using keywords (I'm not sure if this might cause problems).

Finally: Please rewrite the command help a bit. It is not clear what the parameters mean.
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] List Items [0.4] [listitems]

by AntumDeluge » Post

Wuzzy wrote:Idea: Also add a “listentities” command. Same syntax as listitems, but lists all registered entities instead.
Funny, I was actually thinking about that last night.
Wuzzy wrote:Idea: For items, also write the description in brackets (only if not nil, of course).
Sounds good to me.
Wuzzy wrote:Maybe idea: For items, also search through the descriptions when using keywords (I'm not sure if this might cause problems).
This one might be a little more difficult for me, but I think it is a good idea. There should be parameters to search in item names &/or descriptions.
Wuzzy wrote:Finally: Please rewrite the command help a bit. It is not clear what the parameters mean.
Any suggestions? I was worried it was unclear when I wrote it. I'm not always the best at describing things or writing documentation.

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] List Items [0.4] [listitems]

by AntumDeluge » Post

UPDATED!!! Use the -v option to display item descriptions.

listitems @ Git commit f3bf759


--- Edit ---

UPDATED!!! listentities command added.
  • Might be buggy.
  • Displaying descriptions doesn't seem to work.
listitems @ Git commit c0b9160

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

Re: [Mod] List Items [0.5] [listitems]

by Wuzzy » Post

de.txt:
## Help output description
List registered items = Registrierte Gegenstände anzeigen
List registered entities = Registrierte Entities anzeigen

## Help output parameters
options = Optionen
string1 = Text 1
string2 = Text 2

## Player used unrecognized switch
Unknown option: = Unbekannte Option:

## Search description
Searching in names ... = In Namen suchen …
Searching in names and descriptions ... = In Namen und Beschreibungen suchen …

## Number of items listed
Objects listed: = Aufgezählte Objekte:

## Bullet (change this if there are problems displaying the raw character "•")
• = •
Do what you want.

The commands themselves should NOT be translatable. This is asking for trouble. Mods and the Mesecons command block need to able to depend on the command name.
The -v option is missing in the command help. Hiding it in “options” is bad, because the user does not know which options are there. Better just show every possible option explicitly.



EDIT:
Oh, screenshot.png needs fixing. Required aspect ratio is 3:2 with a minimum size of 300×200 pixels.
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] List Items [0.5] [listitems]

by AntumDeluge » Post

Thank you Wuzzy. I will make these changes & add your translation. I really appreciate the feedback.

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] List Items [0.5] [listitems]

by AntumDeluge » Post

Wuzzy wrote:de.txt:
listitems @ Git commit 0ac4402
Wuzzy wrote:The commands themselves should NOT be translatable.
listitems @ Git commit 1748f06
Wuzzy wrote:The -v option is missing in the command help. Hiding it in “options” is bad, because the user does not know which options are there. Better just show every possible option explicitly.
listitems @ Git commit 5eed4cb
Wuzzy wrote:screenshot.png needs fixing. Required aspect ratio is 3:2 with a minimum size of 300×200 pixels.
listitems @ Git commit 499bc6f

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] List Items [0.4] [listitems]

by AntumDeluge » Post

AntumDeluge wrote:
  • Displaying descriptions doesn't seem to work.
I was wrong, it does work. It's just that there aren't many entities in my game that have descriptions.

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] List Items [0.5] [listitems]

by AntumDeluge » Post

Added listores chat command:

listitems @ Git commit a25011e


--- Edit ---

Now commands can be invoked as /list items. Single-word commands (e.g. /listitems) are considered aliases:

/list items = /listitems
/list entities = /listentities
/list ores = /listores

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

Re: [Mod] List Items [0.5] [listitems]

by Wuzzy » Post

/list?

This sounds dangerous, it seems likely this word has already be used by some other mod or will be in the future because it is too freaking generic. I'd recommend to remove /list. It's pointless anyway because it's just longer than the real commands.
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
AntumDeluge
Member
Posts: 192
Joined: Sun Aug 07, 2016 05:42
GitHub: AntumDeluge
IRC: AntumDeluge
Contact:

Re: [Mod] List Items [0.5] [listitems]

by AntumDeluge » Post

You think so? I guess I kind of had the same feeling, but ignored it. You are probably right.

Can't registered chat commands be iterated? I could check first that it doesn't exist before registering it. I guess it's still not a great idea though. The core might one day like to make use of the list command.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests