Is there a way to have global Functions that I can declare in onLoad or something? Going to try to Nexus instead of mudlet for Starmourn so I'm looking for feature parity in some things or a way to make similar things happen. Love JavaScript! Got some nice GMCP stuff going though!
What all do I have access to in JavaScript? Can I use window stuff? Is jQuery a thing I can use to mess with the UI? What all can I modify UI-wise?
Download Montem System for Nexus Client -
https://pastebin.com/MBEn7S0u0
Comments
// @require https://code.jquery.com/jquery-3.3.1.slim.js
$(document).ready(myFunction);
The help file has links to jquery, so I'd say yes, but I've never used it personally.
As for window stuff- you can reset some of the client window using scripts, and you can generate forms to fill using javascript to open a window.
So instead of:
var havebalance = true;
use:
var client.havebalance = true;
var client.afunction = function () { display_notice('hi') }
work?
I'd check myself but I'm at work
Error in Function [test]:
SyntaxError: Unexpected token .
Regarding this onLoad stuff... so youre saying if I declare a variable with the client namespace I can functionally have global variables I can access? You say var = client.function doesnt work but would objects and arrays?
Also would test myself but am away.
One thing I did find yesterday during testing that I thought you all might like to know, is that client.print is not captured in a log.
You probably know that you can use two things to put text on the screen:
display_notice("whatever");
or
client.print("whatever");
They both appear functionally the same, and I've used both. I often used client.print just cause it's easier to type. However, I captured a log file yesterday, and nothing sent using client.print appeared in the log text, while the display_notice text does. You can still copy the client.print text out of the window and paste it somewhere, but if you are using it for debugging or something, and want it to appear in a log- it won't.