I'm playing with Sync JS, and trying to learn it, but I am stumped as how to get the node number. To be honest, I've hacked bits and pieces to try to make one. Everything displays except the node. Here is the part I'm having a issue with. I marked the area with -----. If you can give me the correct line I need, or paremeter, and explain it like I'm a 5 year old, it will Be appreciated.
/* Display the first n users in the given array. */
function displayLastCallers(users, limit)
{
for(var i = 0; (i < users.length) && (i < limit); i++)
{
var alias = formatString(users[i].alias, 16);
alias = colorizeString(alias);
var location = formatString(users[i].location, 20);
location = colorizeString(location);
var lastOn = formatDate(new Date(system.timestr(users[i].stats.laston_date)), "NNN. dd, y hh:mma");
lastOn = formatString(lastOn, 22);
lastOn = colorizeString(lastOn);
var mode = formatString(users[i].connection, 6);
mode = colorizeString(mode);
var age = users[i].age;
if(users[i].age <= 0)
{
age = " ";
}
else
{
age = formatString(age, 3);
age = colorizeString(age);
} ------------------------------------------------------------------ ------------ Problem Area
var node = formatString(system[i].get_node, 2);
node = colorizeString(node); ----------------------------------- -------------------------------------------
"system" is not an array, so that syntax ("system[]") isn't going to work. Additionally, a user does not have a "node number" property. A user can be on multiple nodes and any node can serve any user, so the association doesn't really make any sense. Are you looking for the last node number that a user used or a node that is currently in-use or what? --
digital man
The current node number is available in JS via bbs.node_num.
See synchro.net/docs/jsobjs.html for the reference.
The current node number is available in JS via bbs.node_num.
"system" is not an array, so that syntax ("system[]") isn't going to work. Additionally, a user does not have a "node number" property. A user can be on multiple nodes and any node can serve any user, so the association doesn't really make any sense. Are you looking for the last node number that a user used or a node that is currently in-use or what? --
Re: String for node
By: Digital Man to DesotoFireflite on Sun Dec 13 2020 01:51 pm
"system" is not an array, so that syntax ("system[]") isn't going to work. Additionally, a user does not have a "node number" property. A user can be on multiple nodes and any node can serve any user, so the association doesn't really make any sense. Are you looking for the last node number that a user used or a node that is currently in-use or what? --
digital man
Actually, I'm looking for the node number this particular person is on at the time this .js is run. It's a last callers bulletin.
The current node number is available in JS via bbs.node_num.
See synchro.net/docs/jsobjs.html for the reference.
I think I tried that, but I'll try it again. I should have written down the things I've tried.
Re: String for node
By: Digital Man to DesotoFireflite on Sun Dec 13 2020 01:51 pm
The current node number is available in JS via bbs.node_num.
var node = formatString(bbs[i].node_num, 2);
node = colorizeString(node);
Doesn't work
var node = formatString(bbs.node_num, 2);
node = colorizeString(node);
Does work, but it fills every users node with the same number, looking to update for the one person only thats online at this time.
work. Additionally, a user does not have a "node number" property. A user can be on multiple nodes and any node can serve any user, so the association doesn't really make any sense. Are you looking for the last node number that a user used or a node that is currently in-use or what? --
the node the person is on at the present time. the same as stored in synchronets users on today.
the node the person is on at the present time. the same as stored in
synchronets users on today.
See data/logon.jsonl and exec/logonlist.js and exec/load/logonlist_lib.js
Re: String for node
By: Digital Man to DesotoFireflite on Mon Dec 14 2020 09:11 pm
the node the person is on at the present time. the same as stored in
synchronets users on today.
See data/logon.jsonl and exec/logonlist.js and exec/load/logonlist_lib.js
I saw those, and honestly, I don't have what it takes to figure it out. I bow my head in shame, but thats way over my head at the stage I am at trying to learn. I'll keep working on it, as I did figure out some other stuff, but I just can't figure out how to pull the node out of it. Thanks for trying to help, hopefully in time I will understand enough js to figure it out myself.
Thanks for trying DM, I do appreciate it.
Here's a simplified example:
var list = load({}, "logonlist_lib.js").get();
for(var l in list)
print(list[l].node + " " + list[l].user.alias);
There's a lot more information available than just user alias and node number, but I was just including those fields as an example. You can use this to print the entire logon info object instead of just those 2 fields, if you're curious:
print(lfexpand(JSON.stringify(list[l], null, 4)));
--
Sysop: | altere |
---|---|
Location: | Houston, TX |
Users: | 66 |
Nodes: | 4 (0 / 4) |
Uptime: | 14:56:30 |
Calls: | 599 |
Files: | 7,638 |
Messages: | 291,680 |