1. Welcome to Smogon! Check out the Smogon Starters Hangout for everything you need to know about starting out in the community. Don't forget to introduce yourself in the Introduction and Hangout Thread, too!
  2. Welcome to Smogon Forums! Please take a minute to read the rules.

Data Some cool IRC utilities for ASB

Discussion in 'ASB' started by (makeup), Jun 12, 2011.

Thread Status:
Not open for further replies.
  1. (makeup)

    (makeup) kevin
    is a Site Staff Alumnusis a Contributor Alumnus

    Joined:
    Feb 22, 2010
    Messages:
    2,874
    approved by Deck Knight :)

    Move Information

    Have you ever had to open up the data audit thread when you just wanted to check the energy cost of Mega Drain? Have you wanted to clarify the priority of Wide Guard, but didn't want to open a whole tab for it? Have you ever wanted to see how many actions Encore takes up, but didn't have the time?

    If the answer to any of those questions is yes, this script is for you!

    Usage

    The usage of this script is uncomfortably easy. Simple type:
    Code:
    /socks <move>
    Replace <move> with the move you want to look up. Then, a socket will connect to Smogon via awesomeness and pull the data right in front of you!

    For example, if I type:
    Code:
    /socks Thunder Wave
    It should return:
    Code:
    [COLOR=DarkRed][20:36:50] <CharScript> Thunder Wave: The Pokemon releases blue sparks that target the opponent’s muscle nerves, making them have a chance not to respond to any commands, effectively paralyzing them. Pokemon with a Ground typing or the abilities Lightningrod, Limber, Motor Drive, or Volt Absorb are immune to Thunder Wave.
    [20:36:50] <CharScript> Attack Power: -- | Accuracy: 100% | Energy Cost: 7 | Effect Chance: -- | Typing: Electric | Priority: 0[/COLOR]
    Setting it Up

    All you need to do is add this script to your remote tab via Scripts Editor. In clients other than mIRC, it might have a slightly different name. You need to paste this into remote. Make sure to add this to the Remote tab! This can be done by opening Scripts Editor, or you can press Alt+r. (Note: This is done in mIRC Scripting Language (MSL), which means clients that don't support it can't use it. No, it doesn't work on Mibbit.

    Also, give a ton of appreciation to MewMaster. He may seem like a random, but he's actually an amazing dude, and he helped a lot with this script. Catch him on IRC as DragonKnight!

    Code:
    alias socks {
      sockopen Smogon www.smogon.com 80
      set %move $$1-
    }
    on *:sockopen:Smogon: {
      sockwrite -nt Smogon GET /forums/showpost.php?p=3290502&postcount=3 HTTP/1.0
      sockwrite -nt Smogon Host: www.smogon.com
      sockwrite -nt Smogon $crlf
    }
    on *:sockread:Smogon: { 
      var %text
      sockread %text
      if (%found == 2) {
        unset %found
        unset %move
        echo -a 5[ $+ $time $+ ] <CharScript> $nohtml(%text)
        sockclose Smogon
      }
      if (%found == 1) inc %found 1
      if (($+(*<b>,%move,$chr(58),*</b>*) iswm %text) || ($+(*<b>,%move,</b>,$chr(58),*) iswm %text)) {
        inc %found 1
        echo -a 5[ $+ $time $+ ] <CharScript> $nohtml(%text)
      }
    }
    alias -l nohtml {
      var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
      return %x
    }
    
    Damage Calculator

    There is also an ASB damage calculator. There is the syntax:
    /calc base_attack_power Attack Rank Defense Rank STAB[Yes or No] Weakness Critical Hit [If Critical Hit, type crit here. If not, leave blank
    Here are some example calculations.

    Syclant using Blizzard on Dragonite: /calc 12 4 4 yes 4
    Salamence using Brick Break on Dragonite: /calc 8 5 3 no .5
    Machamp using Critical Hit Cross Chop on Serperior: /calc 10 5 3 yes 1 crit

    The calculations should look like this:
    And the code for the damage calculator:
    Code:
    [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]alias calc {
      if ($6 == crit) { set %crit 3
      }
      elseif ($6 == $null) set %critlevel $r(1,10000)
      if (%critlevel < 626) { set %crit 3
      }
      elseif (%critlevel > 625) { set %crit 0
      }
      if ($2 > 5) { set %atk $calc(($2 - 5) + 7.5)
      }
      elseif ($2 == 0) { set %atk 1
      }
      else { set %atk $calc($2 + ($2 * 0.5))
      }
      if ($3 > 5) { set %def $calc(($3 - 5) + 7.5)
      }
      elseif ($3 == 0) { set %def 1
      }
      else { set %def $calc($3 + ($3 * 0.5))
      }
      set %dif $calc(%atk - %def)
      if ($4 == yes) { set %stab 3
      }
      elseif ($4 == no) { set %stab 0
      }
      if ($5 == .25) { set %se .44
      }
      elseif ($5 == .5) { set %se .67
      }
      elseif ($5 == 1) { set %se 1
      }
      elseif ($5 == 2) { set %se 1.5
      }
      elseif ($5 == 4) { set %se 2.25
      }
      set %calc $calc(($1 + %dif + %stab + %crit) * %se)
      echo -a <CharScript> ------
      echo -a [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]<CharScript> [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]Base Power: $1
      echo -a [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]<CharScript> [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]Attack: Rank $2
      echo -a [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]<CharScript> [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]Defense: Rank $3
      echo -a [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]<CharScript> [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]STAB: $4
      echo -a [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]<CharScript> [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]Weakness: $5 $+ x
      if (%crit == 0) { echo -a Critical Hit: no
      }
      elseif (%crit === 3) { echo -a [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]<CharScript> [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]Critical Hit: yes
      }
      echo -a Damage: [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]<CharScript> [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]%calc
      echo -a [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]<CharScript> [/COLOR][/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][COLOR=Black]------
      unset %crit %critlevel %atk %def %stab %dif %se
    }

    Speed Calculator

    There IS
    an easier way to find the Base Speed of your new +Spe Pokemon! Not only that, but this will tell you the accuracy boost by the +Spe nature! (NOTE: I have added the divisors that were proposed in the June 26 SotG vote. There is already a majority vote choosing to allow them, so don't bitch about it please.)

    Here is the syntax:

    /+Spe <c_stage> <m_stage> <s_spe>
    <c_stage> is the Pokemon's current stage in their evolution line. For example, Shelgon would be 2, Volcarona would be 2, Bagon would be 1, Larvesta would be 1, Spiritomb would be 1, Jolteon would be 2, etc.

    <m_stage> is the Pokemon's max stage in their evolution line. For example, Shelgon would be 3, Volcarona would be 2, Bagon would be 3, Larvesta would be 2, Spiritomb would be 1, and Jolteon would be 2.

    <s_spe> is the standard Speed for each Pokemon, which is their Base Speed without any modifications. For example, Shelgon would be 50, Volcarona would be 100, Jolteon would be 130, etc.

    Examples:

    Volcarona: /+Spe 2 2 100
    Roserade: /+Spe 3 3 90
    Bagon: /+Spe 1 3 50
    Jolteon: /+Spe 2 2 130

    Here is what it'll return:

    [TIMESTAMP] <CharScript> Old Speed: <original Speed>. New Speed: <new Speed> [<unrounded new Speed>].
    [TIMESTAMP] <CharScript> Accuracy Boost: <accuracy boost>% [<unrounded accuracy boost>%].

    For example, it'll return this for Bagon:

    [18:15:31] <CharScript> Old Speed: 50. New Speed: 58 [57.5].
    [18:15:31] <CharScript> Accuracy Boost: 12% [11.6%].

    Finally, here is the code! As usual, open up Remote (Alt+r) and paste the script into a new file. Save the file!
    Code:
    alias +Spe {
      set %b $calc($$1 / $$2)
      if (%b == 1) {
        set %c 870
      }
      elseif (%b == 0.333333) {
        set %c 290
      }
      elseif (%b == 0.5) {
        set %c 435
      }
      elseif (%b == 0.666667) {
        set %c 580
      }
      set %a $calc($$3 * 1.15)
      set %d $calc($ceil(%a) * $ceil(%a) / %c)
      if ($round(%d,0) > 30) {
        set %e 30
      }
      elseif ($round(%d,0) < 5) {
        set %e 5
      }
      else {
        set %e $round(%d,0)
      }
      echo -a 4[ $+ $time $+ ] <CharScript> Old Speed: $$3 $+ . New Speed: $ceil(%a) [ $+ %a $+ ].
      echo -a 4[ $+ $time $+ ] <CharScript> Accuracy Boost: %e $+ % [ $+ %d $+ % $+ ].
      unset %a %b %c %d %e
    }
    
  2. Athenodoros

    Athenodoros Official Smogon Know-It-All

    Joined:
    Mar 13, 2010
    Messages:
    4,936
    The Data Audit script is cool. I generally do mental calcs, but I do like the first one. Thanks Charmander :)
  3. (makeup)

    (makeup) kevin
    is a Site Staff Alumnusis a Contributor Alumnus

    Joined:
    Feb 22, 2010
    Messages:
    2,874
    Your welcome :) I tried to make these as detailed as possible so they will outclass mental calculations, and the data audit thread script is a huge time saver.

    Oh, also, I forgot to mention that in the calc script, if you don't specify "crit," it will do an automatic roll to determine whether you crit or not. This is there for reffing.

    Glad to know you like it :)
  4. Athenodoros

    Athenodoros Official Smogon Know-It-All

    Joined:
    Mar 13, 2010
    Messages:
    4,936
    Okay, that is awesome.
  5. Venser

    Venser

    Joined:
    Jun 9, 2010
    Messages:
    1,638
    Mac users are shafted, as usual :P
  6. Athenodoros

    Athenodoros Official Smogon Know-It-All

    Joined:
    Mar 13, 2010
    Messages:
    4,936
  7. Lady Salamence

    Lady Salamence
    is a Smogon Social Media Contributor Alumnusis a Forum Moderator Alumnusis a Contributor Alumnusis a Smogon Media Contributor Alumnus

    Joined:
    Aug 4, 2010
    Messages:
    3,993
    how do i use this in my synirc.com irc?
  8. (makeup)

    (makeup) kevin
    is a Site Staff Alumnusis a Contributor Alumnus

    Joined:
    Feb 22, 2010
    Messages:
    2,874
    You can't. You need a client that support MSL. The only one I know is mIRC, but there might be more.
  9. iss

    iss happily ever after
    is a Forum Moderator Alumnusis a Contributor Alumnus

    Joined:
    Jun 5, 2009
    Messages:
    2,093
    Nice one Charmander!

    Only thing I can see is implementing attack/defense boosts in the calc. A situation like that just came up on #capasb.

    EDIT: Also, uh, I keep getting this whenever I do /calc :IF(%CRITLEVEL Unknown command
  10. (makeup)

    (makeup) kevin
    is a Site Staff Alumnusis a Contributor Alumnus

    Joined:
    Feb 22, 2010
    Messages:
    2,874
    Thanks! Boost were actually requested by a few people, but I use $6 for crits and not boosts.
    ^pretty much, since boosts are so easy to calculate, 'd rather make you do it manually than have to type something for it not to get the critical hit.

    Also, sorry about the glitch. That was my fault for missing a line. If you've already added the script, just change the fourth line to this and you should be ready to go:
    Code:
      if (%critlevel < 626) { set %crit 3
    just add a space between if and (.....) < 626
  11. (makeup)

    (makeup) kevin
    is a Site Staff Alumnusis a Contributor Alumnus

    Joined:
    Feb 22, 2010
    Messages:
    2,874
    bumping due to the addition of a new script. You may now calculate Speed boosts and accuracy boosts with the snap of a finger!

    edit: edited the script with the 30% cap and the 5% minimum. The unrounded version will remain the same, though, so you can see what it would actually be.

    Elekid example:

    [19:42:10] <CharScript> Old Speed: 95. New Speed: 110 [109.25].
    [19:42:10] <CharScript> Accuracy Boost: 30% [41.724138%].

    Ferroseed example:

    [19:44:08] <CharScript> Old Speed: 10. New Speed: 12 [11.5].
    [19:44:08] <CharScript> Accuracy Boost: 5% [0.331034%].
  12. Dogfish44

    Dogfish44 Banned from 22 Casinos
    is a Forum Moderator
    Moderator

    Joined:
    Jan 1, 2009
    Messages:
    1,036
    Code:
    alias Spe {
      set %a $calc($$1 * 1.15)
      if $2 = FE || 3/3 || 2/2 || 1/1 {
        set %fe $calc((%a * %a)/870)
        if %fe > 30 {
          set %fe 30
        }
        if %fe < 5 {
          set %fe 5
        }
        set %b %fe
      }
      if $2 = 2/3 {
        set %twothree $calc((%a * %a)/580)
        if %twothree > 30 {
          set %twothree 30
        }
        if %twothree < 5 {
          set %twothree 5
        }
        set %b %twothree
      }
      if $2 = 1/2 {
        set %onetwo $calc((%a * %a)/435)
        if %onetwo > 30 {
          set %onetwo 30
        }
        if %onetwo < 5 {
          set %onetwo 5
        }
        set %b %onetwo
      }
      if $2 = 1/3 {
        set %onethree $calc((%a * %a)/290)
        if %onethree > 30 {
          set %onethree 30
        }
        if %onethree < 5 {
          set %onethree 5
        }
        set %b %onethree
      }
      echo -a $3- Goes from $$1 speed to $round(%a,0) $chr(91) $+ %a $+ $chr(93) speed. This gives an accuracy boost of $round(%b,0) $+ $chr(37) $chr(91) $+ %b $+ $chr(37) $+ $chr(93) $+ .
    }
    
    A variant on Charmander's Script for Speed calculations, this one allows you to (As an option with no detrimantal effect) plug in the mons name at the end (Including multiple word nicknames), and uses a slightly different interface - Using the following:

    /spe Basespeed evostage

    Where Base Speed is the mon's base speed, and Evostage is the stage of evolution, marked as x/y, where x is the current stage, and y is the max stage. FE also works for a fully evolved mon!

    (This was completed with charmander's help, and is usefufl if you want to C/P things quickly for other people).

    It's installed in the same way as Charmander's one. EG in use:

    Swoobat:

    Swoobat Goes from 114 speed to 131 [131.1] speed. This gives an accuracy boost of 20% [19.755414%].

    Togetic (With Optional and Without):

    Togetic Goes from 40 speed to 46 [46] speed. This gives an accuracy boost of 5% [5%].
    Goes from 40 speed to 46 [46] speed. This gives an accuracy boost of 5% [5%].


    I know that I could make some minor changes to the script to reduce size (I can see several lines easy to remove by doing something at a later point), however this works well.
  13. (makeup)

    (makeup) kevin
    is a Site Staff Alumnusis a Contributor Alumnus

    Joined:
    Feb 22, 2010
    Messages:
    2,874
    I started to try and fix this, but stopped later on. Why are you using so many if statements? You want elseif. If your clause follows more than one of those if statements, it will glitch. Also, remember to put a } when your if statement is done or all the other if statements will be part of it and it will glitch. Also, you need parenthesis for your parameter. EX:

    if (statement) {
    command
    }
    elseif (statement that isn't true about the if) {
    command
    }

    why are you using such complicated variables for your division? You can just do what I did and use %b as a universal divisor. Don't use a second parameter alone as an indicator of stage; it will create way too much work for you. You can just use a simple $calc for that actually. EX:

    if ($calc($$1 / $$2) == 1) {
    set %b 870
    }

    If it is 1/1 (single stage, fully evolved), 2/2 (fully evolved), or 3/3 (fully evolved), the calc will result in one and easily set %b as your divisor. mIRC cuts off and rounds after a certain point so you can still do it with 2 or 1/3. If you want to check what it will be, there is always //echo -a $calc(1/3). Also, you don't need to use $+ $chr(37) $+ . It recognizes % as a symbol and not variable as long as you don't have anything after it, so I guess that saves a few bites. There is some more stuff but I'll wait until you fix what I said so far.
  14. Deck Knight

    Deck Knight DK! DK! Donkey Kong is here!
    is a Forum Moderatoris a CAP Contributoris a Smogon Media Contributor
    Moderator

    Joined:
    May 27, 2005
    Messages:
    7,612
    I updated the Attack List Thread, here is the updated script:

    Code:
    alias socks {
      sockopen Smogon www.smogon.com 80
      set %move $$1-
    }
    on *:sockopen:Smogon: {
      sockwrite -nt Smogon GET /forums/showpost.php?p=3710694&postcount=3 HTTP/1.0
      sockwrite -nt Smogon Host: www.smogon.com
      sockwrite -nt Smogon $crlf
    }
    on *:sockread:Smogon: { 
      var %text
      sockread %text
      if (%found == 2) {
        unset %found
        unset %move
        echo -a 5[ $+ $time $+ ] <CharScript> $nohtml(%text)
        sockclose Smogon
      }
      if (%found == 1) inc %found 1
      if (($+(*<b>,%move,$chr(58),*</b>*) iswm %text) || ($+(*<b>,%move,</b>,$chr(58),*) iswm %text)) {
        inc %found 1
        echo -a 5[ $+ $time $+ ] <CharScript> $nohtml(%text)
      }
    }
    alias -l nohtml {
      var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
      return %x
    
    The only difference is the post reference. Just C+P this over the previous script and it will work properly.
Thread Status:
Not open for further replies.

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