Script suggestions

Discussion in 'Simulator Suggestions' started by Astruvis, May 27, 2010.

Thread Status:
Not open for further replies.
  1. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    I'll add exportTierDatabase() and exportMemberDatabase(), it will create files like the old ones, the whole database.
     
  2. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    can you add display? same as print but it doesn't trigger events.
     
  3. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    You gotta make a display function (this.display()) that uses a boolean global variable, setting it to true. When the beforeNewMessage is processed, if it's set to true, return, and in afterNewMessage, if it's set to true, set it to false and return.

    Then all you got to do is call this.display() with nothing more once this is setup. I'm not sure it's necessary to add too many functions to the built-in API.
     
  4. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Added sys.changeScript(script)

    It's not tested, so it's advised to call return() when this is done to stop processing the current scripts, or i don't know what could happen.
     
  5. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    how do you get sys.dbIp to work?
    I can't get it to return anything other than ''.


    Also, Astruvis[E₥] didn't show up in the alias list, I don't know if this was just because I was online or because of some kind of cache, but that would need a major workaround if its permanent.
     
    Last edited: Jul 10, 2010
  6. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    I fixed the 3 db functions. For the last one, it should show the same thing as in CP...
     
  7. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    Ok, dbIp works, but sys.aliases still doesn't work.

    [​IMG]

    I tried the control panel also(since you said its the same) and it's the same deal there.
    I can search for aliases of 'astruvis[eᵯ]' or read the ip, but it never shows in the list. Dono why it does that, but it does.

    If you want I can upload the database.
     
  8. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    Kk, thanks for fixing that.
    Could exportTierDatabase() and exportMemberDatabase() return strings instead of making files? Or make a different version for that?
     
  9. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Mmm no, because that would ask a lot of RAM. (And when it's written in the files, it's written in a "stream", so i never had the full thing in RAM). I don't see the problem loading from file, as anyway you wouldn't want to call that function often.
     
  10. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Couldn't you just do a "stream" function for the scripts? Exporting to a file seems a bit arbitrary (even if it may be handy in some cases). Also, if you wanted to do anything that couldn't be done with the sys functions for the databases, wouldn't you have to put the whole database in RAM anyway?
     
  11. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    That's why i don't see the problem loading for file. You can do your own function:

    Code (text):
    1. getDatabase : function() {
    2.      sys.exportMemberDatabase();
    3.  
    4.      return sys.readFile("members.tx");
    5. }
    And that's it. As you wouldn't call the exporting functions often, there is no problem using a file as a buffer.

    Anyway, i never intended to support such full access to the database, and for me it's silly doing it that way.
     
  12. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    What if you wanted to read that database every time someone posts a message? loading it into ram is a lot faster...
     
  13. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Why would you do that?

    Why wouldn't you load it once for all, store it in a way you can do lookups fast, remember changes after that loading, and load it back one hour later?

    Loading the whole database to ram everytime someone posts a message, and in javascript, is a silly idea for me.
     
  14. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    I don't see why posting messages is needed as a trigger.

    Name is added when someone changes to or logs on with a new name. [LogIn & TeamChange events]
    Authority is changed when Name's authority is altered by the server (owner).
    Banned status is changed when someone is banned (effectively logs off). [LogOut event]
    Registered changes when someone registers.
    IP changes when someone logs onto a name with a previously different IP. [LogIn event]
    Last Appearance changes when someone logs on. [LogIn event]
     
  15. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Then that means all you need is a registered function, and you can store all the other changes yourself, and don't even need anything else than the built-in functions.
     
  16. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    sys.dbRegistered(name) and sys.clearPass(name) next version, already in the git repository.

    Oh yeah, i forgot to mention, but i'm sure any thing you want to do on the whole file (like searching auth, ...) in javascript will take far more time than loading it from file (for big databases, and for small databases loading it from file would be really short, around 5 msecs or less). Anyway now you've all you ever need.
     
  17. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Can getFileContent be made to read all the same characters as you can display into the main chat? Atm, I can't get bullet points, em dashes or guillemets to show.
     
  18. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    Can you make it so we can define functions on the control panel?

    That is,

    playerAliasSearch(src,name)
    * you return the result, if the function does not exist it doesn't change it.

    And
    tempBan(src,name,time)

    Now, one more thing about this, I would like to be able to define the options on the dropdown menu as such, each option gives a src and a tar:

    options[1]['ban'] = 'function(src,tar) { scr.beforeChatMessage(src,\'/ban \' + sys.name(tar) + \'); }';
    options[1]['kick'] = 'function(src,tar) { scr.beforeChatMessage(src,\'/kick \' + sys.name(tar) + \'); }';
    options[1]['mute'] = 'function(src,tar) { scr.beforeChatMessage(src,\'/mute \' + sys.name(tar) + \'); }';
    options[2]['ban'] = 'function(src,tar) { scr.beforeChatMessage(src,\'/ban \' + sys.name(tar) + \'); }';
    options[2]['kick'] = 'function(src,tar) { scr.beforeChatMessage(src,\'/kick \' + sys.name(tar) + \'); }';
    options[2]['mute'] = 'function(src,tar) { scr.beforeChatMessage(src,\'/mute \' + sys.name(tar) + \'); }';
    options[2]['auth'] = 'function(src,tar) { scr.beforeChatMessage(src,\'/auth \' + sys.name(tar) + \'); }';

    etc etc etc
    I would also like it to be able to say, have scripts that run to decide when each shows.

    On an unrelated area, I would like to control the sending of PMs.

    SendPM(src,tar)
    SendBattleMsg(src,tar1,tar2,msg)

    For privacy, it would not contain the message on PMs. It would allow you to mute people spamming in PM. For battle msg, Tar 1 and 2 would be the players within the battle.

    Also, can you make sys.auth(0); return 3, and sys.name(0) return '~~Server~~'? (though sys.id('~~Server~~'); would not do anything) I want to use it for more control on server side commands. Maybe sys.setZeroAuth() and sys.setZeroName as well.
     
    Last edited: Jul 22, 2010
  19. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    sys.aliases(sys.dbIp(name)) would work?
    or sys.ip(src) == sys.dbIp(name) ?

    Tempbans aren't available yet

    Interesting, would be more like a plugin client side.

    No. PMs should be totally private, as well as battle messages that can be used as group discussion or just talk between two people

    You can overload some functions and create some. I don't know if you can change sys' functions, but i'm sure you can just make your auth() function that's not part of sys. And auth is unlimited in theory, so putting the auth of the server to 3 would be wrong, but anyway that's not the point.

    --- That said, i've done a lot of things for scripts and i'm doing other things now, and i don't feel a real need for any of the above, just adds to make it a tiny bit more comfortable.
     
  20. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    First one: I mean when you use control panel, you can change what info it shows.

    Also, I didn't say read them, but at least be able to block them via script. PM's should have the text private, but not who sends them to who.

    As I see it, seeing who PMs who, allows us to bock users from sending messages, and see who is mass spamming PMs to other users.

    Privacy is minimally invaded, you only get to know who sends a message to who, not what the message says. Mods can already join battles, even with spects clause; so why can't we run a script on it? I've had problems where users spam in battles, and muting them from battles would be better than banning them...
     
  21. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Mods can already join battles, even with spects clause; so why can't we run a script on it?

    -> Because people see when a mod comes, but they won't see the script listening to their talk. And seeing who talks to who could be used to see who a user you don't like talks to and take measures against these users, and PO's philosphy is to be free and open, and not oppressive. For example VBulletin doesn't allow any details on the PMs of a user even as an admin, and IRC doesn't let see you the PMs of other people, and that's perfectly normal. You can place some restrictions and controls in the main chat, but not on the forms of private talk as it invades the privacy of users.

    Anyway i'm not gonna change my point of view on this, i won't allow contents of battle messages and pms, or uses of PMs to see who talks to who.
     
  22. eric the espeon

    eric the espeon is an espeon.

    Joined:
    Apr 21, 2010
    Messages:
    854
    Likes Received:
    1
    Having some way to fully mute a player would be helpful (not a standard punishment, but an extra tool), would that be possible without allowing scripts to see who PMs who? I agree with coyotte about keeping PMs as private as possible.
     
  23. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    It would be possible.
     
  24. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    A suggestion:

    sys.typePoke(pokeid);

    returns:
    'water'
    'grass/groud'
    etc. etc.
     
  25. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    also, can you make it so we can stop before battle started? Challenge issued is annoying, because of the lag between when you challenge and when it starts.

    New ideas:

    sys.restart(); //Actually old idea -_-.
    sys.reset(); //Deletes all the server variables, stops battles, preforms starup event, reimports, and preforms log in event for each online user. In other words, restart while keeping online users.
    sys.variableDump() // Returns a string with all global and local variables. (ie, snapshot of scripts)
     
    Last edited: Jul 27, 2010
Thread Status:
Not open for further replies.