I have now created a working server and I downloaded the script off the front stickied thread. Now I am wondering, which procedures can I backspace to get rid of the extra channels? Also, I'm very new so I apologize if the next question sounds noobish, but is there a way to delete the channels and still have a tournament gameplay mode? If so, how do the tournaments "start"? If I have to keep the Tournaments channel in order for this to work that's fine but I'd prefer if it were the main channel (I don't mind editing a bit of script). Edit: I created a new tier also, this will probably change the points system, right? I have to redirect the script to realize one of the types is tournament play.. Anyways any help would be appreciated. Edit2: Is there any way to force a tier for a person to person challenge? I know you can search battle, but for people that come to a server that says "No Legendaries" - if they don't sort by tier, they can easily be challenged by someone with Legendary pokemon, defeating the purpose. Edit3: And now I've noticed the "/me" command doesn't work.. and I gave Admin to another friend and he tried some mute functions and they don't seem to work either. Edit 4: I would also like something to come up like "Don't forget to 'Find Battle'!" every 15 minutes or so.. how can I do that?
Of course you can, but you will cost a couple of features: Staff Channel Tournaments Channel (Main chat will get flooded much) Mute City League Channel (Kinda worthless) Mafia Game Of course, most of these you shouldn't remove(Mute City, Indigo, Mafia), but others are sorta worthless.
Alright you're right I would like to keep them now because they're useful to just have there for everyone - but is there a way to get tournaments to start in the main Channel? Again I'm new I apologize if they are able to be started in the main channel, not enough people have joined the server yet to test.
How can I set tournaments to use a custom tier? :\ What about being able to challenge someone with forced same tier also (other than find battle)? I would probably need a plugin or a script for that eh? (As in right button click challenge forced tier)
Friendly matches do not force any tier. How could you force the other player into the same tier if they have incompactible team? I didn't quite get your idea.
You don't force a match, you force the challenge and it could bring up an error saying "this player is not using a suitable team for the tier; ________________" if the players team returns with restricted Pokémon, and if it returns with ones that are compatible it places the challenged players in the tier if he accepts.. i don't know I guess I had high hopes. :P it's just easier to challenge by right clicking than going "find battle" and waiting sometimes.. especially since this server is just starting and has no traffic. I took your advice into consideration already and the main channel is a tournament channel. I'm not a genius when it comes to programming though, I don't know all the proper syntax because it's not my area of expertise - you can see how far the server has come along in 6 hours though: 24.138.110.66:5080 and sadly I have been at it for some time.. I just don't know syntax well enough to read the programming like a language. I have had many script errors, and I actually did manage to remove all the channels and at one point it only had my custom tiers available, but I failed to realize that without "Find Battle" there was no way to use custom tiers except sit in the tier and wait for someone else to also "find battle" (which, for some reason wasn't even working at one point). Or agree upon entering the tier and just accepting challenges - which only works with people that are outspoken. Anyways I'm seriously not good at programming and that's why I'm asking for help and tips.
On PO Scripts, you should be able to use /sameTier on, which blocks challenges from poeple of other tiers. If you want it so you can't send a challenge to someone of a different tier, regardless of the circumstances, find: Code (text): if (SESSION.users(dest).sametier == true && (sys.tier(dest) != sys.tier(src))) { sys.sendMessage(src, "+BattleBot: That person only wants to fight his/her own tier."); sys.stopEvent(); return; } replace with: Code (text): if (sys.tier(dest) != sys.tier(src)) { sys.sendMessage(src, "+BattleBot: You must be in the same tier to challenge this person."); sys.stopEvent(); return; }
Thanks - I'm actually using this, it will cause less confusion. (Alright I have a new problem, is there any way to get challenge cup to only select pokemon from ones that aren't banned - and for that matter, ones that aren't restricted?) - Suggested to "Simulator Suggestions" Edit2: I have yet another problem.. I'm getting this error about API keys and unable to load channelData: Spoiler Script Check: OK Could not read channelData. Error: SyntaxError: Unable to parse JSON string 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 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. Connecting to registry... Connected to registry! Sending server info... The registry acknowledged the server.[/HIDE] and also when I try to connect I just get: Error while connected to server -- Received error n°0: Connection refused Even if I take the script out I get this "error n°0" message when trying to connect to my server, and I don't believe it's a firewall problem because I've allowed access to port 5080 on my firewall already. Please help it was working fine just yesterday.
You can fix the API key by loging on to: http://pastebin.com, and creating a profile. Once this is done, go to the 'API' link in the top right corner. Next, find the 'Your Unique Developer API Key' section. Underneath it there should be a long code of random numbers and letters. Thats your 'pastebin_api_key'. Replace 'pastebin_api_key' with that code and it should function fine. The 'pastebin_user_key' is what connects the posts to your file. If you don't want the posts connected to your file, just replace it with ''. For the amoeba game: Code (text): amoebaGame.init(); try { pastebin_api_key = sys.getFileContent("pastebin_api_key").replace("\n", ""); pastebin_user_key = sys.getFileContent("pastebin_user_key").replace("\n", ""); } catch(e) { normalbot.sendAll("Couldn't load api keys: " + e, staffchannel); } pastebin_api_key is the long code mentioned above, pastebin_user_key is optional, see above And for the importable command: Code (text): if (command == "importable") { //var path = "user_importables/{id}.txt".replace("{id}", src); //var url = "http://188.165.249.120/i/{id}.txt".replace("{id}", src); //bot.sendChanMessage(src, "Your team is available at " + url); //sys.writeToFile(path, this.importable(src, true).join("\n")); var name = sys.name(src) + '\'s '+sys.tier(src)+' team'; var team = this.importable(src, true).join("\n"); var post = {}; post['api_option'] = 'paste'; // paste, duh post['api_dev_key'] = pastebin_api_key; // Developer's personal key, set in the beginning //post['api_user_key'] = pastebin_user_key; // Pastes are marked to our account post['api_paste_private'] = 1; // private post['api_paste_name'] = name; // name post['api_paste_code'] = team; // text itself post['api_paste_expire_date'] = '1M'; // expires in 1 month sys.webCall('http://pastebin.com/api/api_post.php', function(resp) { if (/^http:\/\//.test(resp)) normalbot.sendChanMessage(src, "Your team is available at: " + resp); // success else { normalbot.sendChanMessage(src, "Sorry, unexpected error: "+resp); // an error occured normalbot.sendAll("" + sys.name(src) + "'s /importable failed: "+resp, staffchannel); // message to indigo } }, post); return; } pastebin_api_key is the long code mentioned above, pastebin_user_key is optional, see above I'm not the best scripter, but after I replaced pastebin_api_key and pastebin_user_key, it functioned fine. If you get any errors, let me know.
yeah you only need these API keys if you want to have /importable working. If you don't want it you can just remove it from the scripts.
There's 2 places it says pastebin_api_key and pastebin_user_key - which ones do I change to the number/letter combination and ''? I've tried a couple combos, if I just enter it as *my code* = sys.getFileContent("pastebin_api_key").replace("\n", ""); I get a script error and if I enter it as pastebin_api_key = sys.getFileContent("*my code*").replace("\n", ""); it gives me "Script Warning in sys.getFileContent(filename): error when opening *my code*: No such file or directory" "[#Indigo Plateau] ?Dratini: Couldn't load api keys: TypeError: Result of expression 'sys.getFileContent("*my code*")' [undefined] is not an object." What about it not being able to read channelData? and the fact that I used to be able to connect but now it's giving me the error error n°0
Its not that hard. Anywhere you see 'pastebin_api_key', you replace it with your code. Anywhere you see 'pastebin_user_key', you replace it with either nothing if you don't want the pastes linked to you account, or you user key if you do. Example for the amoeba game: Code (text): amoebaGame.init(); try { pastebin_api_key = sys.getFileContent("#9a879g87a9sdf79a897aj").replace("\n", ""); pastebin_user_key = sys.getFileContent(" ").replace("\n", ""); } catch(e) { normalbot.sendAll("Couldn't load api keys: " + e, staffchannel); } And for the importable command: Code (text): if (command == "importable") { //var path = "user_importables/{id}.txt".replace("{id}", src); //var url = "http://188.165.249.120/i/{id}.txt".replace("{id}", src); //bot.sendChanMessage(src, "Your team is available at " + url); //sys.writeToFile(path, this.importable(src, true).join("\n")); var name = sys.name(src) + '\'s '+sys.tier(src)+' team'; var team = this.importable(src, true).join("\n"); var post = {}; post['api_option'] = 'paste'; // paste, duh post['api_dev_key'] = '#akjsdfpoiue021094kljf'; // Developer's personal key, set in the beginning //post['api_user_key'] = ' '; // Pastes are marked to our account post['api_paste_private'] = 1; // private post['api_paste_name'] = name; // name post['api_paste_code'] = team; // text itself post['api_paste_expire_date'] = '1M'; // expires in 1 month sys.webCall('http://pastebin.com/api/api_post.php', function(resp) { if (/^http:\/\//.test(resp)) normalbot.sendChanMessage(src, "Your team is available at: " + resp); // success else { normalbot.sendChanMessage(src, "Sorry, unexpected error: "+resp); // an error occured normalbot.sendAll("" + sys.name(src) + "'s /importable failed: "+resp, staffchannel); // message to indigo } }, post); return; }
(From logs.txt) Spoiler "Script Check: OK" "Could not read channelData." "Error: SyntaxError: Unable to parse JSON string" "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 League was created" "Channel Mute City was created" "Channel Evolution Game was created" "Script Warning in sys.getFileContent(filename): error when opening #7838af2414fc1243dcf2d6d315a4a861: No such file or directory" "[#Indigo Plateau] ±Dratini: Couldn't load api keys: TypeError: Result of expression 'sys.getFileContent("#7838af2414fc1243dcf2d6d315a4a861")' [undefined] is not an object." "Connecting to registry..." "Connected to registry! Sending server info..." "The registry acknowledged the server." [/HIDE] It's simple to people knowledgeable in scripting.. I haven't had to program for 8 years. Sorry for questioning every step I would just like to get this done right. Still a bigger concern than the api keys is the "Could not read channelData" error. Also, just because I would like to have some understanding, what is the user api then? Is this for users that come to the server to have importable? If so, would I have to make a new pastebins.com account? I'm still getting: Error while connected to server -- Received error n°0: Connection refused when I try to connect, even though it was working fine like 3 days ago.
"Script Warning in sys.getFileContent(filename): error when opening #7838af2414fc1243dcf2d6d315a4a861: No such file or directory" you need to give the filename containin the api key to it. once you set topics and stuff it will create the channeldata.json and no longer give the error. apikey is for pastebin, you do need it for importable to work. does it show on the registry? are you running it on your computer? did you use "localhost" in case you are running server and client on the same machine?
I'm not using SQL nor do I see why localhost matters really because it had been working running the server on the same computer I'm connecting with.. the new output is worse than ever :P Spoiler Script Check: OK Script Warning in sys.getFileContent(filename): error when opening channelData.json: No such file or directory Could not read channelData. Error: SyntaxError: Unable to parse JSON string 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 League was created Channel Mute City was created Channel Evolution Game was created Script Warning in sys.getFileContent(filename): error when opening C:UsersChrisDesktoppokemon-serverapi_key: No such file or directory [#Indigo Plateau] ±Dratini: Couldn't load api keys: TypeError: Result of expression 'sys.getFileContent("C:\Users\Chris\Desktop\pokemon-server\api_key")' [undefined] is not an object. Connecting to registry... Connected to registry! Sending server info... The registry acknowledged the server.[/HIDE] Also do I need a number sign in front of the code? I have to ask because I would like the response to be as specific as possible at this point.
Use \\ in the filename string to get on \. But does localhost work in advanced connection, as it should.
Well no it doesn't connect me it gives me the error n°0 - but the server does register, I can see it on the list of available servers. So I deleted the other files I had in the folder that I created just to get the errors to initially go away, so as it stands this it the readout I'm getting: Spoiler "Script Warning in sys.getFileContent(filename): error when opening mafia_stats.json: No such file or directory" "Script Check: OK" "Script Warning in sys.getFileContent(filename): error when opening channelData.json: No such file or directory" "Could not read channelData." "Error: SyntaxError: Unable to parse JSON string" "Script Warning in sys.getFileContent(filename): error when opening wfbset.json: No such file or directory" "Script Warning in sys.getFileContent(filename): error when opening mutes.txt: No such file or directory" "Script Warning in sys.getFileContent(filename): error when opening mbans.txt: No such file or directory" "Script Warning in sys.getFileContent(filename): error when opening smutes.txt: No such file or directory" "Script Warning in sys.getFileContent(filename): error when opening rangebans.txt: No such file or directory" "Script Warning in sys.getFileContent(filename): error when opening contributors.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 League was created" "Channel Mute City was created" "Channel Evolution Game was created" "Script Warning in sys.getFileContent(filename): error when opening : No such file or directory" "[#Indigo Plateau] ±Dratini: Couldn't load api keys: TypeError: Result of expression 'sys.getFileContent(" ")' [undefined] is not an object." "Connecting to registry..." "Connected to registry! Sending server info..." "The registry acknowledged the server." Warning: QWaitCondition: Destroyed while threads are still waiting [/HIDE] It's still very similar.. I'm still not entirely sure if I should be using " or ' for the filename call and if the file should be .txt or no extension. The code I'm using: Code (text): amoebaGame.init(); try { pastebin_api_key = sys.getFileContent('C:\\Users\\Chris\\Desktop\\pokemon-server\\api_key.txt').replace("\n", ""); pastebin_user_key = sys.getFileContent(" ").replace("\n", ""); } catch(e) { normalbot.sendAll("Couldn't load api keys: " + e, staffchannel); } Code (text): if (command == "importable") { //var path = "user_importables/{id}.txt".replace("{id}", src); //var url = "http://188.165.249.120/i/{id}.txt".replace("{id}", src); //bot.sendChanMessage(src, "Your team is available at " + url); //sys.writeToFile(path, this.importable(src, true).join("\n")); var name = sys.name(src) + '\'s '+sys.tier(src)+' team'; var team = this.importable(src, true).join("\n"); var post = {}; post['api_option'] = 'paste'; // paste, duh post['api_dev_key'] = "C:\\Users\\Chris\\Desktop\\pokemon-server\\api_key.txt"; // Developer's personal key, set in the beginning //post['api_user_key'] = ' '; // Pastes are marked to our account post['api_paste_private'] = 1; // private post['api_paste_name'] = name; // name post['api_paste_code'] = team; // text itself post['api_paste_expire_date'] = '1M'; // expires in 1 month sys.webCall('http://pastebin.com/api/api_post.php', function(resp) { if (/^http:\/\//.test(resp)) normalbot.sendChanMessage(src, "Your team is available at: " + resp); // success else { normalbot.sendChanMessage(src, "Sorry, unexpected error: "+resp); // an error occured normalbot.sendAll("" + sys.name(src) + "'s /importable failed: "+resp, staffchannel); // message to indigo } }, post); return; }
Warning: QWaitCondition: Destroyed while threads are still waiting this seems very strange to me. I have no idea what is going on there. And you can just put your pastebin API key between the ""-marks, they are loaded with sys.getFileContent so that people can't see them on the scripts.
In a .txt file or without an extension? I get the "QWaitCondition:"'s because I close the server abruptly. Does anyone have this working and can provide me code to look on to see what I should be doing? I'm pretty much at the point of giving up.. it was working fine until I started getting the "Error while connected to server -- Received error n°0: Connection refused" which is when I even started getting into API. I'm still wondering though.. for whom will the importable command work for if I have the pastebin_api_key's using my code? Will it work for anyone connecting? Also, I'm really so new that I don't know anything about importable really. What is the export command to store a pokemon? Anyways thanks for the help so far at least.
The command uses your API key for everybody. Pastebin can detect the abuse of the API key and shut it down in case of the abuse. You should not share the API key with others, that's why it's loaded from a file in PO scripts. Let's say, you read your pastebin api key from your account page, and they say it is abcdefghijk123456789. Now you can put into scripts: Code (text): pastebin_api_key = "abcdefghijk123456789" pastebin_user_key = ""; instead of the sys.getFileContent, try-catch thing there was.
Replace "C:\\Users\\Chris\\Desktop\\pokemon-server\\api_key.txt" with the API key I told you how to find: Anything that says it can't find the file, you have to make. Open up notepad, and save the blade document as what it calls for. I.e: "Script Warning in sys.getFileContent(filename): error when opening tourstats.json: No such file or directory" You would got to Notepad, and save the blank document as 'tourstats.json' to the pokeymon-server folder. Rince and repeat as many times as needed. That should fix "Could not read channelData." As for "Could not read tourstats, initing to null stats." and "Error: SyntaxError: Unable to parse JSON string", this is harmless, ignore it. Should only happen on server start up. The "Warning: QWaitCondition: Destroyed while threads are still waiting" blew my mind. I have 0 idea what that is...
Spoiler Script Check: OK Could not read channelData. Error: SyntaxError: Unable to parse JSON string 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 League was created Channel Mute City was created Channel Evolution Game was created Script Warning in sys.getFileContent(filename): error when opening 7838af2414fc1243dcf2d6d315a4a861: No such file or directory [#Indigo Plateau] ±Dratini: Couldn't load api keys: TypeError: Result of expression 'sys.getFileContent('7838af2414fc1243dcf2d6d315a4a861')' [undefined] is not an object. Connecting to registry... Connected to registry! Sending server info... The registry acknowledged the server.[/HIDE] I tried that last time though and it gives the same thing as this output.. (this is the current output) also I do have a channelData (no extension) and a channelData.json and it still gives could not read channelData... do I have to make it read-only?
It will still warn if you have an empty file channelData.json. It needs to have correct formatting. It will be automatically created when you use scripts. You don't need to worry about it at all. You still have sys.getFileContent('7838af2414fc1243dcf2d6d315a4a 861') in your scripts. Just remove the sys.getFileContent assuming 7838af2414fc1243dcf2d6d315a4a 861 is your API key already and not a file.