PO v1 Version Full Script Link: http://pokemonperfect.co.uk/serverscript.txt Auto-Update Script Link: http://pokemonperfect.co.uk/webcallscript.txt Instructions PO v2 Version Info: https://github.com/Jakilutra/Lutra-s-Pokemon-Online-Supplements/wiki/PO-Server-Scripts N.B. originally a tournament script that developed into a server script. Now, a new server script is in development. I will also tweet my decisions regarding the development of the script.
Wow, thanks a lot. I still see the influence of NB scripts. Instead of doing a whole lot of if / else, use something like Code (javascript): if (commandpart[0] == "xxxx") { .... return; } if (commandpart[0] == "yyyy") { .... return; } if (commandpart[0] == "zzzz") { .... return; } and Code (javascript): if (tourmode == 0) { sys.sendMessage(src, "A tournament is not running"); return; } if (tourmembers.indexOf(tourmembername) in tourmembers) { sys.sendMessage(src, "You're already registered"); return; } ...
I have no experience with javascript, but I want to throw this idea/suggestion out...well question mostly. Is it possible to be able to input tournament participants into a tourney? Say you have a forum tournament sign up and you only want the people who signed up for the tournament on the forums to participate. Is there a way to create this? Edit: Awesome script though, Lutra. Everyone is going to use it lol.
That's a very good suggestion. I probably should have made that when I was testing the display of the rounds xd. I'll do it after all the essential things are done. What do you think is the best format for the command?
Ok here are my tweaks Code (javascript): afterBattleEnded: function(winner, loser){ if (tourmode == 2){ this.tourneyBattleEnd(sys.name(winner), sys.name(loser)); } } , disqualify: function(src,name) { var index = tourmembers.indexOf(name); if (index == -1) { sys.sendMessage(src, name + " isn't in the tournament."); return; } if (index %2 == 0) { var opponent = tourmembers[index+1]; if (opponent == "*bye") { sys.sendMessage(src, name + " got a bye."); return; } if (tourbattlers.indexOf(name) == -1) { tourbattlers.push(name); tourbattlers.push(opponent); } sys.sendAll("~~Server~~: " + name + " was disqualified from the tournament!"); this.tourneyBattleEnd(opponent, name); } else { var opponent = tourmembers[index - 1]; sys.sendAll("~~Server~~: " + name + " was disqualified from the tournament!"); if (tourbattlers.indexOf(name) == -1) { tourbattlers.push(name); tourbattlers.push(opponent); } this.tourneyBattleEnd(opponent, name); } } , tourneyBattleEnd : function(winnername, losername) { var tourloser = tourbattlers.indexOf(losername) if (tourloser in tourbattlers && tourlosers.indexOf(losername) == -1){ tourlosers.push(losername) tourbattlers.splice(tourloser,1); var tourwinner = tourbattlers.indexOf(winnername) tourbattlers.splice(tourwinner,1); tourbattles++; if (tourcurrentnumber % 2 == 1 && tourbattles == tourcurrentnumber/2 -0.5){ tourmembers.splice(tourcurrentnumber,1); tourcurrentnumber = tourcurrentnumber/2 + 0.5; this.roundpairing(); return; } if (tourcurrentnumber % 2 == 0 && tourbattles == tourcurrentnumber/2){ if (tourcurrentnumber == 2){ tourmode = 0; sys.sendAll(""); sys.sendAll(border); sys.sendAll(""); sys.sendAll("THE WINNER OF THE TOURNAMENT IS : " + winnername); sys.sendAll(""); sys.sendAll("*** Congratulations, " + winnername + ", on your success!"); sys.sendAll(""); sys.sendAll(border); sys.sendAll(""); return; } if (tourcurrentnumber > 2){ tourcurrentnumber = tourcurrentnumber/2; this.roundpairing(); return; } } sys.sendAll(""); sys.sendAll(border); sys.sendAll("*** A tournament match has been completed!"); sys.sendAll(""); sys.sendAll("~~Server~~: " + winnername + " advances to the next round:"); sys.sendAll("~~Server~~: " + losername + " is out of the tournament."); sys.sendAll(""); sys.sendAll("*** " + Math.floor(tourcurrentnumber/2 - tourbattles) + " more match(es) to be completed in this round!"); sys.sendAll(border); sys.sendAll(""); } } Basically when a mod use the dq command, call this.dq(src, nameOfTheDqdPlayer) -- only works when the guy is in a pairing, or battling. Also the problem of someone fighting multiple times and screwing over the tourney system is fixed. Though my dq solution is ugly, it's just a temporary fix until you make something better :)
Thanks very much for that coyotte :) I've added that tourneyBattleEnd function. I'll change that if else structure tomorrow and work on dqplayer and sub in. Edit: Replaced the if else.
Noticed I forgot to add one check after a battle ends, to avoid the problem of duplicate battles. The correct fix is: Code (text): tourneyBattleEnd : function(winnername, losername) { var tourloser = tourbattlers.indexOf(losername) if (tourloser in tourbattlers && tourlosers.indexOf(losername) == -1 && tourlosers.indexOf(winnername) == -1){ (The previous version would work ok if the previous loser still lost that match, but not if he won it)
Lutra, I know this wont really make a good stand alone script, so could you maybe split it into parts that can be added into other scripts easier when you post the next version?
Updated with some minor changes. I'm in the process of doing the disqualify command. Well the priority is to aim it for people who just want to copy and paste everything. It'd make it harder for those people if each event etc. was separated. Plus it would reduce my willingness to update the post if I have to edit every part. I know it's not easy updating your own script when this is updated every time, but please bear with it for the time being.
Just so you know: Code (text): afterBattleEnded: function(winner, loser, desc){ if (tourmode == 2 && desc != "tie"){ this.tourneybattleend(sys.name(winner), sys.name(loser)); } } To avoid problems with ties
Ok thanks coyotte, I added that. I've modified the round display so that the winner of any match is now displayed with brackets around them. :) I've also made a member separate to tourneybattleend just for increasing battles in rounds called roundincrease - as well as improving the display for that. The disqualify command is a bit annoying to do. That's why I'm trying to do easy bits first.
I could not find anything similar in your scripts as I looked through them, but then, I'm not very experienced with Javascript - but the addition of a /dropout command would be very useful, since currently you have to get someone to disqualify you if you need to leave. (it should work both before the tournament starts and during it.)
Ok done most of /disqualify, the only thing I haven't taken into account yet is disqualifying a bye opponent in the case of 3 players - so that the final becomes the match in that round for those other two players. Edit: There's also the problem of the message displayed when two people facing each other both get disqualified. Let me know if there are any other problems.
It would be great to have a command which returned a list of unfinished matches. It's hard to find who needs DQing in a large tourney otherwise.
As well as having brackets around the winner? I've done that already. It's just coyotte hasn't updated yet. I do admit in massive tournaments, even the scanning through the bracketed winners becomes a pain. But the largest tournament size is 64 atm, so I'm not sure that's a very big deal yet.
It's not very practical to keep track of who has done their matches and who has not in a 64 man tournament with an active chat, if you could just put something like /matches and get a list of matches that are not finished it would be cool. Then you know who to talk to, and can DQ those last few people who tend to hold it up. Do you mean you've got a command that tells the state of all matches, including the finished ones? If yes, that'd work fine.
This is how it is at the moment. Given the only match won here is when Lutra beat Lutra4. (22:35:02) *** Round 1 *** (22:35:02) »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»: (22:35:02) Lutra4 VS (Lutra) (22:35:02) Lutra2 VS Lutra3 (22:35:02) »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»:
great, that will help a lot when it's live. Edit: Could you make it differentiate between doubles and singles?
Well singles and doubles should have their own tiers really. I think it should be the server's responsibility to enforce singles/doubles in that tier. Although the limitations of the tier system of the simulator are to blame too. I just don't want to add something that could be irrelevant. coyotte can include whatever modifications he wants in the beta server scripts though.
Sorry, I use Google translator. I would like to use the script on my server, and wanted to ask if I can use it? I would also like to change him so that he is German.
If it could do something like send a PM to players who had not started their matches after 2-3 mins saying "Are you here? Please play <player> and reply to this PM to confirm your activity." (and maybe say PM a mod if they need help) and if only one replied within a reasonable length of time DQ the other it would help to reduce mod involvement a lot. I don't know if it's possible to have the server PM people currently though. Other than that, one more command would be handy (though not vital by any means), being able to sub someone in would be great. Like /replace <player1> <player2> would replace player 1 with player 2, this would help if if there has been an error (incorrect dq, someone slipping through the rules, glitch in the script) and be good as an extra control for mods. Really brilliant script, this thing is responsible for most of the activity in the main chat round the clock.
Yeah, you can't currently have the server pm people. And I'll be doing a sub in/out command very soon btw. I just want to try to sort out the bugs first and do some other easy bits. Edit: I've got rid of the bracketed s in "spot(s)" when they join and the bracketed es in "match(es)" when the number of matches left are shown. If there's 1, it will now say "spot" and "match" and everyone else is "spots" and "matches".
Could you, if you have times, do different things: - When someone has a battle coming in a tourney, prevent him to battle anyone else, or to battle in the wrong tier - Show the list of the matches in the round, separating battles that are done and battles that are still going on Also one thing, i often saw stuff like that in your code: Code (text): condition ? do this : do that That's not what the '?' ':' operator was designed for. If you do that you might as well do if/else For example in your code, you have Code (text): var roundstring; tourcurrentnumber == 2 ? roundstring = "*** Final Round of " + tourtier.toUpperCase() + " Tournament ***" : roundstring = "*** Round " + roundnumber + " of " + tourtier.toUpperCase() + " Tournament ***" send(roundstring); That's an unnatural way of using the ternary '?' operator. You might want to do that instead: Code (text): var roundstring = tourcurrentnumber == 2 ? "*** Final Round of " + tourtier.toUpperCase() + " Tournament ***" : "*** Round " + roundnumber + " of " + tourtier.toUpperCase() + " Tournament ***"; send(roundstring); Because doing assignations within the operator is unnatural. And as you can see you can use the result of the operator to do the assignation, and that's more understandable too. Anyway, kudos for making this script :)
Thanks, updated with the more efficient code. I'll do the force tourney battle as an tournament administrator option that is saved. The options will say like it is turned off by default, do this command to turn it on. I'll be doing the /viewmatchstatus as completed matches at the top, ongoing matches in the middle and matches not started at the bottom.
Shouldn't it restrict tournament participants from being able to start battles players other than their tournament opponent? Just had a round held up because we were waiting for a player to finish a battle with someone else so his opponent could challenge him. Also why is the /dq command case-sensitive?
Look 2 or 3 posts up for the 1st paragraph. For the 2nd, you're referring to a modified version of this tournament script.
I tend to just tell tourney players to quit their other battle or get DQed, but it is slightly annoying.
If i type: !tour overused 12 It make this error: Sorry, the server does not recognise the overuser tier.
Fixed the space in tiers bug and also an error with the /viewmatches display. Did the force tourbattle option. :) Suggestions to implement list: - Fix the bugs associated with 2 players facing each other being removed and then do "leave" command. - "Subin/out" command. - "Add player" command and "freeze sign-ups" command.