Subj : Getting number of active nodes
To   : nolageek
From : Digital Man
Date : Tue Jun 14 2022 10:59 pm

 Re: Getting number of active nodes
 By: nolageek to Digital Man on Tue Jun 14 2022 11:57 pm

>   Re: Couple of JS Questions
>   By: Digital Man to Apam on Mon May 23 2022 10:00 pm
>
> I'm working on a mod to turn on a light when I have active nodes - however
> sometimes the light will stay on after someone logs off, even when no one
> else is logged in - but there is a active connection by a bot, scanner, or
> network call of some kind.  I'm currently using server.clients to get this
> number but it's leaving the light on (and not in a good Motel 6 kind of way)
>
> Is there a better way to get the number of actual nodes with a user actually
> logged in?

Iterate through the system.node_list array and count up how many have a status property value of NODE_INUSE (defined in load/nodedefs.js). Or just simply set/return true if *any* of them are in-use (you don't need the actual total).

That should leave the light on for ya only when there's an actual rent-paying customer. :-)
--
                                           digital man (rob)

Rush quote #70:
He's got a problem with his power, with weapons on patrol .. New World Man
Norco, CA WX: 66.4�F, 78.0% humidity, 1 mph SE wind, 0.00 inches rain/24hrs

---
� Synchronet � Vertrauen � Home of Synchronet � [vert/cvs/bbs].synchro.net