Suggestion - Notepad
Posted: 04 Feb 2016 05:54
An account-tied notepad would be handy. Something like 1KB of storage in a menu similar to the settings menu would be cool.
The Official Genesis MUD Forums
https://www.genesismud.org/forums/
... Wait, what? You know how to save to userdata, but you don't know how to make your own textbox that reads/saves from it?Mayobe wrote:Yeah, that's what I'm doing at the moment, but it's kind of a pain when it could just be a text box.
Code: Select all
Pattern: mknote
Execute the following javascript:
gwc.userdata.notes.push(args['*']);
gwc.output.append("Added note #" + (gwc.userdata.notes.length - 1).toString());
gwc.output.color("magenta");
---------------------------------------------------------
Pattern: notes
Execute the following javascript:
if(gwc.userdata.notes.length > 0) {
for(var i = 0; i < gwc.userdata.notes.length; i += 1) {
var str = i.toString() + "] " + gwc.userdata.notes[i];
gwc.output.append(str);
gwc.output.color("cyan");
}
}
else {
gwc.output.append("There are no notes recorded!");
gwc.output.color("magenta");
}
gwc.output.append(">");
---------------------------------------------------------
Pattern: rmnote
Execute the following javascript:
var which = parseInt(args[1], 10);
if(which >= 0 && which < gwc.userdata.notes.length) {
gwc.userdata.notes.splice(which, 1);
gwc.output.append("Removed note #" + which + ".");
}
else {
gwc.output.append("No such note!");
}
gwc.output.color("magenta");
gwc.output.append(">");
---------------------------------------------------------
Pattern: clear_all_notes
Execute the following javascript:
gwc.userdata.notes = [];
gwc.output.append("Notepad cleared.");
gwc.output.color("red");
---------------------------------------------------------
Pattern: dn
Execute the following javascript:
var which = parseInt(args[1], 10);
if(which >= 0 && which < gwc.userdata.notes.length) {
gwc.connection.send(gwc.userdata.notes[which], true);
}
else {
gwc.output.append("No such note!");
gwc.output.color("magenta");
}