Script v1.0 Will be included in my scripts with the next version, does not contain other features. Code (javascript): ({ serverStartUp : function() { this.afterNewMessage("Script Check: OK"); return; } , afterNewMessage : function (message) { if (message == "Script Check: OK") { if (typeof password == 'undefined') { password = new Array(); } if (typeof serverpass == 'undefined') { serverpass = ''; } if (typeof numUsers == 'undefined') { numUsers = 0;} } } , afterLogIn : function(src) { numUsers += 1; password[src] = sys.getVal('pass:'+sys.name(src)); if (serverpass != password[src] && serverpass != '') { sys.sendMessage(src,'~~Server~~: The server is password protected, please enter the password using /pass password.'); } else { sys.sendAll('~~Server~~: '+sys.name(src)+' has joined!'); } return; } , afterLogOut : function (src) { numUsers -= 1; } , beforeChatMessage: function(src, message) { sys.stopEvent(); if ((message[0] == '/' || message[0] == '!') && message.length > 1) { print("Command -- " + sys.name(src) + ": " + message); var command; var commandData; var pos = message.indexOf(' '); if (pos != -1) { command = message.substring(1, pos).toLowerCase(); commandData = message.substr(pos+1); } else { command = message.substr(1).toLowerCase(); } var tar = sys.id(commandData); if (command == "pass" || command == "password") { sys.saveVal('pass:'+sys.name(src),commandData); password[src] = commandData; if (serverpass != password[src] && serverpass != '') { sys.sendMessage(src,'~~Server~~: Bad password, please enter the password using /pass password.'); } else { sys.sendAll('~~Server~~: '+sys.name(src)+' has joined!'); } return; } if (command == "setpass" || command == "setpassword" && sys.auth(src) >= 2) { sys.saveVal('pass:'+sys.name(src),commandData); password[src] = commandData; serverpass = commandData; sys.sendAll('~~Server~~: The password was changed by '+sys.name(src)+', please enter the password using /pass password.'); return; } if (command == "removepass" || command == "removepassword" && sys.auth(src) >= 2) { sys.removeVal('pass:'+sys.name(src)); password[src] = ''; serverpass = ''; sys.sendAll('~~Server~~: The password was removed by '+sys.name(src)+'.'); return; } return;} if (serverpass != password[src] && serverpass != '' && sys.auth(src) == 0) { sys.sendMessage(src,'~~Server~~: Please enter the password using /pass password.'); return; } var cnt = numUsers; var user = 0; var xx = sys.name(src) +': ' + message; print(xx); while(user < cnt) { if (sys.loggedIn(user) == true) { if (serverpass == password[user] || serverpass == '' || sys.auth(user) > 0) { sys.sendMessage(user,xx); } } else { cnt += 1;} user += 1; } return; } })
I honestly don't see what you're doing to blind the person. Odd... Nevermind. You're intercepting the sendAll()... that's kind of. Ugly. At least it works though.
You call my scripts ugly? I couldn't even tell what on earth you were doing in yours, at least you can understand mine... <.<
Meh. It took me a while to figure out where it was in yours. Half of the complexity in mine is caused by javascript's handling of the "this" keyword which was preventing me from making the before chat message function unaffected by what commands were available. Edit: BTW, I was calling the solution ugly, not your script as a whole. It doesn't speak to your skills a programmer or anything like that. If you're sensing ruffled feathers though, it's that I don't appreciate someone declaring my code deprecated. (Depreciation is devaluing, not the same thing.)
this.bla() is kinda stupid how it works, but I've found that just writing bla() w/o this. seems to work in most cases. Btw, when an HTML tag is replaced, it is considered "depreciated". Im using it in a technical sense. Though one thing you should avoid is calling too many functions unless you need the use of an if return if return thing, I found that it makes things a lot more simple. The blind loop can handle a lot of sends at once, 100/second is not a problem for me.
Lol I didn't even know those were 2 different words. <.< Well, calling functions isn't bad, but it makes it more complex imo. I think functions should only be called if you use it in the same place several times and its quite coplex, or if you need a value, etc. My script isn't a good example of that, since I have a function that calls sys.removeval()... <.<
There's just so much unnecessary things done here, it's not even funny. We have to develop some type of standard to how to separate scriptable methods and in-program methods. If we want more scripting side, I suggest a bare-bones program that only refers to scripts to execute commands, such as sending messages, determining message color, ect. But if we actually wanted a more standard program, we would have mostly program, and very few things to do with the scripts. Right now, our scripts are trying to become the program, and trying to vouce for the features of it. We need to either open up scripting more, or simply close it so that only marginal commands are called to give a different aesthetic feel to each server.
I strongly disagree. Scripting takes some of the load off of the programmer, and gives a touch of personality to the server. Scripting is open enough, any noob can start scripting, I didn't even know the javascript syntax when I started. And I have a major concern, if coyotte did it, it would say: +PASSWORDBOT: Password is incorrect.
I think it'd be great if the auth was just part of the script with an 'Auth options' just adding appropriate code to the script. For example, making the right click menu an event and then just have an add function to add certain commands to it. So in Auth options, you could make any number of auth groups and give them default commands that will be converted into the functions in the script under that right click event. You would also need an event that triggers after the auth options is saved so that the variables containing the members of the auth groups are reset based on those options. And also, a way for the auth options to interpret the code you've added without using it.
How do you disagree when I'm putting up two sides of an issue? Or are you disagreeing with the fact that there could be improvements to scripting openness?