[Client-side Mod] Simple stats [counter]

Post Reply
User avatar
TalkLounge
Member
Posts: 324
Joined: Sun Mar 26, 2017 12:42
GitHub: TalkLounge
In-game: TalkLounge
Location: Germany

[Client-side Mod] Simple stats [counter]

by TalkLounge » Post

Hi,
this mod counts various ingame actions on servers and in singleplayer
Image

Usage
Image

License
MIT

Dependencies
None

Download
Video
Download
Browse on Github

Changelog
1.0: The mod was created
1.1: Changed some grammar mistakes
1.2: Added the total online time
1.4: Now compatible with minetest 5.x and fixed not working singleplayer count
Last edited by TalkLounge on Sat Jul 03, 2021 22:41, edited 8 times in total.
Subgames Server: Sky World Subgames German Survival Server: Wildes Land 2 E-Mail: talklounge@yahoo.de

User avatar
maikerumine
Member
Posts: 1420
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: [Client-side Mod] Simple stats [counter]

by maikerumine » Post

This is sweet! So it tracks everything on all servers visited eh!
Talamh Survival Minetest-->viewtopic.php?f=10&t=12959

BBmine
Member
Posts: 3476
Joined: Sun Jul 12, 2015 22:51
GitHub: BBmine
IRC: BBmine
In-game: Baggins
Location: USA

Re: [Client-side Mod] Simple stats [counter]

by BBmine » Post

Cool CSM, but a few things I must point out:

"dug", not "digged"
"sent", not "send"
"connected", not "connect"
:D

Just me being a little Grammer-Nazi ;)

User avatar
TalkLounge
Member
Posts: 324
Joined: Sun Mar 26, 2017 12:42
GitHub: TalkLounge
In-game: TalkLounge
Location: Germany

Re: [Client-side Mod] Simple stats [counter]

by TalkLounge » Post

Thanks
I will change it. :)
Subgames Server: Sky World Subgames German Survival Server: Wildes Land 2 E-Mail: talklounge@yahoo.de

User avatar
Lone_Wolf
Member
Posts: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [Client-side Mod] Simple stats [counter]

by Lone_Wolf » Post

I'm definitely getting this mod lol!
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
Fixer
Member
Posts: 904
Joined: Sun Jul 31, 2011 11:23
IRC: Fixer
In-game: Fixer
Location: Ukraine

Re: [Client-side Mod] Simple stats [counter]

by Fixer » Post

Please also add "Played N hours"

User avatar
TalkLounge
Member
Posts: 324
Joined: Sun Mar 26, 2017 12:42
GitHub: TalkLounge
In-game: TalkLounge
Location: Germany

Re: [Client-side Mod] Simple stats [counter]

by TalkLounge » Post

Please also add "Played N hours"
Very cool idea. I added it.
Subgames Server: Sky World Subgames German Survival Server: Wildes Land 2 E-Mail: talklounge@yahoo.de

User avatar
Fixer
Member
Posts: 904
Joined: Sun Jul 31, 2011 11:23
IRC: Fixer
In-game: Fixer
Location: Ukraine

Re: [Client-side Mod] Simple stats [counter]

by Fixer » Post

As of engine 5117ce4c:
ERROR[Main]: ModError: Failed to load and run mod "counter":
ERROR[Main]: counter:init.lua:51: attempt to call field 'register_on_sending_chat_messages' (a nil value)
ERROR[Main]: stack traceback:
ERROR[Main]: counter:init.lua:51: in main chunk

User avatar
TalkLounge
Member
Posts: 324
Joined: Sun Mar 26, 2017 12:42
GitHub: TalkLounge
In-game: TalkLounge
Location: Germany

Re: [Client-side Mod] Simple stats [counter]

by TalkLounge » Post

As of engine 5117ce4c:
Change in the init.lua, that "register_on_sending_chat_messages" to that "register_on_sending_chat_message". Then it should work with your minetest version. There are two version of Minetest. The official 0.4.16, they say: register_on_sending_chat_messages
On the 0.4.16 dev they say: "register_on_sending_chat_message"
Subgames Server: Sky World Subgames German Survival Server: Wildes Land 2 E-Mail: talklounge@yahoo.de

User avatar
Lone_Wolf
Member
Posts: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [Client-side Mod] Simple stats [counter]

by Lone_Wolf » Post

TalkLounge wrote:
As of engine 5117ce4c:
Change in the init.lua, that "register_on_sending_chat_messages" to that "register_on_sending_chat_message". Then it should work with your minetest version. There are two version of Minetest. The official 0.4.16, they say: register_on_sending_chat_messages
On the 0.4.16 dev they say: "register_on_sending_chat_message"
Might want to do a kind of Q&A spoiler in the first post. Or at least explain this above. Some ppl might be too lazy to scroll down lol
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Client-side Mod] Simple stats [counter]

by azekill_DIABLO » Post

yeepee!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
Fixer
Member
Posts: 904
Joined: Sun Jul 31, 2011 11:23
IRC: Fixer
In-game: Fixer
Location: Ukraine

Re: [Client-side Mod] Simple stats [counter]

by Fixer » Post

New error as of engine 584d00a0, when starting singleplayer world:

Code: Select all

2018-01-30 21:19:04: ERROR[Main]: ModError: Failed to load and run mod "counter":
2018-01-30 21:19:04: ERROR[Main]: counter:init.lua:61: attempt to call field 'register_on_connect' (a nil value)
2018-01-30 21:19:04: ERROR[Main]: stack traceback:
2018-01-30 21:19:04: ERROR[Main]: 	counter:init.lua:61: in main chunk

User avatar
PolySaken
Member
Posts: 817
Joined: Thu Nov 09, 2017 05:18
GitHub: PolySaken-I-Am
In-game: PolySaken
Location: Wānaka, Aotearoa
Contact:

Re: [Client-side Mod] Simple stats [counter]

by PolySaken » Post

BBmine wrote:Cool CSM, but a few things I must point out:

"dug", not "digged"
"sent", not "send"
"connected", not "connect"
:D

Just me being a little Grammer-Nazi ;)
"Grammar", not "Grammer"

"Grammer" is a name.

>:)
Guidebook Lib, for in-game docs | Poly Decor, some cool blocks | Vision Lib, an all-purpose library.

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Client-side Mod] Simple stats [counter]

by aristotle » Post

TalkLounge wrote:this mod counts your doing on a server....
+1!
:D
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
Wolfshippie
Member
Posts: 116
Joined: Mon Jul 24, 2017 12:37
GitHub: Wolfshippie
IRC: wolfshippie
In-game: wolfshippie minehippie
Location: Franconia, Bavaria, Germany
Contact:

Re: [Client-side Mod] Simple stats [counter]

by Wolfshippie » Post

Code: Select all

2020-04-19 18:32:54: ERROR[Main]: ModError: Failed to load and run mod "counter":
2020-04-19 18:32:54: ERROR[Main]: counter:init.lua:68: attempt to call field 'register_on_connect' (a nil value)
2020-04-19 18:32:54: ERROR[Main]: stack traceback:
2020-04-19 18:32:54: ERROR[Main]: 	counter:init.lua:68: in main chunk

User avatar
debiankaios
Member
Posts: 910
Joined: Thu Dec 03, 2020 12:48
IRC: debiankaios
In-game: debiankaios Nowe
Location: germany
Contact:

Re: [Client-side Mod] Simple stats [counter]

by debiankaios » Post

TalkLounge wrote:
Sat Jul 08, 2017 16:00
Hi,
this mod counts your doing on a server. There are many counts to different topics(look screenshot spoiler).

Usage
Image

License
Code: LGPL v2.1+

Dependencies
None

Download
Video
Download
Browse on Github
Spoiler
Image
Spoiler
  • 1.0
    The mod was created
  • 1.1
    Changed some grammar mistakes
  • 1.2
    Added the total online time
Don't worl!!!

User avatar
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

Re: [Client-side Mod] Simple stats [counter]

by Miniontoby » Post

Fixer wrote:
Tue Jan 30, 2018 19:29
New error as of engine 584d00a0, when starting singleplayer world:

Code: Select all

2018-01-30 21:19:04: ERROR[Main]: ModError: Failed to load and run mod "counter":
2018-01-30 21:19:04: ERROR[Main]: counter:init.lua:61: attempt to call field 'register_on_connect' (a nil value)
2018-01-30 21:19:04: ERROR[Main]: stack traceback:
2018-01-30 21:19:04: ERROR[Main]: 	counter:init.lua:61: in main chunk
Client side modding is not meaned for singleplayer, so if you go on singleplayer just disable it (or maybe try to use as an mod instead of client side)

[EDIT]
Its not possible to do register_on_connect in csm. check: https://github.com/minetest/minetest/bl ... ua_api.txt

You could use do the following:
edit:

Code: Select all

minetest.register_on_connect(function()
    variable = true
    local number = mod_storage:get_int(connect)
    mod_storage:set_int(connect, number + 1)
end)
to:

Code: Select all

minetest.after(5, function()
    variable = true
    local number = mod_storage:get_int(connect)
    mod_storage:set_int(connect, number + 1)
end)
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

User avatar
Mesenotaur
New member
Posts: 6
Joined: Tue Mar 02, 2021 12:42
GitHub: Mesenotaur

Re: [Client-side Mod] Simple stats [counter]

by Mesenotaur » Post

BBmine wrote:
Sat Jul 08, 2017 16:43
Cool CSM, but a few things I must point out:

"dug", not "digged"
"sent", not "send"
"connected", not "connect"
:D

Just me being a little Grammer-[..] ;)
TalkLounge wrote:
Sat Jul 08, 2017 16:46
Thanks
I will change it. :)
Hello there!
In the quoted message, you said you’d fix these grammar issues. But they are still present. Could you, TalkLounge, please fix them?
And it’d be nice if you also fixed the bug with register_on_connect. Miniontoby’s solution works perfectly for me.
I will make a PR.
--Mesenotaur

User avatar
Mesenotaur
New member
Posts: 6
Joined: Tue Mar 02, 2021 12:42
GitHub: Mesenotaur

Re: [Client-side Mod] Simple stats [counter]

by Mesenotaur » Post

Miniontoby wrote:
Sat Jan 30, 2021 13:50
Fixer wrote:
Tue Jan 30, 2018 19:29
New error as of engine 584d00a0, when starting singleplayer world:

Code: Select all

2018-01-30 21:19:04: ERROR[Main]: ModError: Failed to load and run mod "counter":
2018-01-30 21:19:04: ERROR[Main]: counter:init.lua:61: attempt to call field 'register_on_connect' (a nil value)
2018-01-30 21:19:04: ERROR[Main]: stack traceback:
2018-01-30 21:19:04: ERROR[Main]: 	counter:init.lua:61: in main chunk
Client side modding is not meaned for singleplayer, so if you go on singleplayer just disable it (or maybe try to use as an mod instead of client side)

[EDIT]
Its not possible to do register_on_connect in csm. check: https://github.com/minetest/minetest/bl ... ua_api.txt

You could use do the following:
edit:

Code: Select all

minetest.register_on_connect(function()
    variable = true
    local number = mod_storage:get_int(connect)
    mod_storage:set_int(connect, number + 1)
end)
to:

Code: Select all

minetest.after(5, function()
    variable = true
    local number = mod_storage:get_int(connect)
    mod_storage:set_int(connect, number + 1)
end)
Hi!
Thanks a lot, a lot and a real lot for this explanation and the fix of register_on_connect Miniontoby! Many CSM I tried out used this, I’ll test if they work after changing that one line :D
May I ask: What does the after(5 mean? Does it mean that five seconds after join, the mod will be started? If so, could it be put lower to like 2 or even 1 or 0?
--Mesenotaur

User avatar
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

Re: [Client-side Mod] Simple stats [counter]

by Miniontoby » Post

Mesenotaur wrote:
Fri Jun 04, 2021 20:25
Miniontoby wrote:
Sat Jan 30, 2021 13:50
You could use do the following:
edit:

Code: Select all

minetest.register_on_connect(function()
    variable = true
    local number = mod_storage:get_int(connect)
    mod_storage:set_int(connect, number + 1)
end)
to:

Code: Select all

minetest.after(5, function()
    variable = true
    local number = mod_storage:get_int(connect)
    mod_storage:set_int(connect, number + 1)
end)
Hi!
Thanks a lot, a lot and a real lot for this explanation and the fix of register_on_connect Miniontoby! Many CSM I tried out used this, I’ll test if they work after changing that one line :D
May I ask: What does the after(5 mean? Does it mean that five seconds after join, the mod will be started? If so, could it be put lower to like 2 or even 1 or 0?
--Mesenotaur
Hey dude,

I can explain you why after(5 and not 0 or 1, that's because if you do it too early then your client might crash because you are not yet fully in, (mostly when you are joining huge server) when they restart it (or your connection times out) whilest you are in joining then you get an error too, because it couldn't save anything.

So thats why it should be after(5 and not anything else.
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

User avatar
TalkLounge
Member
Posts: 324
Joined: Sun Mar 26, 2017 12:42
GitHub: TalkLounge
In-game: TalkLounge
Location: Germany

Re: [Client-side Mod] Simple stats [counter]

by TalkLounge » Post

Update
Client-side Mod works now on all minetest versions and in the singleplayer
Subgames Server: Sky World Subgames German Survival Server: Wildes Land 2 E-Mail: talklounge@yahoo.de

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest