Re: Creating message menu
By: Amessyroom to All on Tue Sep 24 2024 22:41:15
I've taken code from default.js to create a message menu but there are two components, that I don't understand that are in the code: What are node_action: value? NODE_XFER was just copied from the file menu
What is the "eval: 'bbs.messages_cmds++' used for?
The "message_menu" variable contains values that the script uses to take a few actions when the user opens that menu. The "file", "prompt", and "command" properties are fairly obvious.
"eval" is a place where you can specify some JS code that will be executed when the menu loads (including when a user returns from a command, I think). So the bbs.messages_cmds variable is being incremented when this happens. For reasons I don't know.
(And each command can have an "eval" or "exec" depending on whether you want to run script from a string or execute a file to fulfill the command.)
As an aside, these "menu objects" seem very much like they were meant to be stored in JSON files. "eval" would make some sense there; inside the script itself these could just be functions.
node_action: NODE_XFER,
https://synchro.net/docs/jsobjs.html#bbs_object
The "bbs" object has a "node_action" property which says what the user is currently doing. This is used in things like a "who's online" list. As DM said, look at "exec/load/nodedefs.js" for possible values.
This script takes the "node_action" value from the menu object and applies it when the menu loads. So it's setting "bbs.node_action = NODE_XFER", which corresponds to "at transfer menu". I would say NODE_RMSG is probably the best fit when the user is viewing the messages menu.
echicken
electronic chicken bbs - bbs.electronicchicken.com
---
þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com