Lua & Ptokax logged user list
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Lua & Ptokax logged user list

Started by ruspant, 11 September, 2004, 03:20:07

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ruspant

I'm trying to get the entire logged user list inside a script which perform timed checks on users.
The problem is I can't find a function to get the entire list in one time.
If I use GetProfiles-GetProfileName-GetUsersByProfile i miss the unregged users.
The only solution I've found is pretty ugly..... I'm monitoring the $GetINFO string inside DataArrival to build a Nick table which I keep clean checking if users still exists every 3-4 mins. :(
Since this table is empty when the script starts, I've tried to send the command for getting the list once at start:
SendToAll("$GetNickList")
but nothing happens.....
Things start working when I (or another users) refresh the client user list .
Please, help me to find a better solution at this problem.
Regards

Herodes

Are you trying to get just the nicks ?
or you want to have their MyINFO available too ?
basically u should grab the MyINFO's and then put any of the information they provide in a table under the nick ...

when the user disconnects you should remove his part of the table so that the table conforms to the existing situation ..

ruspant

First, let me say I know very little about the protocol. I've written a little script to put any DataArrival back in pvt and start observing....

What i would like to do is that my script should build the logged nick table at his startup.
Then I can use connect/disconnect events to keep nick table updated.

Up to now it rebuilds the table each time any user is loggin in ... not so nice.

Is there any way to access logged user list on ptokax ?

Herodes

Unfortunately at present there is not a way to access the userlist through script.
But you can use the DataArrival to built a table ..
It would be nice to see the script so we/I can comment advice on something :)

plop

check my micro_chatroom series for some hints 2 do it without a timer.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

ruspant

Ok plop, it's nice to use the NewUserConnected and OpConnected functions to keep the logged nick table updated.

But if I stop my script and restart it at any time, the table will be empty and start building again for the new connections only.

What I'm trying to do is a sort of "GetUserConnectedAtThisTime" function which is not affected by script restarting.

I think it's quite amazing that a so basic function isn't yet exported by ptokax to lua.... hoping for future release but meanwhile I'm still in trouble....  :(

plop

piece from micro_chatroom v3.
function DataArrival(user, data)
   if tUsers[user.iProfile] == nil then
      tUsers[user.iProfile] = {}
   end
   if tUsers[user.iProfile][user.sName] == nil then
      tUsers[user.iProfile][user.sName] = 1
   end
thats why i also check on dataarival.
that solves the restart problem.
but indeed it won't give a instand update.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

ruspant

thx plop
I've missed it the first time ! ^__^
Yes, it's not immediate but it's a quite fast way to build up the table

ruspant

HaArD

#8
ruspant,

Keep asking for it...  I have also wondered why such a simple, straightforward, thing as a list of active Nicks in the hub cannot be supplied to the scripting interface in a constantly updated state.

I can tell you for sure that as of .330 b15.30 it has not been added to the next version of PtokaX and there wasn't any plans to add it a few months ago. Maybe plop has more current info.....

As for the reset problem... try saving the table to a file whenever you add/remove a user. In Main, load the table from the file, that way whenever you reset the script you'll keep the content of the table from before....

SMF spam blocked by CleanTalk