1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Guest, PO has ceased our separate tiering and adopted Smogon tiers for SM. More information and updates here.

    Dismiss Notice

[Server Scripting] Current Pokémon Online Server Scripts

Discussion in 'Server and Client Scripting' started by coyotte508, Apr 21, 2010.

  1. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    Last edited by a moderator: Feb 9, 2013
  2. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    Updated with the new ones, including the caps count and flood count scripts.
     
  3. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    Can you update this, I like to see these scripts.
     
  4. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    Updated.

    I removed all the sys.callLater functions, and for example use the since-then implemented sys.time() function for things like floodcount. I had problems with sys.time(), appears you need to call parseInt on it to make arithmethic operations (weird).

    There might be some useless code still remaining... anyway here they are.
     
  5. Tiger

    Tiger New Member

    Joined:
    Jun 6, 2010
    Messages:
    10
    Likes Received:
    0
    Sorry, I use Google translator.
    I would like to use the script on my server, and wanted to ask if I can use it?

    Can I change the script available?

    Is it possible the Tournament script and this script to combine?
     
  6. Steve

    Steve Active Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    491
    Likes Received:
    45
    Feel free to use and edit it.

    And yeah, you can combine them both. If you don't want to do it yourself, wait for coyotte to upload the new version, which has the tournament script in it.
     
  7. Tiger

    Tiger New Member

    Joined:
    Jun 6, 2010
    Messages:
    10
    Likes Received:
    0
    I'm too stupid to combine two scripts >.< Script Error line 882: SyntaxError: Parse error >>> afterBattleStarted: function(src, trgt){ <<< wtf
     
  8. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    You can use any names for the arguments - they just have to be listed in a particular order if that's what you were wondering. Make sure there's only one of each event and stick one lot of the same event code under the other if that event appears in both scripts.
     
  9. Akusu

    Akusu Guest

    Make sure that there's a comma (,) above that line.

    Each function is listed as such:

    ({

    function1Name: function(parameters){
    //This is a comment
    var x = 1; //<---This is code.
    }
    , //Seperate each function with a comma

    function2Name : function(parameters){}

    //Last one doesn't need a comma.
    })
     
  10. Pokemonexperte-Martin

    Pokemonexperte-Martin Member

    Joined:
    May 15, 2010
    Messages:
    76
    Likes Received:
    0
    "this" is not available inside local functions, so "this.saveStatsToFile();" this can't work. How to fix the Stats Saving:

    * Add global script property (see suggestion)
    * Alter scripts.js

    saveStats = function()
    {
    sys.callLater("saveStats()", 7200);
    script.saveStatsToFile();
    }
    sys.callLater("saveStats()", 7200);
     
  11. eric the espeon

    eric the espeon is an espeon.

    Joined:
    Apr 21, 2010
    Messages:
    853
    Likes Received:
    1
    Could mods be exempt from auto muting, or at least able to unmute ourselves? I got muted for caps when telling people that a tourney was doubles, then was unable to unmute and missed the signups for my own tourney :p (elements unmuted me)
     
  12. Tiger

    Tiger New Member

    Joined:
    Jun 6, 2010
    Messages:
    10
    Likes Received:
    0
    The Command /silence not working

    Nothing happens

    I use the script from the first review
     
  13. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    Yes sys.callLater() was removed temporarily. I'll update the script.
     
  14. Tiger

    Tiger New Member

    Joined:
    Jun 6, 2010
    Messages:
    10
    Likes Received:
    0
    thanks
     
  15. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    Updated with robust tourney script, and mega user code.
     
  16. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    The script on server is just a slightly different from this one (muted handled differently)

    Anyway I'd need someone to maintain and update the scripts, in my stead. There will be a lot of restrictions on what is doable and what not, because of performances or load (or number of registry values, ...) but there's still a lot of things to improve :)

    Keep in mind you have to have to accept doing things a certain way, maybe not like your usual way.
     
  17. Jules

    Jules i make you MANGRY

    Joined:
    Apr 23, 2010
    Messages:
    243
    Likes Received:
    1
    talk to me on msn, i'll do it depending on the restrictions.

    if you doubt my skillz ask some old netbattle folk.
     
  18. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    In any case, if you want to reach me it's best to go on irc.freenode.net on #po, i'm there far more than on msn.
     
  19. Steve

    Steve Active Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    491
    Likes Received:
    45
    Jules is more than up to the job.
     
  20. natty2

    natty2 Member

    Joined:
    May 11, 2010
    Messages:
    83
    Likes Received:
    0
    I wanted to use the script in my server, and then edit it.
    I pasted it in my server, and when I press "Ok" it sais:
    Script Error line 207: ReferenceError: Can't find variable: scriptChecks
    its the line:
    scriptChecks += 1;

    also, after a battle ends, it sais:

    Script Error line 1256: ReferenceError: Can't find variable: tourmode
    its the line:
    if (tourmode != 2 ||desc == "tie")

    I learned C#, so some stuff i am familier with, but can you help me out?
     
  21. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    you need to restart the server, actually.

    But nvm, i'll update the scripts.
     
  22. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    I deleted all the "flame war" messages, don't start this again. (and don't even make a post that could continue it)
     
  23. coolguy31337

    coolguy31337 Amor Fati

    Joined:
    Jun 23, 2010
    Messages:
    386
    Likes Received:
    0
    There is a bug with /clausecommands, although I don't know what's causing it. Here is the output when I type it, with the bug bolded.

    (18:07:17) *** You have pokemon clausing off ***
    (18:07:17) /on: to turn on your pokemon clausing
    (18:07:17) /off: to turn off your pokemon clausing
    (18:07:17) /no [pokemon]: to clause that pokemon
    (18:07:17) /allow [pokemon]: to allow that pokemon
    (18:07:17) /list: to list the pokemons you ban
    (18:07:17) /clear: to clear the list of your pokemon bans
    (18:07:17) *** You force sleep clause ***
    (18:07:17) /slpClause [on/off]: to force or not the use of sleep clause when challenging you
    (18:07:17) *** You don't enforce same tier ***
    (18:07:17) /sameTier [on/off]: to force or not the same tier when people challenge you
    (18:07:17) CommandBot: The command clausecommands doesn't exist
     
  24. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    oh, probably a "return;" missing. Fixing it.
     
  25. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    Updated with fixes.
     
  26. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    I lol'd, might wana fix this glitch:

     
  27. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    Nah, that thing has been on for ages and is fine imo. That also help mods dq another mod if they lost their connection. And admins still have power over mods (as shown by that log =) )
     
  28. Steve

    Steve Active Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    491
    Likes Received:
    45
    I like the way he quoted me banning Anju, as if he's trying to get me in the shit. It was a joke. I unbanned several seconds after I banned.
     
  29. Darkkis

    Darkkis The Superhero of Mafia

    Joined:
    Jun 23, 2010
    Messages:
    228
    Likes Received:
    0
    How to enable tierStats script, because it don't seem to work?
     
  30. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    Change those two lines:

    //this.saveStats(src,tier);
    //this.saveStats(dest,tier);


    by

    this.saveStats(src,tier);
    this.saveStats(dest,tier);


    and that line:

    //this.loadStatsFromFile();

    by

    this.loadStatsFromFile();
     
  31. 1PlayNude

    1PlayNude No Fun Is Allowed

    Joined:
    Jun 19, 2010
    Messages:
    386
    Likes Received:
    0
    I was wondering if somebody would be wiling to add items to the /pokestats command. Just an idea
     
  32. Searinox

    Searinox New Member

    Joined:
    Jul 19, 2010
    Messages:
    17
    Likes Received:
    0
    Is the legacy function still there or is it removed altogether and replaced with the new? Might explain why I am having issues in another topic since sys.callLater is used to kick.
     
  33. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    What do you mean? I removed sys.callLater in the scripts but in other scripts it should still work, i once had a weird problem and doubted sys.callLater.
     
  34. Novalis

    Novalis New Member

    Joined:
    Jul 5, 2010
    Messages:
    12
    Likes Received:
    0
    Hey i got an error....

    Script Error line 329: TypeError: Result of expression 'sys.memoryDump' [undefined] is not a function.

    Happened at the time of this post. Completely messed up the server :P.

    Thanks.
     
  35. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    Update to 0.9.77 .
     
  36. Novalis

    Novalis New Member

    Joined:
    Jul 5, 2010
    Messages:
    12
    Likes Received:
    0
    Gotcha. Thanks a ton.
     
  37. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    This is a fix so you can't make yourself immune to mutes like I did on beta.

    This was a funny glitch, I was getting muted 15+ times and then unmuting myself without being a mod.

    Serverstart:

    delete muteip;
    var mutename = sys.getVal('mute1').split(':');
    muteip = [];
    var mutetime = sys.getVal('mute2').split(':');
    for (x in mutename)
    muteip[mutename[x]] = mutetime[x]; }

    Message:

    if (typeof muteip[sys.ip(src)] != 'undefined') {
    if (muteip[sys.ip(src)] >= sys.time() || muteip[sys.ip(src)] == 1) {
    sys.stopEvent();
    sys.sendMessage(src,"StarBot: You are muted."); } }

    Shut down

    var mute1str = '';
    var mute2str = '';
    var xxa = 0;
    for (xap in muteip) {
    if (xxa != 0) {
    mute1str = mute1str + ':';
    mute2str = mute2str + ':'; }
    mute1str = mute1str + xap;
    mute2str = mute2str + muteip[xap];
    }
    sys.saveVal('mute1',mute1str);
    sys.saveVal('mute2',mute2str);


    Untested but it should work.

    Edit:

    To mute:

    muteip[sys.ip(src)] = sys.time()*1 + (timeargument);
    or
    muteip[sys.ip(src)] = 1;

    Second mutes forever.
     
    Last edited: Oct 16, 2010
  38. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    167
    Unfortunately i already fixed it before I saw this post.
     
  39. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    Your fix didn't work...

    If im unmuted, im auto remuted at log in.
    If someone is muted, who was not muted at the time you updated, they are unmuted at log in.

    If you want, you can use the code I provided instead.

    Old version was better, you only had the glitch if someone intentionally tried to unmute themselves, this new glitch happens anytime you [un]mute someone.

    To replicate:
    On nonmuted account:
    mute "account"
    log off "account"
    log in with "account"
    type with "account"

    Ask coolguy and DN for info.
     
    Last edited: Oct 16, 2010
  40. redsaber5859

    redsaber5859 New Member

    Joined:
    Aug 3, 2010
    Messages:
    2
    Likes Received:
    0
    so can i use them in the PokeCommunity server?