1. Welcome to Smogon Forums! Please take a minute to read the rules.
  2. New to the forums? Check out our Mentorship Program!
    Our mentors will answer your questions and help you become a part of the community!

Programming IRC Battle Simulator

Discussion in 'Technical Projects' started by MewMaster, Nov 23, 2010.

  1. MewMaster

    MewMaster

    Joined:
    Sep 18, 2010
    Messages:
    30
    Hello and welcome to my (DragonKnight) tutorial on how to use my Battle Simulator script on IRC. This script is a fully functional Generation IV (soon to be V!) simulator written in mIRC Scripting Language and acts exactly as the game would. However, the script is not complete and therefore most items, abilities, and Status moves are not yet functional. It stores all inputted teams on my computer in a .ini file and retrieves them during battle. All Pokémon are at level 100, and this cannot be changed. Also, genders have not been implemented into this script, so moves like Attract do not exist. The following is a list of Pokémon moves that are not included in this script:
    • Attract
    • Follow Me
    • Helping Hand
    • Sketch
    • Teleport
    If you use mIRC, I have written a script that will allow you to edit your team members without the hassle of using a bunch of /msg's; it makes use of a dialog, which makes it very visual and easy to understand. The script is here: http://pastebin.com/Qqf9q0nx.

    Throughout this tutorial, I will be showing an example of how to create an Infernape on a team called "OU" on this script, which will use all of the optional inputs. The Infernape, when finished, will look something like this:

    [​IMG]

    Making your Team

    Fisrt off, you will want to get on IRC. I am on PurpleSurge's IRC server only, which is irc.purplesurge.net:6667. Come to #Battle, which is where this script is hosted. For all team editing with this script, the basic syntax is:

    Code:
     
    /msg DragonKnight MyTeam [U]Team Name[/U] [U]Type of Input[/U] [U]Slot[/U] [U]Input [/U]
    
    Where underlined text is a parameter.
    The Type of Input parameter can be one of ten words:

    Pokémon Pokemon Item
    IVs EVs Nature
    Ability Moves View
    Delete ​

    Pokémon

    Basic syntax:
    Code:
     
    /msg DragonKnight MyTeam [U]Team Name[/U] Pokémon/Pokemon [U]Slot[/U] [U]Pokémon Species [/U]
    
    This will set the Pokémon species of the specified team to the specidied species. The script connects to Smogon to make sure that what you inputted is a real Pokémon, so do not try to enter anything else. For our Infernape, we will use one of the following commands (It does not matter which):

    Code:
     
    /msg DragonKnight MyTeam OU Pokémon 1 Infernape 
    /msg DragonKnight MyTeam OU Pokemon 1 Infernape 
    
    After doing so, my script should automatically sent you a notice that will look something like the following:

    [COLOR=#da00]-DragonKnight- Pokémon of slot 1 of OU set to Infernape.[/COLOR]

    That is about it. Thing to note:
    1. Setting a Pokémon removes all abilities, moves, and power points previously stored in that slot.
    2. Setting a Pokémon also sets its IVs to all 31 and its EVs to all 0.
    Item

    Basic syntax:

    Code:
     
    /msg DragonKnight MyTeam [U]Team Name[/U] Item [U]Slot[/U] [U]Item[/U] 
    
    This will set the held item for the Pokémon stored on the specified slot. The script connects to Smogon to make sure that what you inputted is a real Pokémon item, so do not try to enter anything else. For our Infernape, we will use the following command:

    Code:
     
    /msg DragonKnight MyTeam OU Item 1 Life Orb 
    
    After doing so, my script should send you back a notice:

    [COLOR=#da00]-DragonKnight- Item of slot 1 of OU set to Life Orb.[/COLOR]

    That is about it.

    IVs

    Basic syntax:

    Code:
    /msg DragonKnight MyTeam [U]Team Name[/U] IVs [U]Slot[/U] [U]HP IV[/U] [U]Atk IV[/U] [U]Def IV[/U] [U]SpA IV[/U] [U]SpD IV[/U] [U]Spe IV[/U] 
    
    This will set the IVs for the Pokémon stored in the specified slot. The script does check to make sure that all inputted values are between 0 and 31. The only time you will really need to use this command is when you make a Pokémon that uses Hidden Power, because the IVs for all Pokémon default to all 31 when created. Since our Infernape does run Hidden Power, we will use this command:

    Code:
    /msg DragonKnight MyTeam OU IVs 1 31 30 30 31 31 31 
    
    These IVs will provide our Infernape with Hidden Power Ice, base power 70. The return message should look like this:

    [COLOR=#da00]-DragonKnight- IVs of slot 1 of OU set to 31 30 30 31 31 31.[/COLOR]

    Note: If you set this before setting the Pokémon in the specified slot, your input will be overwritten with the default settings upon creation.

    EVs

    Basic syntax:

    Code:
    /msg DragonKnight MyTeam [U]Team Name[/U] EVs [U]Slot[/U] [U]HP EV[/U] [U]Atk EV[/U] [U]Def EV[/U] [U]SpA EV[/U] [U]SpD EV[/U] [U]Spe EV[/U] 
    
    This will set the EVs for the Pokémon stored in the specified slot. The script does check to make sure that all inputted values are between 0 and 255 and that the sum of all inputted values is less than or equal to 510. For our Infernape, we will use the following command:

    Code:
    /msg DragonKnight MyTeam OU EVs 1 0 64 0 252 0 192 
    
    This will set the EVs and trigger the following return message:

    [COLOR=#da00]-DragonKnight- EVs of slot 1 of OU set to 0 64 0 252 0 192.[/COLOR]

    Note: If you set this before setting the Pokémon in the specified slot, your input will be overwritten with the default settings upon creation.

    Nature

    Basic syntax:

    Code:
    /msg DragonKnight MyTeam [U]Team Name[/U] Nature [U]Slot[/U] [U]Nature[/U] 
    
    This will set the nature for the Pokémon stored in the specified slot. The script checks to make sure that the inputted string is a legal Pokémon nature and assigns it to the specified slot. For our Infernape, we will type:

    Code:
    /msg DragonKnight MyTeam OU Nature 1 Naive 
    
    The script will send you the following message:

    [COLOR=#da00]-DragonKnight- Nature of slot 1 of OU set to Naive.[/COLOR]

    That is about it.

    Ability

    Basic syntax:

    Code:
    /msg DragonKnight MyTeam [U]Team Name[/U] Ability [U]Slot[/U] [U]Ability[/U] 
    
    This will set the ability for the Pokémon stored in the specified slot. The script connects to Smogon to make sure that the Pokémon in the specified slot can legally obtain the inputted ability. For our Infernape, we will type:

    Code:
    /msg DragonKnight MyTeam OU Ability 1 Blaze 
    
    The script should send you mack a notice saying:

    [COLOR=#da00]-DragonKnight- Ability of slot 1 of OU set to Blaze.[/COLOR]









    And that is it. Things to note:
    1. You cannot set an ability for a slot that does not yet have a Pokémon stored in it.
    Moves

    Basic syntax:

    Code:
    /msg DragonKnight MyTeam [U]Team Name[/U] Moves [U]Slot[/U] [U]Move 1[/U], [U]Move 2[/U], [U]Move 3[/U], [U]Move 4[/U] 
    
    This will set a moveset for the specified slot. The script will connect to Smogon to make sure that the Pokémon stored in the specified slot can learn all four of the inputted moves. For our Infernape, we will use:

    Code:
    /msg DragonKnight MyTeam OU Moves 1 Close Combat, Fire Blast, Grass Knot, Hidden Power 
    
    We should get in return:

    [COLOR=#da00]-DragonKnight- Moveset of slot 1 of OU set to Close Combat, Fire Blast, Grass Knot, Hidden Power.[/COLOR]









    That is it. Things to note:
    1. You cannot set a moveset for a slot that does not yet have a Pokémon stored in it.
    2. You must use a comma immediately after each move followed by a space.
    View

    Basic syntax:

    Code:
    /msg DragonKnight MyTeam [U]Team Name[/U] View [U]Slot[/U] 
    
    This command will show you the Pokémon and all of its accessories stored in the specified slot. To make sure that you filled in everything correctly, I recommend that you use this to check your work after completing each Pokémon. To view our finished Infernape, we will type:

    Code:
    /msg DragonKnight MyTeam OU View 1 
    
    In return, we should recieve the following seven notices:

    [COLOR=#da00]-DragonKnight- Slot 1: Infernape @ Life Orb [/COLOR]
    [COLOR=#da00]-DragonKnight- Blaze, Naive [/COLOR]
    [COLOR=#da00]-DragonKnight- 31 30 30 31 31 31 / 0 64 0 252 0 192 [/COLOR]
    [COLOR=#da00]-DragonKnight- ~ Close Combat [/COLOR]
    [COLOR=#da00]-DragonKnight- ~ Fire Blast [/COLOR]
    [COLOR=#da00]-DragonKnight- ~ Grass Knot [/COLOR]
    [COLOR=#da00]-DragonKnight- ~ Hidden Power [/COLOR]

    Now you're done with Infernape! To complete your team, repeat this process for all six Pokémon, making sure to change the slot parameter for each one. There is one final command that you can use, also: Delete.

    Delete

    Basic syntax:

    Code:
    /msg DragonKnight MyTeam [U]Team Name[/U] Delete 
    
    This command will delete your entire team. It is useful for old teams that you do not use anymore. If we wanted to delete our OU team with our Infernape, we would type:

    Code:
    /msg DragonKnight MyTeam OU Delete 
    
    This will erase the entire team, and send you the following notice:

    [COLOR=#da00]-DragonKnight- Your team OU has been deleted.[/COLOR]

    Using your Team

    After you complete your team, you can use it in a battle! To initiate a battle, type:

    Code:
    !Battle [U]Nickname[/U] 
    
    This will challenge the specified nickname to a battle, which they can choose to accept or decline. If someone challenges you to a battle, you can accept or decline by typing one of the following:

    Code:
    /msg DragonKnight Accept 
    /msg DragonKnight Decline 
    
    Now, let the battling begin! Things to note:
    1. The Nickname parameter is case sensitive.

    From here, you can follow the built-in instructions to battle with your Pokémon. I am on PurpleSurge's IRC server only, which is irc.purplesurge.net:6667. If you want to battle, come to #Battle. This tutorial is also on Bulbapedia: http://bulbapedia.bulbagarden.net/wiki/User:Stmorawski.


    This script is a work in progress. Whenever I get something new working that is of somewhat importance, I will be sure to post and let you know.
  2. capefeather

    capefeather YOU CAN'T STOP ROB
    is a Forum Moderatoris a Community Contributoris a CAP Contributoris a Battle Server Moderator Alumnus
    Moderator

    Joined:
    Apr 26, 2009
    Messages:
    2,792
    Oh wow... I guess this renders locopoke's Trou thread moot.
  3. Umbreon Dan

    Umbreon Dan 〉λ=
    is a CAP Contributor Alumnus

    Joined:
    Oct 19, 2008
    Messages:
    3,201
    i am sure that i like this thread.
  4. MewMaster

    MewMaster

    Joined:
    Sep 18, 2010
    Messages:
    30
    Edited in a sample battle so you can see what this thread is all about. Hope I see some of you on IRC to check this out :toast:.
  5. Jared

    Jared

    Joined:
    Sep 26, 2009
    Messages:
    43
    Oh my, I've been on Purplesurge since 08 and I am SURE I've never seen you around, what's your IRC nick? Mine is Jared
  6. MewMaster

    MewMaster

    Joined:
    Sep 18, 2010
    Messages:
    30
    Check my sig :P 'Tis DragonKnight.
  7. yondie

    yondie I feel a little bit, like, I'm the Braveheart of creativity.
    is a Pre-Contributoris a World Cup of Pokemon defending champion

    Joined:
    Nov 18, 2009
    Messages:
    1,875
    Would you battle eachother through query?
  8. MewMaster

    MewMaster

    Joined:
    Sep 18, 2010
    Messages:
    30
    No. The battle is on a channel so people can spectate :toast:. The channel that the battle will be on is the channel where the person who said !Battle said it.
  9. -Lux-

    -Lux-

    Joined:
    Jun 15, 2010
    Messages:
    395
    Nice job mate bout time you got it up :P
  10. Moo

    Moo Professor
    is an Artist Alumnusis a Researcher Alumnusis a Smogon Media Contributor Alumnusis a Contributor Alumnus

    Joined:
    Jun 21, 2010
    Messages:
    1,446
    Wow, I must say Well done on that.
    But why would someone use this when they can use PO or shoddy? ._.
  11. Chomper The Sharptooth

    Chomper The Sharptooth

    Joined:
    Dec 20, 2009
    Messages:
    301
    Because this is far more awesome. Very nice job Mew, shame I'm never on IRC so I'll never get to try it out. ):
  12. MewMaster

    MewMaster

    Joined:
    Sep 18, 2010
    Messages:
    30
    Because if you battle on an IRC channel with this script, others can watch and give advice and such with less hassle than loading up PO/Shoddy/Pokelab, finding the battle on the battle list, and not getting into the battle until it is half way over. This script is more convenient for spectators.
  13. MewMaster

    MewMaster

    Joined:
    Sep 18, 2010
    Messages:
    30
    Added in a link for a team editing script for mIRC users, which makes the process easier. Link is http://pastebin.com/Qqf9q0nx.

    P.S. sorry for double post :(.
  14. MewMaster

    MewMaster

    Joined:
    Sep 18, 2010
    Messages:
    30
    I have resumed work on this script, including hard-coded 5th gen, an improved team builder, and team preview. Everyone is welcome to check this out on #Battle on Purplesurge, and I will most likely show this off on Smogon's IRC channels when I get it finished.

Users Viewing Thread (Users: 0, Guests: 0)