[Server Scripting] Lutra's Server Script

Discussion in 'Server and Client Scripting' started by Lutra, Jun 3, 2010.

  1. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Everything must be contained within ({ })

    Things like beforeLogOut , afterBattleEnded etc can't be repeated. You have to put the code for each repeated one under the first one.

    e.g. for beforeLogOut: function(src){ [code1]} & beforeLogOut: function(src){[code2]}

    To put them together, you just do beforeLogOut: function(src){ [code1] [code2] }

    Also take the largest number of parameters for each one.

    e.g. there's a beforeChatMessage: function(src, message) and a beforeChatMessage: function(src)

    Use the beforeChatMessage: function(src, message) in this case. Since both parameters are required for part of the code.

    Also, you might have to modify parts of it since they don't go well together. Like type /commands message may be repeated etc.
     
  2. Cykid

    Cykid Member

    Joined:
    Jul 11, 2010
    Messages:
    36
    Likes Received:
    0
    sorry but I dont understand as i dont know a lot about scripting. Can you perhaps help me join both codes?
     
  3. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Well check the topic "Beta Server Scripts", the tournament script in it originated from Lutra's so you have all in 1. Of course, Lutra added commands since then, but then to implement it you would have to find someone to explain you step by step how to merge scripts.
     
  4. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Can someone rename this thread to "Lutra's Server Script", please?

    edit: thanks :)
     
    Last edited: Jul 18, 2010
  5. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    I've added the /switchplayer command. I've also fixed the splicing bugs that were left in because I was not testing it using tournaments with sizes of greater than 4 and checking different orders in which to /dq, /resettourmatch. Most of those bugs should be gone now.
     
  6. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    I've decided this is what /touradmincommands will eventually look like:

    tour|[tier]|[number]: starts [tier] tournament consisting of [number] players.
    — [tier] is any of the server's tiers and [number] is any value greater than 2.
    nontourmatch|[number|player]:
    — declares match [number] or [player]'s match as a non-tournament match.
    — [number] is any valid match number and [player] is any player in that match.
    tourmatch|[number|player]:
    — declares match [number] or [player]'s match as a tournament match.
    — [number] is any valid match number and [player] is any player in that match.
    addmatch|[player1]|[player2]:
    — Adds a match between [player1] and [player2] to the current round
    — where [player1] and [player2] are players previously not in the tournament.
    resetmatch|[number|player]:
    — clears the results of match [number] or [player]'s tournament match.
    — [number] is any valid match number and [player] is any player in that match.
    deletematch|[number|player]:
    — removes the match [number] or [player's] match from the tournament.
    — [number] is any valid match number and [player] is any player in that match.
    qualify|[player]:
    — declares [player] the winner of a match or adds [player] to the tournament
    — in the sign-up phase. [player] is any player in a match or on the server.
    switch|[player1]|[player2]: switches tournament spots between:
    — [player1] and [player2] - where one must be in the tournament.
    — The other must either be in the tournament; or not in it and on the server.
    disqualify|[player]:
    — declares [player] the loser of a match or removes [player] from the
    — tournament. [player] is any player registered in the tournament.
    toursize|[number]: alters the tournament size to [number] during sign-ups.
    — [number] is any value greater than the current tournament size.
    roundsize|[number]: alters the round size to [number] and opens sign-ups.
    — [number] is any value greater than the current round size.
    nextround :
    — removes players that have lost and then moves on to the next round.
    endtour: ends the current tournament.
    showtour : shows the tournament information to everyone.
    showround : shows the round information to everyone.
    showmatches : shows the status of matches to everyone.
    touroptions: allows you to view a list of tournament options.
     
    Last edited: Jul 31, 2010
  7. Professor Oak

    Professor Oak same Forum Administrator Server Owner Social Media Rep Forum Administrator Server Owner Social Media Rep

    Joined:
    Apr 21, 2010
    Messages:
    3,580
    Likes Received:
    2,375
    PO Trainer Name:
    Professor Oak
    I've noticed a problem with using | as a seperator between certain parts of a command - People can still use | in their names. I'm just wondering how this would be sorted out.
     
  8. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Can they use "|"? I can't. I noticed there was a problem with some characters though. I wonder if anyone knows a separator that won't interfere at all. I'd like to not individually do the splitting under every command if I can help it.

    Edit: Oh I see what you mean about | in their names. I only tested it at the start of a name. You can still use ~ in part of your name. I think I'll go with *.
     
    Last edited: Jul 31, 2010
  9. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    i think '+' , '--', '~', '*' would work.
     
  10. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Thanks Professor Oak and coyotte508.

    I've updated with a change of the separator to '*' and fixed a bug with the switch command! (renamed a few commands)

    I've also set the default tournament auth as server auth levels 1 & 2 - but a command to add/remove tour admins! (available to the owner in authoptions)

    Edit: Just to note, if mods/admins are added after the reg val is in place, you still need to use /touradmin*~1 or /touradmin*~2 to make those new ones have tournament auth also.
     
    Last edited: Jul 31, 2010
  11. nesan

    nesan Love is blind

    Joined:
    Jun 13, 2010
    Messages:
    241
    Likes Received:
    0
    *reports broken link*
     
  12. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Fixed.
     
  13. kenderbard

    kenderbard New Member

    Joined:
    Aug 20, 2010
    Messages:
    1
    Likes Received:
    0
    Broken link again, I think.
     
  14. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    ok, I've put the script on pastebin. The webcall won't work because the site is down.
     
  15. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Ok, updated the OP with current information.
     
  16. gaara

    gaara New Member

    Joined:
    Mar 16, 2012
    Messages:
    4
    Likes Received:
    0
    Can someone please explain to me how do I insall this bot in my server?
     
  17. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Copy and paste the content of webcallscript.txt (auto-update script) or serverscript.txt (full script) into the Scripts window (Options > Scripts) on the Server and click OK to load. <<< I just added to OP.
     
  18. gaara

    gaara New Member

    Joined:
    Mar 16, 2012
    Messages:
    4
    Likes Received:
    0
    There is an option for tournament right? if there is how do I start one and use it option
     
  19. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    /channeltouradmin gaara for tournament auth in channel, or /touradmin gaara for tournament auth in all channels. They are Channel Owner and Owner commands respectively.

    Then type /channeltouradmincommands to see a list of commands. /touroptions is most useful. An example tournament would be /tour wifi OU*4 which would start a wifi OU tournament with 4 players.
     
  20. SemiBolt

    SemiBolt New Member

    Joined:
    Mar 6, 2012
    Messages:
    18
    Likes Received:
    0
    Awesome script :D
     
  21. NewDay

    NewDay Member

    Joined:
    Dec 16, 2011
    Messages:
    69
    Likes Received:
    0
    Hi
    How and where can I add a league command to this script(Which will show elites and gymleaders of server and online/offline)
     
  22. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Well adding the online/offline bit requires use of helpers.connectstatus(playername), so you'd have to add a command - basically the functions with (src, channel, command).

    But you could do it without online/offline by typing /writemsgcmd*league*html into the main chat on the server if you're an owner.

    where html could be like: <img src='Themes\Classic\types\type0'> - Norman<br/><img src='Themes\Classic\types\type1'> - Brawly<br/>
     
  23. NewDay

    NewDay Member

    Joined:
    Dec 16, 2011
    Messages:
    69
    Likes Received:
    0
    Thanks
    I added the command using functions and it works well.
    And, if that online/offline is a small process , can u explain me
     
  24. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Well helpers.connectstatus("lugiabattle") would return [pokeball image] lugiabattle online [session id] if you were online with that name. So you just have to make a command to send helpers.connectstatus(playername) for all elite and gym leaders.

    E.g.

    league: function (src, channel, command){
    var display = helpers.connectstatus("Norman")
    + helpers.connectstatus("Brawly");
    sys.sendHtmlMessage(src, display);
    }
     
  25. NewDay

    NewDay Member

    Joined:
    Dec 16, 2011
    Messages:
    69
    Likes Received:
    0
    Wow
    thanks again, that's done now
     
  26. jomyza

    jomyza New Member

    Joined:
    Jun 14, 2012
    Messages:
    2
    Likes Received:
    0
    When i ues /tour command

    It's show this

    "Sorry, you do not have permission to use the tour command."

    Sorry how to get permission to use the tour command?
     
  27. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    /touradmin player
     
  28. jomyza

    jomyza New Member

    Joined:
    Jun 14, 2012
    Messages:
    2
    Likes Received:
    0
    Thank you
     
  29. TheMysteryGuy

    TheMysteryGuy SSJ4 Member

    Joined:
    Jun 16, 2012
    Messages:
    6
    Likes Received:
    0
    Lutra i use ur scripts these are cool but /playerinfo is not woking can u tell me how its work /playerinfo name
     
  30. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Oh /playerinfo only works for anyone online. Sorry, there's a mistake in the command menu. Have you tried for online players?
     
  31. kupo

    kupo Member

    Joined:
    Feb 10, 2011
    Messages:
    63
    Likes Received:
    0
    Another minor thing to note is that /touradmincommands are blank, yet /channeltouradmincommands are not...
     
  32. TheMysteryGuy

    TheMysteryGuy SSJ4 Member

    Joined:
    Jun 16, 2012
    Messages:
    6
    Likes Received:
    0
    Its work for online but y not those player which are in database and offline????
     
  33. TheMysteryGuy

    TheMysteryGuy SSJ4 Member

    Joined:
    Jun 16, 2012
    Messages:
    6
    Likes Received:
    0
    Right Agree
     
  34. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Because all the info is to do with them being online. It could only really save their last visit.
     
  35. Storm pisces

    Storm pisces New Member

    Joined:
    Jun 20, 2012
    Messages:
    9
    Likes Received:
    0
    I use Lutra scripts its so cool espacially /tiersinstall smogon
     
  36. gaara

    gaara New Member

    Joined:
    Mar 16, 2012
    Messages:
    4
    Likes Received:
    0
    Here is a question which is probobly dumb but I have to ask it anyway: How do I create Cup tour? Is it any diffrent from a regular one?
     
  37. Storm pisces

    Storm pisces New Member

    Joined:
    Jun 20, 2012
    Messages:
    9
    Likes Received:
    0
    /tour Wifi Ou:10:Chiken
     
  38. Ninjoshy

    Ninjoshy Ultra Effective Webmaster

    Joined:
    Jun 21, 2012
    Messages:
    3
    Likes Received:
    0
    'm having a little trouble grasping how to make commands and I've gone through the basics on how to script, but still don't quiet understand.

    I learned how to use /writemsgcmd

    But I'm looking to make commands where someone does like

    /lashings <username>

    And it will say like, <username> got 50 lashings from <person who used command>
     
  39. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    You could literally just stick that in between the other commands. It doesn't have mute checks etc, but you could copy them from the other sendall based commands.

    Nevertheless, creating a command to create faux auth commands is not the most wayward idea in the world. Interesting idea for a fun command.
     
  40. Stawbery Jam

    Stawbery Jam Banned

    Joined:
    Jun 21, 2012
    Messages:
    42
    Likes Received:
    0
    I love lutra scripts and i know more about lutra scipts
    type /commands for commands and if it having trouble then see the scripts line
    And Ninjoshy u are not able to do it ur self talk to lutra