PokeScript

By Jelly on Jun 02, 2011

PokeScript is the beginnings of a text-based Pokemon game similar in function to cash bots (such as Onzichtbaar on SwiftIRC)

Currently the code is not finished, but what is written does work. I tried to minimize the use of ini files, but there's only so many horrible looking variables that I can stand. The code would be shorter if I used INI files, I am aware of this, but I have enough in the PokeScript.ini file anyway (found here NEEDED TO WORK -> http://paste2.org/p/1449056 )

on $*:text:/^[!.]Encounter$/Si:#PokeScript:{
  if %LoggedIn. [ $+ [ $nick ] ] == $null { 
    notice $nick You need to log in first! 
    halt
  } 
  if %EncTimer. [ $+ [ $nick ] ] {
    notice $nick You must wait $duration( %EncTimer. [ $+ [ $nick ] ] ) before you can start an encounter again.
    halt
  }
  if %Encounter. [ $+ [ $nick ] ] != $null {
    notice $nick You're already in an encounter, type !CatchInfo to return to your catch encounter!
    halt
  }
  else {
    set %FleeTurns. [ $+ [ $nick ] ] $r(5,12)
    set %MaxHpEnemy. [ $+ [ $nick ] ] $r(500,750)
    set %JhotoMap $gettok(%MartItem6,1,44)
    set %HoennMap $gettok(%MartItem7,1,44)
    set %SinnohMap $gettok(%MartItem8,1,44)
    if %JhotoMap !isin %Bag. [ $+ [ $nick ] ] {
      var %region. [ $+ [ $nick ] ] Kanto
    }
    if %JhotoMap isin %Bag. [ $+ [ $nick ] ] { 
      set %region. [ $+ [ $nick ] ] $readini(PokeScript.ini,n,jr,$ini(PokeScript.ini,jr,$r(1,$ini(PokeScript.ini,jr,0))))
    }
    if %HoennMap isin %Bag. [ $+ [ $nick ] ] {
      set %region. [ $+ [ $nick ] ] $readini(PokeScript.ini,n,hr,$ini(PokeScript.ini,hr,$r(1,$ini(PokeScript.ini,hr,0))))
    }
    if %SinnohMap isin %Bag. [ $+ [ $nick ] ] {
      set %region. [ $+ [ $nick ] ] $readini(PokeScript.ini,n,sr,$ini(PokeScript.ini,sr,$r(1,$ini(PokeScript.ini,sr,0))))
    }
    set %Encounter. [ $+ [ $nick ] ] $readini(PokeScript.ini,n,%region. [ $+ [ $nick ] ],$ini(PokeScript.ini,%region. [ $+ [ $nick ] ],$r(1,$ini(PokeScript.ini,%region. [ $+ [ $nick ] ],0))))
    msg # $nick decided to go out in search of new Pokémon. A wild %Encounter. [ $+ [ $nick ] ] appeared!
    notice $nick What will you do? !attack !run !ball (Enemy HP: %MaxHpEnemy. [ $+ [ $nick ] ] / %MaxHpEnemy. [ $+ [ $nick ] ] $+ )     
    set -z [ %EncTimer. [ $+ [ $nick ] ] ] $r(60,800)
    notice $nick You may use this again in $duration( %EncTimer. [ $+ [ $nick ] ] ) $+ .
  }
}

on $*:text:/^[!.]Battle$/Si:#PokeScript:{
  if %LoggedIn. [ $+ [ $nick ] ] == $null { 
    notice $nick You need to log in first! 
    halt
  } 
  if %InBattle. [ $+ [ $nick ] ] {
    notice $nick You must complete your current battle first!
    halt
  }
  if %Encounter. [ $+ [ $nick ] ] != $null {
    notice $nick You need to end your wild pokemon encounter first! 
    halt 
  }
  if %BattleTimer. [ $+ [ $nick ] ] {
    notice $nick You must wait $duration( %BattleTimer. [ $+ [ $nick ] ] ) before you can start a battle again.
    halt
  }
  if (%pokedex. [ $+ [ $nick ] ] == $null) {
    notice $nick You need at least one Pokemon to start a battle.
    halt
  }
  set -z [ %BattleTimer. [ $+ [ $nick ] ] ] $r(60,300)
  if $gettok(%PokeDex. [ $+ [ $nick ] ],1,44) != $null {
    set %PartyRand. [ $+ [ $nick ] ] $r(1,493) 
    while $gettok(%pokedex. [ $+ [ $nick ] ],%PartyRand. [ $+ [ $nick ] ],44) { set %PartyRand. [ $+ [ $nick ] ] $r(1,493) }
    Set %Party1. [ $+ [ $nick ] ] $gettok(%pokedex. [ $+ [ $nick ] ],%PartyRand. [ $+ [ $nick ] ],44)
  }
  if $gettok(%PokeDex. [ $+ [ $nick ] ],2,44) != $null {
    set %PartyRand. [ $+ [ $nick ] ] $r(1,493) 
    while $gettok(%pokedex. [ $+ [ $nick ] ],%PartyRand. [ $+ [ $nick ] ],44) { set %PartyRand. [ $+ [ $nick ] ] $r(1,493) }
    Set %Party2. [ $+ [ $nick ] ] $gettok(%pokedex. [ $+ [ $nick ] ],%PartyRand. [ $+ [ $nick ] ],44)
  }
  if $gettok(%PokeDex. [ $+ [ $nick ] ],3,44) != $null {
    set %PartyRand. [ $+ [ $nick ] ] $r(1,493) 
    while $gettok(%pokedex. [ $+ [ $nick ] ],%PartyRand. [ $+ [ $nick ] ],44) { set %PartyRand. [ $+ [ $nick ] ] $r(1,493) }
    Set %Party3. [ $+ [ $nick ] ] $gettok(%pokedex. [ $+ [ $nick ] ],%PartyRand. [ $+ [ $nick ] ],44)
  }
  if $gettok(%PokeDex. [ $+ [ $nick ] ],4,44) != $null {
    set %PartyRand. [ $+ [ $nick ] ] $r(1,493) 
    while $gettok(%pokedex. [ $+ [ $nick ] ],%PartyRand. [ $+ [ $nick ] ],44) { set %PartyRand. [ $+ [ $nick ] ] $r(1,493) }
    Set %Party4. [ $+ [ $nick ] ] $gettok(%pokedex. [ $+ [ $nick ] ],%PartyRand. [ $+ [ $nick ] ],44)
  }
  if $gettok(%PokeDex. [ $+ [ $nick ] ],5,44) != $null {
    set %PartyRand. [ $+ [ $nick ] ] $r(1,493) 
    while $gettok(%pokedex. [ $+ [ $nick ] ],%PartyRand. [ $+ [ $nick ] ],44) { set %PartyRand. [ $+ [ $nick ] ] $r(1,493) }
    Set %Party5. [ $+ [ $nick ] ] $gettok(%pokedex. [ $+ [ $nick ] ],%PartyRand. [ $+ [ $nick ] ],44)
  }
  if $gettok(%PokeDex. [ $+ [ $nick ] ],6,44) != $null {
    set %PartyRand. [ $+ [ $nick ] ] $r(1,493) 
    while $gettok(%pokedex. [ $+ [ $nick ] ],%PartyRand. [ $+ [ $nick ] ],44) { set %PartyRand. [ $+ [ $nick ] ] $r(1,493) }
    Set %Party6. [ $+ [ $nick ] ] $gettok(%pokedex. [ $+ [ $nick ] ],%PartyRand. [ $+ [ $nick ] ],44)
  }
  set %OName. [ $+ [ $nick ] ] $readini(PokeScript.ini,n,TNames,$ini(PokeScript.ini,TNames,$r(1,$ini(PokeScript.ini,TNames,0))))
  set %OType. [ $+ [ $nick ] ] $readini(PokeScript.ini,n,TTypes,$ini(PokeScript.ini,TTypes,$r(1,$ini(PokeScript.ini,TTypes,0))))
  set %OPartyNum. [ $+ [ $nick ] ] $r(1,6)
  Msg $Chan $nick ran into %Otype. [ $+ [ $nick ] ] %Oname. [ $+ [ $nick ] ] $+ , and they wanted to battle! They have %OPartyNum. [ $+ [ $nick ] ] Pokemon.
  set %InBattle. [ $+ [ $nick ] ] True
}

on $*:text:/^[!.]mart$/Si:#PokeScript:{
  if %LoggedIn. [ $+ [ $nick ] ] == $null { 
    notice $nick You need to log in first! 
    halt
  } 
  set %MartItem1 Pokéball,500,0
  set %MartItem2 Great Ball,100000,100000
  set %MartItem3 Ultra Ball,250000,250000
  set %MartItem4 Master Ball,500000,500000
  set %MartItem5 Poké Trainer,1000000,1000000
  set %MartItem6 Jhoto Map,150000,150000
  set %MartItem7 Hoenn Map,250000,250000
  set %MartItem8 Sinnoh Map,350000,350000
  set %MartItem9 Poké Powerup,750000,50000
  set %MartItem10 Poké Pay Day,500000,250000
  set %MasterBall $gettok(%MartItem4,1,44)
  set %PokeBall $gettok(%MartItem1,1,44)
  set %GreatBall $gettok(%MartItem2,1,44)
  set %UltraBall $gettok(%MartItem3,1,44)
  set %SinnohMap $gettok(%MartItem8,1,44)
  set %HoennMap $gettok(%MartItem7,1,44)
  set %JhotoMap $gettok(%MartItem6,1,44)
  if %PokeBall isin %Bag. [ $+ [ $nick ] ] {
    set %Mart1. [ $+ [ $nick ] ] Great Ball,100000
  }
  else {
    set %Mart1. [ $+ [ $nick ] ] Pokéball,500
  }

  if %GreatBall isin %Bag. [ $+ [ $nick ] ] {
    set %Mart1. [ $+ [ $nick ] ] Ultra Ball, 250000
  }
  if %UltraBall isin %Bag. [ $+ [ $nick ] ] {
    set %Mart1. [ $+ [ $nick ] ] Master Ball,500000
  }
  if %MasterBall isin %Bag. [ $+ [ $nick ] ] {
    set %Mart1. [ $+ [ $nick ] ] Sold Out,0
  }
  if %JhotoMap isin %Bag. [ $+ [ $nick ] ] {
    set %Mart2. [ $+ [ $nick ] ] Hoenn Map, 250000
  }
  else {
    set %Mart2. [ $+ [ $nick ] ] Jhoto Map,150000
  }
  if %HoennMap isin %Bag. [ $+ [ $nick ] ] {
    set %Mart2. [ $+ [ $nick ] ] Sinnoh Map,350000
  }
  if %SinnohMap isin %Bag. [ $+ [ $nick ] ] {
    set %Mart2. [ $+ [ $nick ] ] Sold Out,0
  }
  set %poketrainer $gettok(%MartItem5,1,44)
  if %poketrainer isin %Bag. [ $+ [ $nick ] ] {
    set %Mart3. [ $+ [ $nick ] ] Sold Out,0
  }
  else {
    set %Mart3. [ $+ [ $nick ] ] Poké Trainer,1000000
  }
  set %PokePowerup $gettok(%MartItem9,1,44) 
  if %pokepowerup isin %Bag. [ $+ [ $nick ] ] {
    set %Mart4. [ $+ [ $nick ] ] Sold Out,0
  }
  else {
    set %Mart4. [ $+ [ $nick ] ] Poké Powerup,750000
  }
  set %pokepayday $gettok(%MartItem10,1,44)
  if %pokepayday isin %Bag. [ $+ [ $nick ] ] {
    set %Mart5. [ $+ [ $nick ] ] Sold Out,0
  }
  else {
    set %Mart5. [ $+ [ $nick ] ] Poké Pay Day,500000
  }
  notice $nick This is what I have for sale: $&
    [[ 1 ]] $gettok(%Mart1. [ $+ [ $nick ] ],1,44) ( $bytes($gettok(%Mart1. [ $+ [ $nick ] ],2,44),b) PD ) $&
    [[ 2 ]] $gettok(%Mart2. [ $+ [ $nick ] ],1,44) ( $bytes($gettok(%Mart2. [ $+ [ $nick ] ],2,44),b) PD ) $&
    [[ 3 ]] $gettok(%Mart3. [ $+ [ $nick ] ],1,44) ( $bytes($gettok(%Mart3. [ $+ [ $nick ] ],2,44),b) PD ) $&
    [[ 4 ]] $gettok(%Mart4. [ $+ [ $nick ] ],1,44) ( $bytes($gettok(%Mart4. [ $+ [ $nick ] ],2,44),b) PD ) $&
    [[ 5 ]] $gettok(%Mart5. [ $+ [ $nick ] ],1,44) ( $bytes($gettok(%Mart5. [ $+ [ $nick ] ],2,44),b) PD ) $&
    To buy something, type !buy <number> 
}

on $*:text:/^[!.]buy/Si:#PokeScript:{
  if %LoggedIn. [ $+ [ $nick ] ] == $null { 
    notice $nick You need to log in first! 
    halt
  } 
  if %PD. [ $+ [ $nick ] ] < 1 || %PD. [ $+ [ $nick ] ] == $null {
    notice $nick You must have at least one Poké Dollar to buy from the Poké Mart
    halt
  }
  if $2 == $null || $2 > 5 || $2 < 1 {
    notice $nick Please enter a valid store item.
    halt
  }
  var %usingpd. [ $+ [ $nick ] ] %PD. [ $+ [ $nick ] ]
  if %PokeBall isin %Bag. [ $+ [ $nick ] ] { 
    set %Mart1. [ $+ [ $nick ] ] Great Ball,100000,100000
  }
  else {
    set %Mart1. [ $+ [ $nick ] ] Pokéball,500,0
  }
  if %GreatBall isin %Bag. [ $+ [ $nick ] ] {
    set %Mart1. [ $+ [ $nick ] ] Ultra Ball,250000,250000
  }
  if %UltraBall isin %Bag. [ $+ [ $nick ] ] {
    set %Mart1. [ $+ [ $nick ] ] Master Ball,500000,500000
  }
  if %MasterBall isin %Bag. [ $+ [ $nick ] ] {
    set %Mart1. [ $+ [ $nick ] ] Sold Out,0,0
  }
  if %JhotoMap isin %Bag. [ $+ [ $nick ] ] {
    set %Mart2. [ $+ [ $nick ] ] Hoenn Map,250000,250000
  }
  else {
    set %Mart2. [ $+ [ $nick ] ] JhotoMap,150000,150000
  }
  if %HoennMap isin %Bag. [ $+ [ $nick ] ] {
    set %Mart2. [ $+ [ $nick ] ] Sinnoh Map,350000,350000
  }
  if %SinnohMap isin %Bag. [ $+ [ $nick ] ] {
    set %Mart2. [ $+ [ $nick ] ] Sold Out,0,0
  }
  if %poketrainer isin %Bag. [ $+ [ $nick ] ] {
    set %Mart3. [ $+ [ $nick ] ] Sold Out,0,0
  }
  else { 
    set %Mart3. [ $+ [ $nick ] ] Poké Trainer,1000000,1000000
  }
  if %pokepowerup isin %Bag. [ $+ [ $nick ] ] {
    set %Mart4. [ $+ [ $nick ] ] Sold Out,0,0
  }
  else { 
    set %Mart4. [ $+ [ $nick ] ] Poké Powerup,750000,50000
  }
  if %pokepayday isin %Bag. [ $+ [ $nick ] ] {
    set %Mart5. [ $+ [ $nick ] ] Sold Out,0,0
  }
  else {
    set %Mart5. [ $+ [ $nick ] ] Poké Pay Day,500000,250000
  }
  if $gettok(%Mart [ $+ [ $2 [ $+ [ . [ $+ [ $nick ] ] ] ] ] ],1,44) == Sold Out {
    notice $nick You've bought all the available upgrades, I'm sold out!
    halt
  }
  set %Buying1. [ $+ [ $nick ] ] $gettok(%Mart [ $+ [ $2 [ $+ [ . [ $+ [ $nick ] ] ] ] ] ],1,44)
  set %Price. [ $+ [ $nick ] ] $gettok(%Mart [ $+ [ $2 [ $+ [ . [ $+ [ $nick ] ] ] ] ] ],2,44)
  set %NeededExp. [ $+ [ $nick ] ] $gettok(%Mart [ $+ [ $2 [ $+ [ . [ $+ [ $nick ] ] ] ] ] ],3,44)
  if %PD. [ $+ [ $nick ] ] < %Price. [ $+ [ $nick ] ] {
    notice $nick You don't have enough Poké Dollars for that!
    halt 
  }
  if %Exp. [ $+ [ $nick ] ] < %NeededExp. [ $+ [ $nick ] ] || %Exp. [ $+ [ $nick ] ] == $null {
    if %NeededExp. [ $+ [ $nicl ] ] == 0 || %NeededExp. [ $+ [ $nick ] ] == $null {
      halt
    }
    notice $nick You don't have enough EXP for that! You must gain $calc(%NeededExp. [ $+ [ $nick ] ] -%Exp. [ $+ [ $nick ] ]) more EXP.
    halt
  }
  else {
    set %newpd. [ $+ [ $nick ] ] $calc(%PD. [ $+ [ $nick ] ] -%Price. [ $+ [ $nick ] ] )
    set %PD. [ $+ [ $nick ] ] %newpd. [ $+ [ $nick ] ]
    if $gettok(%Mart [ $+ [ $2 [ $+ [ . [ $+ [ $nick ] ] ] ] ] ],1,44) !isin %Bag. [ $+ [ $nick ] ] {
      set %Bag. [ $+ [ $nick ] ] $instok(%Bag. [ $+ [ $nick ] ],$gettok(%Mart [ $+ [ $2 [ $+ [ . [ $+ [ $nick ] ] ] ] ] ],1,44),1,46)
      notice $nick You bought a %Buying1. [ $+ [ $nick ] ] for $num( %Price. [ $+ [ $nick ] ] ) PD! You now have $num( %PD. [ $+ [ $nick ] ] ) $+ .
    }
  }
}

on $*:text:/^[!.]Commands$/Si:#PokeScript:{
  notice $nick My commands are !Catch !Battle !Train !Mart !Buy !Attack !Run !Ball !Pokedex !Checkdex !CatchInfo !Login !Register !Info !Timers !Bag !Money. For more information on each command, type !Info command
}

on $*:text:/^[!.]Info/Si:#PokeScript:{
  notice $nick $readini(PokeScript.ini,info,$2)
}

on $*:text:/^[!.]Register$/Si:#PokeScript:{
  if %address. [ $+ [ $nick ] ] != $null {
    notice $nick You're already registered with PokeScript, please type !login.
  }
  else {
    set %address. [ $+ [ $nick ] ] $address($nick,7)
    set %pd. [ $+ [ $nick ] ] 500
    notice $nick Your nick is now registered with PokeScript with the hostname $address($nick,1) $+ , please type !login to login now.
  }
}

on $*:text:/^[!.]Login$/Si:#PokeScript:{
  if %address. [ $+ [ $nick ] ] == $null {
    notice $nick You must register for PokeScript first, do this by typing !Register.
  }
  if $address($nick,7) == %address. [ $+ [ $nick ] ] {
    set %LoggedIn. [ $+ [ $nick ] ] true
    notice $nick You are now logged in.
  }
  if $address($nick,7) != %address. [ $+ [ $nick ] ] {
    notice $nick Error, invalid address. This nick was registered to %address. [ $+ [ $nick ] ]
    halt
  }
}

on *:part:#PokeScript:{
  set %LoggedIn. [ $+ [ $nick ] ] $null
}

on $*:text:/^[!.]CatchInfo$/Si:#PokeScript:{
  if %LoggedIn. [ $+ [ $nick ] ] == $null { 
    notice $nick You need to log in first! 
    halt
  } 
  if %Encounter. [ $+ [ $nick ] ] == $null {
    notice $nick You're not currently in a Catch Encounter!
    halt
  }
  if %Encounter. [ $+ [ $nick ] ] != $null {
    if %NextTurnHp. [ $+ [ $nick ] ] == $null {
      if %Turn. [ $+ [ $nick ] ] == $null {
        notice $nick You're currently in a Catch Encounter with a wild %Encounter. [ $+ [ $nick ] ] $+ , it has %MaxHpEnemy. [ $+ [ $nick ] ] / %MaxHpEnemy. [ $+ [ $nick ] ] HP remaining and you've yet to complete any turns.
        notice $nick What will you do now? !Attack !Run !Ball
        halt
      }
      if %Turn. [ $+ [ $nick ] ] != $null {
        notice $nick You're currently in a Catch Encounter with a wild %Encounter. [ $+ [ $nick ] ] $+ , it has %MaxHpEnemy. [ $+ [ $nick ] ] / %MaxHpEnemy. [ $+ [ $nick ] ] HP remaining and you've completed %Turn. [ $+ [ $nick ] ] turns.
        notice $nick What will you do now? !Attack !Run !Ball
        halt
      }
    }    
    if %NextTurnHp. [ $+ [ $nick ] ] != $null {
      notice $nick You're currently in a Catch Encounter with a wild %Encounter. [ $+ [ $nick ] ] $+ , it has %NextTurnHp. [ $+ [ $nick ] ] / %MaxHpEnemy. [ $+ [ $nick ] ] HP remaining and you've completed %Turn. [ $+ [ $nick ] ] turns. 
      notice $nick What will you do now? !Attack !Run !Ball
      halt
    }
  }
}

On $*:Text:/^(\`|.|!|@)timers$/Si:#PokeScript: {
  if %LoggedIn. [ $+ [ $nick ] ] == $null { 
    notice $nick You need to log in first! 
    halt
  } 
  else {
  $iif(@* iswm $1,msg #,notice $nick) Timers for PokeScript are: [!.]Encounter: [ %EncTimer. [ $+ [ $nick ] ] ] %secs [!.]Train: [ %TrainTimer. [ $+ [ $nick ] ] ] %secs }
}

on $*:text:/^[!.]Pokedex$/Si:#PokeScript:{
  if %LoggedIn. [ $+ [ $nick ] ] == $null { 
    notice $nick You need to log in first! 
    halt
  } 
  if %TotalCaught. [ $+ [ $nick ] ] > 50 {
    notice $nick You've caught %TotalCaught. [ $+ [ $nick ] ] pokémon, which is more that I can list at once. To see individual data for a Pokémon, type !checkdex <pokemon>.
    halt
  }  
  var %DexList. [ $+ [ $nick ] ] %PokeDex. [ $+ [ $nick ] ]
  var %DexSort. [ $+ [ $nick ] ] $sorttok(%DexList. [ $+ [ $nick ] ],46,a)
  var %loop = 1
  while %loop < $gettok(%DexList. [ $+ [ $nick ] ],0,46) {
    var %PokeDex. [ $+ [ $nick ] ] $instok(%PokeDex. [ $+ [ $nick ] ],$wildtok(%DexSort. [ $+ [ $nick ] ],$gettok(%DexSort. [ $+ [ $nick ] ],%loop,46),0,46),%loop,46)
    inc %loop
  }
  notice $nick You've caught: $replace(%DexSort. [ $+ [ $nick ] ],$chr(46),$+($chr(44),$chr(32))) to see individual data for a pokemon, type !checkdex <pokemon>.
}

on $*:text:/^[!.]checkdex/Si:#PokeScript:{
  if %LoggedIn. [ $+ [ $nick ] ] == $null { 
    notice $nick You need to log in first! 
    halt
  } 
  if %PokeDex. [ $+ [ $nick ] ] == $null {
    notice $nick You've never caught any pokemon, you have no entries to check. Try !catch to start!
    halt 
  }
  if $2 !isin %PokeDex. [ $+ [ $nick ] ] {
    notice $nick You haven't caught this pokemon yet, you can't check its info until you catch it!
    halt
  }
  if $2 isin %PokeDex. [ $+ [ $nick ] ] {
    notice $nick Pokedex data for $2 $+ : $readini(PokeScript.ini,pokedex,$2)
  }
}

on $*:text:/^[!.]Bag$/Si:#PokeScript:{
  if %LoggedIn. [ $+ [ $nick ] ] == $null { 
    notice $nick You need to log in first! 
    halt
  } 
  var %BagList. [ $+ [ $nick ] ] %Bag. [ $+ [ $nick ] ]
  var %BagSort. [ $+ [ $nick ] ] $sorttok(%BagList. [ $+ [ $nick ] ],46,a)
  var %Loop = 1
  while %Loop < $gettok(%BagList. [ $+ [ $nick ] ],0,46) {
    var %Bag. [ $+ [ $nick ] ] $instok(%Bag. [ $+ [ $nick ] ],$wildtok(%BagSort. [ $+ [ $nick ] ],$gettok(%BagSort. [ $+ [ $nick ] ],%Loop,46),0,46),%Loop,46)
    inc %Loop
  }
  notice $nick Your bag contains: $replace(%BagSort. [ $+ [ $nick ] ],$chr(46),$+($chr(44),$chr(32)))
  unset %Bag. [ $+ [ $nick ] ]
}

on $*:text:/^[!.]Money/Si:#PokeScript:{
  if !$2 {
    if %PD. [ $+ [ $nick ] ] == $null {
      notice $nick You don't have any Poké Dollars. :( Earn some by doing !Challenge
    }
    else {
      notice $nick You have $bytes( %PD. [ $+ [ $nick ] ],b) Poké dollars
    }
  }
  elseif %PD. [ $+ [ $2 ] ] {
    notice $nick [[ $2 ]] $+ : $bytes( %PD. [ $+ [ $2 ] ],b) Poké dollars
  }
  else notice $nick That player is not in my system.
}

alias num { return $bytes($1-,db) }

on $*:Text:/^[!.]Attack$/Si:#PokeScript:{
  if %LoggedIn. [ $+ [ $nick ] ] == $null { 
    notice $nick You need to log in first! 
    halt
  } 
  if %Encounter. [ $+ [ $nick ] ] == $null {
    notice $nick You're not currently in an encounter!
    halt 
  }
  if %Turn. [ $+ [ $nick ] ] == %FleeTurns. [ $+ [ $nick ] ] {
    msg # Oh no! The wild %Encounter. [ $+ [ $nick ] ] fled!
    unset %Turn. [ $+ [ $nick ] ]
    unset %Encounter. [ $+ [ $nick ] ]
    halt
  }
  set %Greatluck. [ $+ [ $nick ] ] $r(1,100)
  var %AtkBonus $gettok(%MartItem9,1,44)
  if %AtkBonus isin %Bag. [ $+ [ $nick ] ] {
    if (%Turn. [ $+ [ $nick ] ] == $null) {
      var %AtkValue. [ $+ [ $nick ] ] $r(50,100)
      var %AtkPower. [ $+ [ $nick ] ] $r(75,125)
      var %Damage. [ $+ [ $nick ] ] $calc( %AtkPower. [ $+ [ $nick ] ] +%AtkValue. [ $+ [ $nick ] ] )
      var %DmgDone1. [ $+ [ $nick ] ] $calc(%MaxHpEnemy. [ $+ [ $nick ] ] -%Damage. [ $+ [ $nick ] ] )
      var %NewHp. [ $+ [ $nick ] ] $calc(%MaxHpEnemy. [ $+ [ $nick ] ] - %DmgDone1. [ $+ [ $nick ] ] ) 
      var %LeftOverHp. [ $+ [ $nick ] ] $calc(%MaxHpEnemy. [ $+ [ $nick ] ] - (%AtkValue. [ $+ [ $nick ] ] +%AtkPower. [ $+ [ $nick ] ] ))
      var %LeftOverHp2. [ $+ [ $nick ] ] $calc(%MaxHpEnemy. [ $+ [ $nick ] ] - (%AtkValue. [ $+ [ $nick ] ] +%AtkPower. [ $+ [ $nick ] ] ))
      inc %Turn. [ $+ [ $nick ] ]
      if %PokeDex. [ $+ [ $nick ] ] == $null {
        if %LeftOverHp. [ $+ [ $nick ] ] < 0 {
          var %TrainBonus. [ $+ [ $nick ] ] = $gettok(%MartItem5,1,44)
          if %TrainBonus. [ $+ [ $nick ] ] isin %Bag. [ $+ [ $nick ] ] {
            var %ExpValue $calc($r(100,10000) * 1.3)
            msg # $nick attacks the wild %Encounter. [ $+ [ $nick ] ] $+ , causing %Damage. [ $+ [ $nick ] ] damage, accidentally killing it, earning %ExpValue. [ $+ [ $nick ] ] $+ .
            if (%Greatluck. [ $+ [ $nick ] ] > 75) { 
              notice $nick Lucky you! The wild %Encounter. [ $+ [ $nick ] ] dropped a $readini(PokeItems.ini,n,items,$ini(PokeItems.ini,items,$r(1,$ini(PokeItems.ini,items,0))))           
            }
            halt 
          }
          else {
            var %ExpValue. [ $+ [ $nick ] ] $r(100,10000) 
            msg # $nick attacks the wild %Encounter. [ $+ [ $nick ] ] $+ , causing %Damage. [ $+ [ $nick ] ] damage, accidentally killing it, earning %ExpValue. [ $+ [ $nick ] ] $+ .
            if (%Greatluck. [ $+ [ $nick ] ] > 75) { 
              notice $nick Lucky you! The wild %Encounter. [ $+ [ $nick ] ] dropped a $readini(PokeItems.ini,n,items,$ini(PokeItems.ini,items,$r(1,$ini(PokeItems.ini,items,0))))           
            }
            unset %Encounter. [ $+ [ $nick ] ]
            unset %Turn. [ $+ [ $nick ] ]
          }
        }
        else {
          msg # $nick attacked the wild %Encounter. [ $+ [ $nick ] ] and did %Damage. [ $+ [ $nick ] ] damage, having used the Poké Powerup to do some extra damage!
          notice $nick What will you do now? !Attack !Ball !Run (Enemy HP: %LeftOverHp. [ $+ [ $nick ] ] / %MaxHpEnemy. [ $+ [ $nick ] ] $+ )
          set %NextTurnHp. [ $+ [ $nick ] ] %LeftOverHp. [ $+ [ $nick ] ]
          halt
        }
      }
      if %PokeDex. [ $+ [ $nick ] ] != $null {
        set %party. [ $+ [ $nick ] ] $r(1,%TotalCaught. [ $+ [ $nick ] ])
        set %move. [ $+ [ $nick ] ] $readini(PokeScript.ini,n,attacks,$ini(PokeScript.ini,attacks,$r(1,$ini(PokeScript.ini,attacks,0))))
        if %LeftOverHp. [ $+ [ $nick ] ] < 0 {
          var %TrainBonus. [ $+ [ $nick ] ] = $gettok(%MartItem5,1,44)
          if %TrainBonus. [ $+ [ $nick ] ] isin %Bag. [ $+ [ $nick ] ] {
            var %ExpValue $calc($r(100,10000) * 1.3)
            msg # $nick sent out $gettok(%PokeDex. [ $+ [ $nick ] ],%party. [ $+ [ $nick ] ],44) and attacked the wild %Encounter. [ $+ [ $nick ] ] using %move. [ $+ [ $nick ] ] and did %Damage. [ $+ [ $nick ] ] damage, accidentally killing it! 
            unset %Encounter. [ $+ [ $nick ] ]
            unset %Turn. [ $+ [ $nick ] ]       
            halt
          }
          else {
            var %ExpValue $calc($r(100,10000) * 1.3)
            msg # $nick sent out $gettok(%PokeDex. [ $+ [ $nick ] ],%party. [ $+ [ $nick ] ],44) and attacked the wild %Encounter. [ $+ [ $nick ] ] using %move. [ $+ [ $nick ] ] and did %Damage. [ $+ [ $nick ] ] damage, accidentally killing it! 
            unset %Encounter. [ $+ [ $nick ] ]
            unset %Encounter. [ $+ [ $nick ] ]
            unset %Turn. [ $+ [ $nick ] ]       
            halt
          }
          unset %Encounter. [ $+ [ $nick ] ]
          unset %Turn. [ $+ [ $nick ] ]
        }
        else {
          set %move. [ $+ [ $nick ] ] $readini(PokeScript.ini,n,attacks,$ini(PokeScript.ini,attacks,$r(1,$ini(PokeScript.ini,attacks,0))))
          set %party. [ $+ [ $nick ] ] $r(1,%TotalCaught. [ $+ [ $nick ] ])
          msg # $nick sent out $gettok(%PokeDex. [ $+ [ $nick ] ],%party. [ $+ [ $nick ] ],44) and attacked the wild %Encounter. [ $+ [ $nick ] ] using %move. [ $+ [ $nick ] ] $+ . This did %Damage. [ $+ [ $nick ] ] damage, with the added bonus of the Poké Powerup!
          notice $nick What will you do now? !Attack !Ball !Run (Enemy HP: %LeftOverHp. [ $+ [ $nick ] ] / %MaxHpEnemy. [ $+ [ $nick ] ] $+ )
          set %NextTurnHp. [ $+ [ $nick ] ] %LeftOverHp. [ $+ [ $nick ] ]
          halt
        }
      }
    }
  } 
  var %AtkBonus $gettok(%MartItem9,1,44)
  if %AtkBonus isin %Bag. [ $+ [ $nick ] ] {
    if (%Turn. [ $+ [ $nick ] ] != $null ) {
      var %AtkValue. [ $+ [ $nick ] ] $r(50,100)
      var %AtkPower. [ $+ [ $nick ] ] $r(75,125)
      var %Damage. [ $+ [ $nick ] ] $calc( %AtkPower. [ $+ [ $nick ] ] +%AtkValue. [ $+ [ $nick ] ] )
      var %DmgDone2. [ $+ [ $nick ] ] $calc(%NextTurnHp. [ $+ [ $nick ] ] -%Damage. [ $+ [ $nick ] ] )
      var %NewHp. [ $+ [ $nick ] ] $calc(%NextTurnHp. [ $+ [ $nick ] ] - %DmgDone1. [ $+ [ $nick ] ] ) 
      var %LeftOverHp. [ $+ [ $nick ] ] $calc(%NextTurnHp. [ $+ [ $nick ] ] - (%AtkValue. [ $+ [ $nick ] ] +%AtkPower. [ $+ [ $nick ] ] ))
      var %LeftOverHp2. [ $+ [ $nick ] ] $calc(%LeftOverHp. [ $+ [ $nick ] ] - (%AtkValue. [ $+ [ $nick ] ] +%AtkPower. [ $+ [ $nick ] ] ))
      inc %Turn. [ $+ [ $nick ] ]
      if %PokeDex. [ $+ [ $nick ] ] == $null {
        if %LeftOverHp. [ $+ [ $nick ] ] < 0 {
          var %TrainBonus. [ $+ [ $nick ] ] = $gettok(%MartItem5,1,44)
          if %TrainBonus. [ $+ [ $nick ] ] isin %Bag. [ $+ [ $nick ] ] {
            var %ExpValue $calc($r(100,10000) * 1.3)
            msg # $nick attacks the wild %Encounter. [ $+ [ $nick ] ] $+ , causing %Damage. [ $+ [ $nick ] ] damage, accidentally killing it, earning %ExpValue. [ $+ [ $nick ] ] $+ .
            inc [ %EXP. [ $+ [ $nick ] ] ] %EXPValue
            if (%Greatluck. [ $+ [ $nick ] ]. [ $+ [ $nick ] ] > 75) { 
              notice $nick Lucky you! The wild %Encounter. [ $+ [ $nick ] ] dropped a $readini(PokeItems.ini,n,items,$ini(PokeItems.ini,items,$r(1,$ini(PokeItems.ini,items,0))))           
            }
            halt 
          }
          else {
            var %ExpValue. [ $+ [ $nick ] ] $r(100,10000) 
            msg # $nick attacks the wild %Encounter. [ $+ [ $nick ] ] $+ , causing %Damage. [ $+ [ $nick ] ] damage, accidentally killing it, earning %ExpValue. [ $+ [ $nick ] ] $+ .
            inc [ %EXP. [ $+ [ $nick ] ] ] %EXPValue
            if (%Greatluck. [ $+ [ $nick ] ]. [ $+ [ $nick ] ] > 75) { 
              notice $nick Lucky you! The wild %Encounter. [ $+ [ $nick ] ] dropped a $readini(PokeItems.ini,n,items,$ini(PokeItems.ini,items,$r(1,$ini(PokeItems.ini,items,0))))           
            }           
            unset %Encounter. [ $+ [ $nick ] ]
            unset %Turn. [ $+ [ $nick ] ]
          }
        }
        else {
          msg # $nick attacked the wild %Encounter. [ $+ [ $nick ] ] and did %Damage. [ $+ [ $nick ] ] damage, having used the Poké Powerup to do some extra damage!
          notice $nick What will you do now? !Attack !Ball !Run (Enemy HP: %LeftOverHp. [ $+ [ $nick ] ] / %MaxHpEnemy. [ $+ [ $nick ] ] $+ )
          set %NextTurnHp. [ $+ [ $nick ] ] %LeftOverHp. [ $+ [ $nick ] ]
          halt
        }
      }
    }
    if %PokeDex. [ $+ [ $nick ] ] != $null {
      set %party. [ $+ [ $nick ] ] $r(1,%TotalCaught. [ $+ [ $nick ] ])
      set %move. [ $+ [ $nick ] ] $readini(PokeScript.ini,n,attacks,$ini(PokeScript.ini,attacks,$r(1,$ini(PokeScript.ini,attacks,0))))
      if %LeftOverHp. [ $+ [ $nick ] ] < 0 {
        var %TrainBonus. [ $+ [ $nick ] ] = $gettok(%MartItem5,1,44)
        if %TrainBonus. [ $+ [ $nick ] ] isin %Bag. [ $+ [ $nick ] ] {
          var %ExpValue $calc($r(100,10000) * 1.3)
          msg # $nick sent out $gettok(%PokeDex. [ $+ [ $nick ] ],%party. [ $+ [ $nick ] ],44) and attacked the wild %Encounter. [ $+ [ $nick ] ] using %move. [ $+ [ $nick ] ] and did %Damage. [ $+ [ $nick ] ] damage, accidentally killing it! 
          unset %Encounter. [ $+ [ $nick ] ]
          unset %Turn. [ $+ [ $nick ] ]       
          halt
        }
        else {
          var %ExpValue $calc($r(100,10000) * 1.3)
          msg # $nick sent out $gettok(%PokeDex. [ $+ [ $nick ] ],%party. [ $+ [ $nick ] ],44) and attacked the wild %Encounter. [ $+ [ $nick ] ] using %move. [ $+ [ $nick ] ] and did %Damage. [ $+ [ $nick ] ] damage, accidentally killing it! 
          unset %Encounter. [ $+ [ $nick ] ]
          unset %Encounter. [ $+ [ $nick ] ]
          unset %Turn. [ $+ [ $nick ] ]       
          halt
        }
        unset %Encounter. [ $+ [ $nick ] ]
        unset %Turn. [ $+ [ $nick ] ]
      }
      else {
        msg # $nick sent out $gettok(%PokeDex. [ $+ [ $nick ] ],%party. [ $+ [ $nick ] ],44) and attacked the wild %Encounter. [ $+ [ $nick ] ] using %move. [ $+ [ $nick ] ] $+ . This did %Damage. [ $+ [ $nick ] ] damage, with the added bonus of the Poké Powerup!
        notice $nick What will you do now? !Attack !Ball !Run (Enemy HP: %LeftOverHp. [ $+ [ $nick ] ] / %MaxHpEnemy. [ $+ [ $nick ] ] $+ )
        set %NextTurnHp. [ $+ [ $nick ] ] %LeftOverHp. [ $+ [ $nick ] ]
        halt
      }
    }
  }
  var %AtkBonus $gettok(%MartItem9,1,44)
  if %AtkBonus !isin %Bag. [ $+ [ $nick ] ] {
    if %Turn. [ $+ [ $nick ] ] == $null {
      var %AtkPower. [ $+ [ $nick ] ] $r(75,125)
      var %Damage. [ $+ [ $nick ] ] %AtkPower. [ $+ [ $nick ] ]
      var %DmgDone1. [ $+ [ $nick ] ] $calc(%MaxHpEnemy. [ $+ [ $nick ] ] -%Damage. [ $+ [ $nick ] ] )
      var %NewHp. [ $+ [ $nick ] ] $calc(%MaxHpEnemy. [ $+ [ $nick ] ] -%DmgDone1. [ $+ [ $nick ] ] ) 
      var %LeftOverHp. [ $+ [ $nick ] ] $calc(%MaxHpEnemy. [ $+ [ $nick ] ] -%AtkPower. [ $+ [ $nick ] ] )
      var %LeftOverHp2. [ $+ [ $nick ] ] $calc(%MaxHpEnemy. [ $+ [ $nick ] ] -%AtkPower. [ $+ [ $nick ] ] )
      inc %Turn. [ $+ [ $nick ] ]
      if %PokeDex. [ $+ [ $nick ] ] == $null {
        if %LeftOverHp. [ $+ [ $nick ] ] < 0 {
          var %TrainBonus. [ $+ [ $nick ] ] = $gettok(%MartItem5,1,44)
          if %TrainBonus. [ $+ [ $nick ] ] isin %Bag. [ $+ [ $nick ] ] {
            var %ExpValue $calc($r(100,10000) * 1.3)
            msg # $nick attacks the wild %Encounter. [ $+ [ $nick ] ] $+ , causing %Damage. [ $+ [ $nick ] ] damage, accidentally killing it, earning %ExpValue. [ $+ [ $nick ] ] $+ .
            inc [ %EXP. [ $+ [ $nick ] ] ] %EXPValue
            if (%Greatluck. [ $+ [ $nick ] ]. [ $+ [ $nick ] ] > 75) { 
              notice $nick Lucky you! The wild %Encounter. [ $+ [ $nick ] ] dropped a $readini(PokeItems.ini,n,items,$ini(PokeItems.ini,items,$r(1,$ini(PokeItems.ini,items,0))))           
            }
            halt 
          }
          else {
            var %ExpValue. [ $+ [ $nick ] ] $r(100,10000) 
            msg # $nick attacks the wild %Encounter. [ $+ [ $nick ] ] $+ , causing %Damage. [ $+ [ $nick ] ] damage, accidentally killing it, earning %ExpValue. [ $+ [ $nick ] ] $+ .
            inc [ %EXP. [ $+ [ $nick ] ] ] %EXPValue
            if (%Greatluck. [ $+ [ $nick ] ]. [ $+ [ $nick ] ] > 75) { 
              notice $nick Lucky you! The wild %Encounter. [ $+ [ $nick ] ] dropped a $readini(PokeItems.ini,n,items,$ini(PokeItems.ini,items,$r(1,$ini(PokeItems.ini,items,0))))           
            }
            unset %Encounter. [ $+ [ $nick ] ]
            unset %Turn. [ $+ [ $nick ] ]
          }
        }
        else {
          msg # $nick attacked the wild %Encounter. [ $+ [ $nick ] ] and did %Damage. [ $+ [ $nick ] ] damage!
          notice $nick What will you do now? !Attack !Ball !Run (Enemy HP: %LeftOverHp. [ $+ [ $nick ] ] / %MaxHpEnemy. [ $+ [ $nick ] ] $+ )
          set %NextTurnHp. [ $+ [ $nick ] ] %LeftOverHp. [ $+ [ $nick ] ]
          halt
        }
      }
      if %PokeDex. [ $+ [ $nick ] ] != $null {
        set %party. [ $+ [ $nick ] ] $r(1,%TotalCaught. [ $+ [ $nick ] ])
        set %move. [ $+ [ $nick ] ] $readini(PokeScript.ini,n,attacks,$ini(PokeScript.ini,attacks,$r(1,$ini(PokeScript.ini,attacks,0))))
        if %LeftOverHp. [ $+ [ $nick ] ] < 0 {
          var %TrainBonus. [ $+ [ $nick ] ] = $gettok(%MartItem5,1,44)
          if %TrainBonus. [ $+ [ $nick ] ] isin %Bag. [ $+ [ $nick ] ] {
            var %ExpValue $calc($r(100,10000) * 1.3)
            msg # $nick sent out $gettok(%PokeDex. [ $+ [ $nick ] ],%party. [ $+ [ $nick ] ],44) and attacked the wild %Encounter. [ $+ [ $nick ] ] using %move. [ $+ [ $nick ] ] and did %Damage. [ $+ [ $nick ] ] damage, accidentally killing it! 
            unset %Encounter. [ $+ [ $nick ] ]
            unset %Turn. [ $+ [ $nick ] ]       
            halt
          }
          else {
            var %ExpValue $calc($r(100,10000) * 1.3)
            msg # $nick sent out $gettok(%PokeDex. [ $+ [ $nick ] ],%party. [ $+ [ $nick ] ],44) and attacked the wild %Encounter. [ $+ [ $nick ] ] using %move. [ $+ [ $nick ] ] and did %Damage. [ $+ [ $nick ] ] damage, accidentally killing it! 
            unset %Encounter. [ $+ [ $nick ] ]
            unset %Encounter. [ $+ [ $nick ] ]
            unset %Turn. [ $+ [ $nick ] ]       
            halt
          }
          unset %Encounter. [ $+ [ $nick ] ]
          unset %Turn. [ $+ [ $nick ] ]
        }
        else {
          msg # $nick sent out $gettok(%PokeDex. [ $+ [ $nick ] ],%party. [ $+ [ $nick ] ],44) and attacked the wild %Encounter. [ $+ [ $nick ] ] using %move. [ $+ [ $nick ] ] $+ . This did %Damage. [ $+ [ $nick ] ] damage.
          notice $nick What will you do now? !Attack !Ball !Run (Enemy HP: %LeftOverHp. [ $+ [ $nick ] ] / %MaxHpEnemy. [ $+ [ $nick ] ] $+ )
          set %NextTurnHp. [ $+ [ $nick ] ] %LeftOverHp. [ $+ [ $nick ] ]
          halt
        }
      } 
    }
  }
  var %AtkBonus $gettok(%MartItem9,1,44)
  if %AtkBonus !isin %Bag. [ $+ [ $nick ] ] {
    if (%Turn. [ $+ [ $nick ] ] != $null ) {
      var %AtkPower. [ $+ [ $nick ] ] $r(75,125)
      var %Damage. [ $+ [ $nick ] ] %AtkPower. [ $+ [ $nick ] ] 
      var %DmgDone1. [ $+ [ $nick ] ] $calc(%NextTurnHp. [ $+ [ $nick ] ] -%Damage. [ $+ [ $nick ] ] )
      var %NewHp. [ $+ [ $nick ] ] $calc(%NextTurnHp. [ $+ [ $nick ] ] - %DmgDone1. [ $+ [ $nick ] ] ) 
      var %LeftOverHp. [ $+ [ $nick ] ] $calc(%NextTurnHp. [ $+ [ $nick ] ] -%AtkPower. [ $+ [ $nick ] ] )
      var %LeftOverHp2. [ $+ [ $nick ] ] $calc(%LeftOverHp. [ $+ [ $nick ] ] -%AtkPower. [ $+ [ $nick ] ] ))
      inc %Turn. [ $+ [ $nick ] ]
      if %PokeDex. [ $+ [ $nick ] ] == $null {
        if %LeftOverHp. [ $+ [ $nick ] ] < 0 {
          var %TrainBonus. [ $+ [ $nick ] ] = $gettok(%MartItem5,1,44)
          if %TrainBonus. [ $+ [ $nick ] ] isin %Bag. [ $+ [ $nick ] ] {
            var %ExpValue $calc($r(100,10000) * 1.3)
            msg # $nick attacks the wild %Encounter. [ $+ [ $nick ] ] $+ , causing %Damage. [ $+ [ $nick ] ] damage, accidentally killing it, earning %ExpValue. [ $+ [ $nick ] ] $+ .
            inc [ %EXP. [ $+ [ $nick ] ] ] %EXPValue
            if (%Greatluck. [ $+ [ $nick ] ] > 75) { 
              notice $nick Lucky you! The wild %Encounter. [ $+ [ $nick ] ] dropped a $readini(PokeItems.ini,n,items,$ini(PokeItems.ini,items,$r(1,$ini(PokeItems.ini,items,0))))           
            }
            halt 
          }
          else {
            var %ExpValue. [ $+ [ $nick ] ] $r(100,10000) 
            msg # $nick attacks the wild %Encounter. [ $+ [ $nick ] ] $+ , causing %Damage. [ $+ [ $nick ] ] damage, accidentally killing it, earning %ExpValue. [ $+ [ $nick ] ] $+ .
            inc [ %EXP. [ $+ [ $nick ] ] ] %EXPValue
            if (%Greatluck. [ $+ [ $nick ] ] > 75) { 
              notice $nick Lucky you! The wild %Encounter. [ $+ [ $nick ] ] dropped a $readini(PokeItems.ini,n,items,$ini(PokeItems.ini,items,$r(1,$ini(PokeItems.ini,items,0))))           
            }
            unset %Encounter. [ $+ [ $nick ] ]
            unset %Turn. [ $+ [ $nick ] ]
          }
        }
        else {
          msg # $nick attacked the wild %Encounter. [ $+ [ $nick ] ] and did %Damage. [ $+ [ $nick ] ] damage!
          notice $nick What will you do now? !Attack !Ball !Run (Enemy HP: %LeftOverHp. [ $+ [ $nick ] ] / %MaxHpEnemy. [ $+ [ $nick ] ] $+ )
          set %NextTurnHp. [ $+ [ $nick ] ] %LeftOverHp. [ $+ [ $nick ] ]
          halt
        }
      }
      if %PokeDex. [ $+ [ $nick ] ] != $null {
        set %party. [ $+ [ $nick ] ] $r(1,%TotalCaught. [ $+ [ $nick ] ])
        set %move. [ $+ [ $nick ] ] $readini(PokeScript.ini,n,attacks,$ini(PokeScript.ini,attacks,$r(1,$ini(PokeScript.ini,attacks,0))))
        if %LeftOverHp. [ $+ [ $nick ] ] < 0 {
          var %TrainBonus. [ $+ [ $nick ] ] = $gettok(%MartItem5,1,44)
          if %TrainBonus. [ $+ [ $nick ] ] isin %Bag. [ $+ [ $nick ] ] {
            var %ExpValue $calc($r(100,10000) * 1.3)
            msg # $nick sent out $gettok(%PokeDex. [ $+ [ $nick ] ],%party. [ $+ [ $nick ] ],44) and attacked the wild %Encounter. [ $+ [ $nick ] ] using %move. [ $+ [ $nick ] ] and did %Damage. [ $+ [ $nick ] ] damage, accidentally killing it! 
            unset %Encounter. [ $+ [ $nick ] ]
            unset %Turn. [ $+ [ $nick ] ]       
            halt
          }
          else {
            var %ExpValue $calc($r(100,10000) * 1.3)
            msg # $nick sent out $gettok(%PokeDex. [ $+ [ $nick ] ],%party. [ $+ [ $nick ] ],44) and attacked the wild %Encounter. [ $+ [ $nick ] ] using %move. [ $+ [ $nick ] ] and did %Damage. [ $+ [ $nick ] ] damage, accidentally killing it! 
            unset %Encounter. [ $+ [ $nick ] ]
            unset %Encounter. [ $+ [ $nick ] ]
            unset %Turn. [ $+ [ $nick ] ]       
            halt
          }
          unset %Encounter. [ $+ [ $nick ] ]
          unset %Turn. [ $+ [ $nick ] ]
        }
        else {
          msg # $nick sent out $gettok(%PokeDex. [ $+ [ $nick ] ],%party. [ $+ [ $nick ] ],44) and attacked the wild %Encounter. [ $+ [ $nick ] ] using %move. [ $+ [ $nick ] ] $+ . This did %Damage. [ $+ [ $nick ] ] damage.
          notice $nick What will you do now? !Attack !Ball !Run (Enemy HP: %LeftOverHp. [ $+ [ $nick ] ] / %MaxHpEnemy. [ $+ [ $nick ] ] $+ )
          set %NextTurnHp. [ $+ [ $nick ] ] %LeftOverHp. [ $+ [ $nick ] ]
          halt
        }
      }
    }
  }
}

on $*:text:/^[!.]Run$/si:#PokeScript:{
  if %LoggedIn. [ $+ [ $nick ] ] == $null { 
    notice $nick You need to log in first! 
    halt
  } 
  if %Turn. [ $+ [ $nick ] ] == %FleeTurns. [ $+ [ $nick ] ] {
    msg # Oh no! The wild %Encounter. [ $+ [ $nick ] ] fled!
    unset %NeededRun. [ $+ [ $nick ] ]
    unset %Run. [ $+ [ $nick ] ]
    unset %Turn. [ $+ [ $nick ] ]
    unset %Encounter. [ $+ [ $nick ] ]
  }
  if %Encounter. [ $+ [ $nick ] ] == $null {
    notice $nick You're not currently in a Catch Encounter!
    halt
  }
  var %NeededRun. [ $+ [ $nick ] ] $r(50,100)
  var %Run. [ $+ [ $nick ] ] $r(50,100)
  if %Run. [ $+ [ $nick ] ] < %NeededRun. [ $+ [ $nick ] ] {
    inc %Turn. [ $+ [ $nick ] ]
    msg # $nick tried to run away but the wild %Encounter. [ $+ [ $nick ] ] stopped them!
    unset %Run. [ $+ [ $nick ] ]
    unset %NeededRun. [ $+ [ $nick ] ] 
  }
  if %Run. [ $+ [ $nick ] ] > %NeededRun. [ $+ [ $nick ] ] {
    inc %Turn. [ $+ [ $nick ] ]
    msg # $nick got scared and ran away from the wild %Encounter. [ $+ [ $nick ] ] $+ !
    unset %Run. [ $+ [ $nick ] ]
    unset %NeededRun. [ $+ [ $nick ] ]
    unset %Turn. [ $+ [ $nick ] ]
    unset %Encounter. [ $+ [ $nick ] ]
  }
}

on $*:text:/^[!.]Ball$/si:#PokeScript:{
  if %LoggedIn. [ $+ [ $nick ] ] == $null { 
    notice $nick You need to log in first! 
    halt
  } 
  if %PokeBall !isin %Bag. [ $+ [ $nick ] ] {
    notice $nick You need a PokeBall to catch Pokemon!
    halt
  }
  if %Turn. [ $+ [ $nick ] ] == %FleeTurns. [ $+ [ $nick ] ] {
    msg # Oh no! The wild %Encounter. [ $+ [ $nick ] ] fled!
    unset %NeededRun. [ $+ [ $nick ] ]
    unset %Run. [ $+ [ $nick ] ]
    unset %Turn. [ $+ [ $nick ] ]
    unset %Encounter. [ $+ [ $nick ] ]
    halt
  }
  if %Encounter. [ $+ [ $nick ] ] == $null {
    notice $nick You're not currently in a Catch Encounter!
    halt
  }
  if %Turn. [ $+ [ $nick ] ] == $null {
    if %NextTurnHp. [ $+ [ $nick ] ] == $null {
      notice $nick You have to attack first.
    }
  }
  if %PokeBall isin %Bag. [ $+ [ $nick ] ] {
    set %ballmod. [ $+ [ $nick ] ] 1
    set %MaxBall. [ $+ [ $nick ] ] Pokéball
  }
  if %GreatBall isin %Bag. [ $+ [ $nick ] ] {
    set %ballmod. [ $+ [ $nick ] ] 1.5
    set %MaxBall. [ $+ [ $nick ] ] Great Ball
  }
  if %UltraBall isin %Bag. [ $+ [ $nick ] ] {
    set %ballmod. [ $+ [ $nick ] ] 2
    set %MaxBall. [ $+ [ $nick ] ] Ultra Ball
  }
  if %MasterBall isin %Bag. [ $+ [ $nick ] ] {
    set %ballmod. [ $+ [ $nick ] ] 4
    set %MaxBall. [ $+ [ $nick ] ] Master Ball
  }
  var %CatchRate. [ $+ [ $nick ] ] $r(1,255)
  var %CatchVal1. [ $+ [ $nick ] ] $calc((3 *%MaxHpEnemy. [ $+ [ $nick ] ] ) - ( 2 *%NextTurnHp. [ $+ [ $nick ] ] ))
  var %CatchVal2. [ $+ [ $nick ] ] $calc((%CatchRate. [ $+ [ $nick ] ] *%ballmod. [ $+ [ $nick ] ] )) 
  var %CatchVal3. [ $+ [ $nick ] ]  $calc( 3 *%MaxHpEnemy. [ $+ [ $nick ] ] )
  var %CatchValue. [ $+ [ $nick ] ] $calc((%CatchVal1. [ $+ [ $nick ] ] *%CatchVal2. [ $+ [ $nick ] ] )/%CatchVal3. [ $+ [ $nick ] ] )
  set %Hundo. [ $+ [ $nick ] ] 16711680
  set %Hundo1. [ $+ [ $nick ] ] $calc(%Hundo. [ $+ [ $nick ] ] /%CatchValue. [ $+ [ $nick ] ] )
  var %CatchPt1. [ $+ [ $nick ] ] $calc($sqrt(%Hundo1. [ $+ [ $nick ] ] ))
  var %CatchPt2. [ $+ [ $nick ] ] $calc($sqrt(%CatchPt1. [ $+ [ $nick ] ] ))
  set %Hundo2. [ $+ [ $nick ] ] 1048560 
  var %CatchPt3. [ $+ [ $nick ] ] $calc((%Hundo2. [ $+ [ $nick ] ] /%CatchPt2. [ $+ [ $nick ] ] ))
  set %catch. [ $+ [ $nick ] ] %CatchPt3. [ $+ [ $nick ] ]
  if (%CatchRate. [ $+ [ $nick ] ] < 255) {
    set %Shake1. [ $+ [ $nick ] ] $r(1,90000)
    if %Shake1. [ $+ [ $nick ] ] > %CatchPt3. [ $+ [ $nick ] ] {
      msg # $nick throws their %MaxBall. [ $+ [ $nick ] ] at the wild %Encounter. [ $+ [ $nick ] ] $+ , but the ball doesn't even shake once and the %Encounter. [ $+ [ $nick ] ] breaks free!
      notice $nick what will you do now? !Attack !Run !Ball
      inc %Turn. [ $+ [ $nick ] ]
      halt
    } 
    if %Shake1. [ $+ [ $nick ] ] < %CatchPt3. [ $+ [ $nick ] ] {
      set %Shake2. [ $+ [ $nick ] ] $r(1,90000)
      if %Shake2. [ $+ [ $nick ] ] > %CatchPt3. [ $+ [ $nick ] ] {
        msg # $nick throws their %MaxBall. [ $+ [ $nick ] ] at the wild %Encounter. [ $+ [ $nick ] ] $+ , and the ball shakes once, but the pokemon breaks free!
        notice $nick What will you do now? !Attack !Run !Ball
        inc %Turn. [ $+ [ $nick ] ]
        halt
      }
    }
    if %Shake2. [ $+ [ $nick ] ] < %CatchPt3. [ $+ [ $nick ] ] {
      set %Shake3. [ $+ [ $nick ] ] $r(1,90000)
      if %Shake3. [ $+ [ $nick ] ] > %CatchPt3. [ $+ [ $nick ] ] {
        msg # $nick throws their %MaxBall. [ $+ [ $nick ] ] at the wild %Encounter. [ $+ [ $nick ] ] $+ , and the ball twice, but the pokemon breaks free!
        notice $nick What will you do now? !Attack !Run !Ball
        inc %Turn. [ $+ [ $nick ] ]
        halt
      }
    } 
  }  
  if %Shake3. [ $+ [ $nick ] ] < %CatchPt3. [ $+ [ $nick ] ] {
    set %Shake4. [ $+ [ $nick ] ] $r(1,90000)
    if %Shake4. [ $+ [ $nick ] ] > %CatchPt3. [ $+ [ $nick ] ] {
      msg # $nick throws their %MaxBall. [ $+ [ $nick ] ] at the wild %Encounter. [ $+ [ $nick ] ] $+ , and the ball shakes three times but the pokemon breaks free!
      notice $nick What will you do now? !Attack !Run !Ball
      inc %Turn. [ $+ [ $nick ] ]
    }
  }
  if %Shake4. [ $+ [ $nick ] ] < %CatchPt3. [ $+ [ $nick ] ] {
    set %caught. [ $+ [ $nick ] ] %Encounter. [ $+ [ $nick ] ]
    msg # $nick throws their %MaxBall. [ $+ [ $nick ] ] at the wild %Encounter. [ $+ [ $nick ] ] $+ , and the ball shakes 3 times and the wild %Encounter. [ $+ [ $nick ] ] is caught!
    if %PokeDex. [ $+ [ $nick ] ] == $null {
      inc %TotalCaught
      set %PokeDex. [ $+ [ $nick ] ] %Encounter. [ $+ [ $nick ] ]
      notice $nick %Encounter. [ $+ [ $nick ] ] $+ 's data was added to the Pokédex: $readini(PokeScript.ini,pokedex,%Encounter. [ $+ [ $nick ] ])
      unset %Encounter. [ $+ [ $nick ] ]
      unset %Turn. [ $+ [ $nick ] ]
      halt
    }
    if %PokeDex. [ $+ [ $nick ] ] != $null {
      if %caught. [ $+ [ $nick ] ] !isin %PokeDex. [ $+ [ $nick ] ] {
        inc %TotalCaught. [ $+ [ $nick ] ]
        set %PokeDex. [ $+ [ $nick ] ] $addtok(%PokeDex. [ $+ [ $nick ] ],%Encounter. [ $+ [ $nick ] ],44)
        notice $nick %Encounter. [ $+ [ $nick ] ] $+ 's data was added to the Pokédex: $readini(PokeScript.ini,pokedex,%Encounter. [ $+ [ $nick ] ])
        unset %Encounter. [ $+ [ $nick ] ] 
        unset %Turn. [ $+ [ $nick ] ]
        halt
      }
      if %Encounter. [ $+ [ $nick ] ] isin %PokeDex. [ $+ [ $nick ] ] {
        unset %Encounter. [ $+ [ $nick ] ] 
        unset %Turn. [ $+ [ $nick ] ]
      }
    }
  }
  if (%CatchRate == 255) {
    set %caught. [ $+ [ $nick ] ] %Encounter. [ $+ [ $nick ] ]
    msg # $nick throws their %MaxBall. [ $+ [ $nick ] ] at the wild %Encounter. [ $+ [ $nick ] ] $+ , and the ball doesn't even shake! The wild %Encounter. [ $+ [ $nick ] ] is caught!
    if %PokeDex. [ $+ [ $nick ] ] == $null {
      inc %TotalCaught. [ $+ [ $nick ] ]
      set %PokeDex. [ $+ [ $nick ] ] %Encounter. [ $+ [ $nick ] ]
      notice $nick %Encounter. [ $+ [ $nick ] ] $+ 's data was added to the Pokédex: $readini(PokeScript.ini,pokedex,%Encounter. [ $+ [ $nick ] ])
    }
    if %PokeDex. [ $+ [ $nick ] ] != $null {
      if %caught. [ $+ [ $nick ] ] !isin %PokeDex. [ $+ [ $nick ] ] {
        inc %TotalCaught. [ $+ [ $nick ] ]
        set %PokeDex. [ $+ [ $nick ] ] $addtok(%PokeDex. [ $+ [ $nick ] ],%Encounter. [ $+ [ $nick ] ],44)
        notice $nick %Encounter. [ $+ [ $nick ] ] $+ 's data was added to the Pokédex: $readini(PokeScript.ini,pokedex,%Encounter. [ $+ [ $nick ] ])
        unset %Encounter. [ $+ [ $nick ] ] 
        unset %Turn. [ $+ [ $nick ] ]
      }
    }    
    if %Encounter. [ $+ [ $nick ] ] isin %PokeDex. [ $+ [ $nick ] ] {
      unset %Encounter. [ $+ [ $nick ] ] 
      unset %Turn. [ $+ [ $nick ] ]
    }
  }
}

on *:join:#PokeScript:{
if %nick == $me {
halt 
}  
inc %pokejoin
  notice $nick Hi, you are visitor number $num(%pokejoin) $+ , you must log in to use PokeScript, if you don't have an account, type !register. 
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.