It is currently April 16th, 2024, 9:04 pm

Lua user counter question

Discuss the use of Lua in Script measures.
Zaragan
Posts: 58
Joined: January 10th, 2015, 3:14 pm

Lua user counter question

Post by Zaragan »

I everyone! I was thinking of adding some online user counter and what i will need to do it (some backend database or such). Can someone give me a push on the right direction to do it? I'm not asking for code, just the tools to do it!! I love breaking my head on walls to reach my goals :D I have a little knowledge of js, php and mysql but nothing to deep.

Thank you so much to everyone!!
User avatar
balala
Rainmeter Sage
Posts: 16142
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Lua user counter question

Post by balala »

Zaragan wrote: November 3rd, 2020, 12:41 am I was thinking of adding some online user counter and what i will need to do it (some backend database or such). Can someone give me a push on the right direction to do it?
Not enough details, so please post some. For instance why have you posted this question into the Lua scripting section? Such task usually can be done with plain Rainmeter code, through WebParser measures, no need for lua, but if login is required to get the users, that's impossible for those WebParser meausres.
So what is the source of the information you'd like to collect and which those information are? Give us a few details please.
Zaragan
Posts: 58
Joined: January 10th, 2015, 3:14 pm

Re: Lua user counter question

Post by Zaragan »

balala wrote: November 3rd, 2020, 1:39 pm Not enough details, so please post some. For instance why have you posted this question into the Lua scripting section? Such task usually can be done with plain Rainmeter code, through WebParser measures, no need for lua, but if login is required to get the users, that's impossible for those WebParser meausres.
So what is the source of the information you'd like to collect and which those information are? Give us a few details please.
Hi! I don't want to collect any information, i just want the skin to send a packet to a server where i can count the total packets (using my skin) and then add that number to that skin. Simplifing things, a user counter. If 5 people are using my skin i want to add that "5" to mi skin. I've posted on lua because i don't see how rainmeter can do that. I thought that rainmeter can ping some server and then i can read that pings on backend but it wont work because everything hitting the server will count, am i right?

Thinking of it again while i was writing it, can i ping a certain port and just read the pings on that specific port on backend???

Thank you balala!
User avatar
balala
Rainmeter Sage
Posts: 16142
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Lua user counter question

Post by balala »

Zaragan wrote: November 3rd, 2020, 1:54 pm Hi! I don't want to collect any information, i just want the skin to send a packet to a server where i can count the total packets (using my skin) and then add that number to that skin. Simplifing things, a user counter. If 5 people are using my skin i want to add that "5" to mi skin. I've posted on lua because i don't see how rainmeter can do that. I thought that rainmeter can ping some server and then i can read that pings on backend but it wont work because everything hitting the server will count, am i right?

Thinking of it again while i was writing it, can i ping a certain port and just read the pings on that specific port on backend???
Unfortunately I don't know. Have to think a little bit deeper onto this, but for now, I'n not sure at all.
Sorry...
Zaragan
Posts: 58
Joined: January 10th, 2015, 3:14 pm

Re: Lua user counter question

Post by Zaragan »

balala wrote: November 3rd, 2020, 2:07 pm Unfortunately I don't know. Have to think a little bit deeper onto this, but for now, I'n not sure at all.
Sorry...
Don't worry, for now im fine knowing if this is possible or not. Thinking how to do it if it's possible will be next! Thank you anyways balala!!
User avatar
balala
Rainmeter Sage
Posts: 16142
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Lua user counter question

Post by balala »

Zaragan wrote: November 3rd, 2020, 2:09 pm Don't worry, for now im fine knowing if this is possible or not. Thinking how to do it if it's possible will be next! Thank you anyways balala!!
For nothing, I didn't help this time. Hoping someone else out there will help you soon.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Lua user counter question

Post by jsmorley »

I'm not sure how I would even start with this. At the end of the day, about the only thing you can do natively with Rainmeter is read some text file. That can be an HTML / XML / JSON file you get to by serving it via HTTP or FTP, or a physical file you get to via a path to a location on a local hard drive or shared server drive. I don't think Lua adds any particular value to this, as WebParser is probably all you need to access the information. Then you parse that and return the value.

I don't see that Rainmeter is going to do anything based on "pings" to a server, unless you want to use WebParser to parse a server log somewhere.
Zaragan
Posts: 58
Joined: January 10th, 2015, 3:14 pm

Re: Lua user counter question

Post by Zaragan »

Ok, a followup on this.

I've already done the code for a tcp socket and prepared all the "backend" of this proyect. then while i was trying to make a connection trough rainmeter lua5.1 manual, wrote the code to start the connection aaaaand BUM! First wall.

Code: Select all

local host, port = "127.0.0.1", 11111
local socket = require("socket")
.
.
.
.
Image
Ok i might need to declare it first... weird but ok, i dont know lua so...

NOPE!

2 freaking hours looking at the lua reference, tests codes and surfing to find that EVERYONE uses that code and it's just rainmeter that CAN'T USE REQUIRE!!!!!!

PLEASE!! Put the "Restrictions" section of the lua scripting at the top or make a link on the reference left menu.....

regexp can only "read" so until rainmeter can "talk" outside this proyect is on hold...
User avatar
balala
Rainmeter Sage
Posts: 16142
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Lua user counter question

Post by balala »

dvo wrote: November 6th, 2020, 3:53 pm Sorry, but in all the years i didn't see rainmeter talk maybe when it's a A.I. it will :D
Well, actually Rainmeter can talk...
User avatar
balala
Rainmeter Sage
Posts: 16142
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Lua user counter question

Post by balala »

dvo wrote: November 6th, 2020, 4:37 pm only not on my computer... dutch they still don't have ....
But Dutch is also available (as well as many other languages), supposing the proper Windows language pack is installed on the computer. See this and the Name option on the above link.