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. Vogon

    Vogon New Member

    Joined:
    Sep 19, 2010
    Messages:
    15
    Likes Received:
    0
    Which line would you edit, so in the Mafia Channel Users can /start games, but not be allowed to /end them?
     
  2. supertrunks8

    supertrunks8 Pwnage

    Joined:
    Jun 20, 2011
    Messages:
    350
    Likes Received:
    0
    Well already users can /Start : to start the game.

    And where this is at:



    Code (text):
    1.  
    2. };
    3.     /* callback for /end */
    4.     this.endGame = function(src) {
    5.         if (mafia.state == "blank") {
    6.             sys.sendMessage(src, "±Game: No game is going on.",mafiachan);
    7.             return;
    8.         }
    9.         sys.sendAll("*** ************************************************************************************", mafiachan);
    10.        
    11.         sys.sendAll("±Game: " + (src ? sys.name(src) : Config.Mafia.bot) + " has stopped the game!", mafiachan);
    12.         sys.sendAll("*** ************************************************************************************", mafiachan);
    13.         sys.sendAll("", mafiachan);
    14.  
    [/HIDE]

    I think you would do something like:

    Code (text):
    1.  
    2. if (sys.auth(src) < 1) {
    3. sys.sendMessage(src, "±NormalBot: The command " + command + " doesn't exist",mafiachan);
    4. return;
    5. }
    6.  
    And add it after:
    sys.sendMessage(src, "±Game: No game is going on.",mafiachan);
    return;

    i thinkzz.
     
    Last edited: Sep 27, 2011
  3. TheUnknownOne

    TheUnknownOne Member

    Joined:
    Mar 28, 2011
    Messages:
    988
    Likes Received:
    3
    Change
    this.commands = {
    user: {
    commands : [this.showCommands, "To see the various commands."],
    start: [this.startGame, "Starts a Game of Mafia."],
    help: [this.showHelp, "For info on how to win in a game."],
    roles: [this.showRoles, "For info on all the Roles in the game."],
    rules: [this.showRules, "To see the Rules for the Game/Server."],
    themes: [this.showThemes, "To view installed themes."],
    themeinfo: [this.showThemeInfo, "To view installed themes (more details)."],
    playedgames: [this.showPlayedGames, "To view recently played games"]
    },
    auth: {
    push: [this.pushUser, "To push users to a Mafia game."],
    slay: [this.slayUser, "To slay users in a Mafia game."],
    end: [this.endGame, "To cancel a Mafia game!"],
    add: [this.addTheme, "To add a Mafia Theme!"],
    update: [this.updateTheme, "To update a Mafia Theme!"],
    remove: [this.removeTheme, "To remove a Mafia Theme!"],
    disable: [this.disableTheme, "To disable a Mafia Theme!"],
    enable: [this.enableTheme, "To enable a disabled Mafia Theme!"],
    importold: [this.importOld, ""]
    }
    };
    To
    this.commands = {
    user: {
    commands : [this.showCommands, "To see the various commands."],
    start: [this.startGame, "Starts a Game of Mafia."],
    end: [this.endGame, "To cancel a Mafia game!"],
    help: [this.showHelp, "For info on how to win in a game."],
    roles: [this.showRoles, "For info on all the Roles in the game."],
    rules: [this.showRules, "To see the Rules for the Game/Server."],
    themes: [this.showThemes, "To view installed themes."],
    themeinfo: [this.showThemeInfo, "To view installed themes (more details)."],
    playedgames: [this.showPlayedGames, "To view recently played games"]
    },
    auth: {
    push: [this.pushUser, "To push users to a Mafia game."],
    slay: [this.slayUser, "To slay users in a Mafia game."],
    add: [this.addTheme, "To add a Mafia Theme!"],
    update: [this.updateTheme, "To update a Mafia Theme!"],
    remove: [this.removeTheme, "To remove a Mafia Theme!"],
    disable: [this.disableTheme, "To disable a Mafia Theme!"],
    enable: [this.enableTheme, "To enable a disabled Mafia Theme!"],
    importold: [this.importOld, ""]
    }
    };
     
  4. supertrunks8

    supertrunks8 Pwnage

    Joined:
    Jun 20, 2011
    Messages:
    350
    Likes Received:
    0
    Oh. @TheUnknownOne, is my way wrong then?.
     
    Last edited: Sep 27, 2011
  5. Vogon

    Vogon New Member

    Joined:
    Sep 19, 2010
    Messages:
    15
    Likes Received:
    0
    I changed that and users still get this message: "(22:47:57) ±Game: Can't repeat normal game!"
     
  6. TheUnknownOne

    TheUnknownOne Member

    Joined:
    Mar 28, 2011
    Messages:
    988
    Likes Received:
    3
    Change norepeat in to config to 0
    Mafia: {
    bot: "Murkrow",
    norepeat: 0,
    stats_file: "mafia_stats.json"
    },
     
  7. Vogon

    Vogon New Member

    Joined:
    Sep 19, 2010
    Messages:
    15
    Likes Received:
    0
    They are still getting the "(22:47:57) ±Game: Can't repeat normal game!"

    EDIT: It seems users just can't repeat the normal games, where would I change it so that the same themes/games can repeat?
     
    Last edited: Sep 27, 2011
  8. DirtyScalpel

    DirtyScalpel New Member

    Joined:
    Sep 3, 2011
    Messages:
    6
    Likes Received:
    0
    Getting this
    Script Error line 6138: TypeError: Result of expression 'SESSION.users(src).expired' [undefined] is not a function.
    And none of the /commands work
     
  9. Crystal Moogle

    Crystal Moogle Ayaya~ Administrator Administrator

    Joined:
    Jul 19, 2010
    Messages:
    3,205
    Likes Received:
    531
    PO Trainer Name:
    Hanako
    Try restarting the server and seeing if that helps
     
  10. DirtyScalpel

    DirtyScalpel New Member

    Joined:
    Sep 3, 2011
    Messages:
    6
    Likes Received:
    0
    Alright that worked, thanks.
    Also is there any way the server can be up if my labtop is off?
     
  11. supertrunks8

    supertrunks8 Pwnage

    Joined:
    Jun 20, 2011
    Messages:
    350
    Likes Received:
    0
    No. If someone else is hosting it. From a different laptop. There is not current way to host when your laptop if off.

    Lol and why are we talking about this in Scripting Thread? :P
     
    Last edited: Sep 28, 2011
  12. [ƦЄ]Blade

    [ƦЄ]Blade Not sure.

    Joined:
    Mar 6, 2011
    Messages:
    75
    Likes Received:
    0
    Fatal Script Error line 5130: SyntaxError: Parse error
    I got this when I tried to load the script
    This is the code that was on line 5130
    Code (text):
    1. normalbot.sendChanMessage(src, "Please use this command to warn / automute someone. Use /wfb name");
    I examined it and did not see an error
     
  13. supertrunks8

    supertrunks8 Pwnage

    Joined:
    Jun 20, 2011
    Messages:
    350
    Likes Received:
    0
    Mhmm ._. Maybe it has something to do with normalbot. and i'm not sure if you use sendChanMessage but don't you need ",chan); at the end?
     
  14. [ƦЄ]Blade

    [ƦЄ]Blade Not sure.

    Joined:
    Mar 6, 2011
    Messages:
    75
    Likes Received:
    0
    ._. I'm afraid that I cannot answer that (didn't make dese scripts)
     
  15. supertrunks8

    supertrunks8 Pwnage

    Joined:
    Jun 20, 2011
    Messages:
    350
    Likes Received:
    0
    Oh well maybe it has to do with normalbot. And I'm not sure if PO Scripts uses sys.
     
  16. [ƦЄ]Blade

    [ƦЄ]Blade Not sure.

    Joined:
    Mar 6, 2011
    Messages:
    75
    Likes Received:
    0
    Well, I am using the same exact script that the link brought me to.
    Please note: I am not using these scripts for my main server, I am using them for a friend.
     
  17. supertrunks8

    supertrunks8 Pwnage

    Joined:
    Jun 20, 2011
    Messages:
    350
    Likes Received:
    0
    Oh. Is your server updated and client? Or whoever is hosting the server?

    xxx: http://pokemon-online.eu/scripts.js <~ works perfectly for me.


    Edit: 225 Posts :) Yayaa for me...
     
    Last edited: Sep 28, 2011
  18. [ƦЄ]Blade

    [ƦЄ]Blade Not sure.

    Joined:
    Mar 6, 2011
    Messages:
    75
    Likes Received:
    0
    I am hosting under the latest version on both client & server.
     
  19. supertrunks8

    supertrunks8 Pwnage

    Joined:
    Jun 20, 2011
    Messages:
    350
    Likes Received:
    0
    Oh Mhmmm..... Try restarting your Server?
     
  20. [ƦЄ]Blade

    [ƦЄ]Blade Not sure.

    Joined:
    Mar 6, 2011
    Messages:
    75
    Likes Received:
    0
    I decided to use Lutra's scripts.
    -- Conversation is over --
     
  21. supertrunks

    supertrunks Banned

    Joined:
    Sep 29, 2011
    Messages:
    12
    Likes Received:
    0
    Ok, good thing that was over. :P
     
  22. liamc1997

    liamc1997 Member

    Joined:
    Sep 1, 2011
    Messages:
    35
    Likes Received:
    0
    I dunno why but when i'm try to logging in to my server from the servers list(and i can see the server on the list),i'm in the room and it's not log me in,it's just say this message "Error while connected to server -- Received error n°0: Connection refused"
     
  23. Kalashnikov

    Kalashnikov Despite the code quality

    Joined:
    Apr 4, 2011
    Messages:
    434
    Likes Received:
    0
    Use Advanced Connection with ip 127.0.0.1 to connect to your own server if you're running it on the same machine.
     
  24. [ƦЄ]Blade

    [ƦЄ]Blade Not sure.

    Joined:
    Mar 6, 2011
    Messages:
    75
    Likes Received:
    0
    Do what Kalashnikov said and if you're having trouble connecting to your server, you may have to portforward. Also, this is not the right spot to post this.
     
  25. Viderizer

    Viderizer Admin/Developer

    Joined:
    Mar 12, 2011
    Messages:
    277
    Likes Received:
    0
    You need sys. on functions that are programmed to the server. You don't need sys. in functions that are made in the scripts.
     
  26. TheUnknownOne

    TheUnknownOne Member

    Joined:
    Mar 28, 2011
    Messages:
    988
    Likes Received:
    3
    >Constructors

    Some people do
    sys.something = function() {
    }
     
  27. Mystra

    Mystra Active Member

    Joined:
    Jul 12, 2010
    Messages:
    1,389
    Likes Received:
    4
    Pray I never introduce that 'something' into po then :}
     
  28. Valstin

    Valstin iPLayCOD

    Joined:
    Aug 11, 2011
    Messages:
    126
    Likes Received:
    0
    is there away to allow tournaments on the main chat? cuz most of the servers only have 10-40 people
     
  29. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    Find something like:
    tourchannel = SESSION.global().channelManager.createPermChannel...

    and change it into

    tourchannel = 0;
     
  30. SupaSayiaJin

    SupaSayiaJin Member

    Joined:
    Jul 15, 2011
    Messages:
    71
    Likes Received:
    0
    I am geting this error with these scripts.

    Script Warning in sys.appendToFile(filename, content): error when opening mafiathemes/metadata.json: The system cannot find the path specified.
    Script Check: OK
    Channel Evolution Game was created
    Script Error line 3877: TypeError: Result of expression 'SESSION.global()' [undefined] is not an object.
    Script Error line 3877: TypeError: Result of expression 'SESSION.global()' [undefined] is not an object.
    Could not read channelData.
    Error: SyntaxError: Unable to parse JSON string
    Any idea how to correct it?
     
  31. eric the espeon

    eric the espeon is an espeon.

    Joined:
    Apr 21, 2010
    Messages:
    854
    Likes Received:
    1
    Minor bug: /whois and /userinfo display in a different format, despite claiming to be the same command. /whois looks much nicer imo.

    Turns out they are meant to be different. I fixed the description of them which said this instead :) (and made some other changes to wording).
     
    Last edited: Dec 8, 2011
  32. Pokemonexpert.

    Pokemonexpert. Banned

    Joined:
    Nov 14, 2011
    Messages:
    10
    Likes Received:
    0
    Do the Commands work? I tested and you have to restart the server. And the Start up log should look something like this:
    Script Warning in sys.appendToFile(filename, content): error when opening mafiathemes/metadata.json: The system cannot find the path specified.
    Script Check: OK
    [##main] Script Check: Unknown poke in dwpokemons: 'Mr. Mime'.
    [##main] Script Check: Unknown poke in dwpokemons: 'Mime Jr.'.
    Script Warning in sys.getFileContent(filename): error when opening mafiaadmins.txt: No such file or directory
    Script Warning in sys.getFileContent(filename): error when opening nameBans.json: No such file or directory
    Script Warning in sys.getFileContent(filename): error when opening tourstats.json: No such file or directory
    Could not read tourstats, initing to null stats.
    Error: SyntaxError: Unable to parse JSON string
    Channel Mafia Channel was created
    Channel Indigo Plateau was created
    Channel Tournaments was created
    Channel League was created
    Channel Mute City was created
    Channel Evolution Game was created
    Script Warning in sys.getFileContent(filename): error when opening pastebin_api_key: No such file or directory
    [#Indigo Plateau] ±Dratini: Couldn't load api keys: TypeError: Result of expression 'sys.getFileContent("pastebin_api_key")' [undefined] is not an object.
    Script Warning in sys.getFileContent(filename): error when opening mafiathemes/metadata.json: The system cannot find the path specified.
    [/HIDE]

    ---
    Off topic. ete, the command lists look good but there is a break line after the /Join and before /Ranking:
    (15:09:08) *** Commands ***
    (15:09:08) /rules: Shows the rules
    (15:09:08) /join: Enters you to in a tournament.

    (15:09:08) /ranking: Shows your ranking in your current tier.
    (15:09:08) /myalts: Lists your alts.[/HIDE]
    I was Moderator on my Server when I used the /Commands, if that is needed.
     
    Last edited: Dec 8, 2011
  33. TheUnknownOne

    TheUnknownOne Member

    Joined:
    Mar 28, 2011
    Messages:
    988
    Likes Received:
    3
    He put an extra comma (on accident)
    "/join: Enters you to in a tournament.",,

    Simply remove the bolded comma.
     
  34. ShadowRaider

    ShadowRaider New Member

    Joined:
    Jan 6, 2012
    Messages:
    1
    Likes Received:
    0
  35. Dezhovator

    Dezhovator Member

    Joined:
    Jul 21, 2012
    Messages:
    33
    Likes Received:
    0
    Fatal Script Error line 4193: SyntaxError: Parse error
     
  36. Crystal Moogle

    Crystal Moogle Ayaya~ Administrator Administrator

    Joined:
    Jul 19, 2010
    Messages:
    3,205
    Likes Received:
    531
    PO Trainer Name:
    Hanako
    You managed to grab the script during the 2 minute period where I made a mistake :3

    It shouldn't be there now
     
  37. Fegelein

    Fegelein The Mechanic

    Joined:
    Feb 6, 2012
    Messages:
    1,068
    Likes Received:
    53
    PO Trainer Name:
    Fegelein
    I know this is a stupid question, but where do I put the scripts if I want to host my server?
     
  38. Ethan

    Ethan Member

    Joined:
    Nov 6, 2011
    Messages:
    238
    Likes Received:
    0
    When you open the server, go to Options -> Scripts and paste them in there.
     
  39. DatXFire

    DatXFire Never gonna use an avatar

    Joined:
    Sep 4, 2012
    Messages:
    89
    Likes Received:
    9
    Well when trying to set up a server almost exactly like PO's. (Not imitating, just doing it for testing Mafia stuff.) I get this huge wall of text, some of it being errors.

    [secret]
    Code (text):
    1. Script Warning in sys.appendToFile(filename, content): error when opening mafiathemes/metadata.json: The system cannot find the path specified.
    2. Script Check: OK
    3. Script Warning in sys.getFileContent(filename): error when opening mafiavillified.json: No such file or directory
    4. Error loading module amoebagame.js: SyntaxError: Parse error
    5. Script Warning in sys.getFileContent(filename): error when opening tourstats.json: No such file or directory
    6. Could not read tourstats, initing to null stats.
    7. Error: SyntaxError: Unable to parse JSON string
    8. Script Warning in sys.getFileContent(filename): error when opening trivData.json: No such file or directory
    9. Creating new tournament object
    10. Script Warning in sys.getFileContent(filename): error when opening channeldata/1346719344331271905570756644.json: No such file or directory
    11. [#Datfailfire] Plugins-error on tours.js: ReferenceError: Can't find variable: tourconfig
    12. Channel Mafia Channel was created
    13. Channel Indigo Plateau was created
    14. Channel Victory Road was created
    15. Channel Tournaments was created
    16. Channel Watch was created
    17. Channel Trivia was created
    18. Channel TrivReview was created
    19. Channel Mafia Review was created
    20. Script Warning in sys.getFileContent(filename): error when opening nameBans.json: No such file or directory
    21. Script Warning in sys.getFileContent(filename): error when opening nameWarns.json: No such file or directory
    22. Script Warning in sys.getFileContent(filename): error when opening pastebin_api_key: No such file or directory
    23. [#Indigo Plateau] ±Dratini: Couldn't load api keys: TypeError: Result of expression 'sys.getFileContent("pastebin_api_key")' [undefined] is not an object.
    24. Script Warning in sys.getFileContent(filename): error when opening mafiathemes/metadata.json: The system cannot find the path specified.
    25. [#Mafia Channel] ±Murkrow: Mafia was reloaded, please start a new game!
    26. Script Warning in sys.getFileContent(filename): error when opening tourstats.json: No such file or directory
    27. Could not read tourstats, initing to null stats.
    28. Error: SyntaxError: Unable to parse JSON string
    29. No tour config data detected for 'maxqueue', getting default value
    30. No tour config data detected for 'maxrunning', getting default value
    31. No tour config data detected for 'toursignup', getting default value
    32. No tour config data detected for 'tourdq', getting default value
    33. No tour config data detected for 'subtime', getting default value
    34. No tour config data detected for 'touractivity', getting default value
    35. No tour config data detected for 'breaktime', getting default value
    36. No tour config data detected for 'absbreaktime', getting default value
    37. No tour config data detected for 'remindertime', getting default value
    38. No tour config data detected for 'tourbotcolour', getting default value
    39. No tour config data detected for 'minpercent', getting default value
    40. No tour config data detected for 'tourbot', getting default value
    41. [#Tournaments] Win messages added
    42. [#Tournaments] Version 1.550 of the tournaments system was loaded successfully in this channel!
    43. Connecting to registry...
    44. Connected to registry! Sending server info...
    45. The registry acknowledged the server.
    [/secret]

    What I get from this is that I need metadata.json, mafiavillified.json, tourstats.json, trivData.json, 1346719344331271905570756644.json, nameBans.json, nameWarns.json, and pastebin_api_key. Any way to fix this?
     
  40. TheUnknownOne

    TheUnknownOne Member

    Joined:
    Mar 28, 2011
    Messages:
    988
    Likes Received:
    3
    Most of them are warnings, not errors.

    Anyway, create the folders channeldata and mafiathemes. You can ignore the rest.