Pokedex Script ( With GEN7 + Mega)

By manish17 on Jan 03, 2017

Updated :- v.1.3 :
Added Auto-Correct feature, to help you with wrong spellings.

Updated :- v.1.2 :
Shows if pokemon is legend or not.
Fixed bug for blank lines
Pokemon names appear normally now.

Updated : - v.1.1 :
Added pokemon evolutions + Mega Evolutions.
Txt files are downloaded automatically when script is loaded.
Fixed search for pokemons like Mr. Mime , Mime Jr. , etc.

STEPS -->
Paste the script on your remotes.

Enjoy!

I made this script on my own. I hope you will like it. Please, please, please comment!!!!

If you find any bugs or have any suggestions, then comment below or you may talk to me.
Want to talk with me? Come to server irc.lucidchat.net . Channel : #LoveLife

COMMAND IS -
!dex Pokemon name or !dex Dex number

############################################################
##             Pokedex Script                          ##
##             Version: 1.3                             ##
##             By: manish17                              ##
##             irc.lucidchat.net #LoveLife                 ##
############################################################

alias Download {
  if ($regex(Args,$1-,^-c (?|(?:"(?=.+")([^"]+)")|(\S+)) (\S+) (?|(?:"(?=.+")([^"]+)")|(\S+)) (\S+)$)) {
    var %callback = $regml(Args,1)
    var %url = $regml(Args,2)
    var %file = $qt($regml(Args,3))
    var %com = $regml(Args,4)
    var %r = $iif($comerr,1,$com(%com).result)

    .remove $qt($scriptdir $+ %com)
    if ($com(%com)) { .comclose %com }

    if (%r == -1) { %callback 1 Succcessfully downloaded. %file }
    elseif (%r == 1) { %callback 0 UnKnown_ComErr %url $qt(%file) }
    elseif (%r == 2) { %callback 0 IE6+_Needed %url $qt(%file) }
    elseif (%r == 3) { %callback 0 Connect_Error %url $qt(%file) }
    elseif (%r == 4) { %callback 0 Newer_ActiveX_Needed %url $qt(%file) }
    elseif (%r == 5) { %callback 0 Writefile_Error %url $qt(%file) }
    else { %callback 0 Unknown_Error %url $qt(%file) }
  }
  elseif ($1 != -c) {
    if ($isid) || (!$regex(Args,$1-,^(?|(?:"(?=.+")([^"]+)")|(\S+)) (\S+) (?|(?:"(?=.+")([^"]+)")|(\S+))$)) || ($regml(Args,0) != 3) { return }

    var %callback = $regml(Args,1)
    var %url = $qt($regml(Args,2))
    var %file = $qt($iif(: isin $regml(Args,3),$v2,$mircdir $+ $v2))
    var %com = download $+ $ticks $+ .vbs
    var %s = $qt($scriptdir $+ %com)
    var %w = write %s

    %w on error resume next
    %w Set C = CreateObject("msxml2.xmlhttp.3.0")
    %w if (err.number <> 0) then
    %w   err.clear
    %w   set C = CreateObject("msxml2.xmlhttp")
    %w   if (err.number <> 0) then 
    %w     err.clear
    %w     set C = CreateObject("XMLHttpRequest")
    %w     if (err.number <> 0) then wscript.quit(2)
    %w   end if
    %w end if
    %w C.open "GET", %url $+ , false
    %w C.send 
    %w if (err.number <> 0) then wscript.quit(3)
    %w set O = createobject("adodb.stream")
    %w if (err.number <> 0) then wscript.quit(4)
    %w O.type=1 
    %w O.mode=3 
    %w O.open 
    %w O.write C.responsebody 
    %w O.savetofile %file $+ ,2
    %w if (err.number <> 0) then wscript.quit(5)
    %w O.close
    %w wscript.quit(-1)

    .comopen %com WScript.Shell
    if ($comerr || !$comcall(%com,download -c $qt(%callback) $noqt(%url) %file,run,1,bstr*,%s,uint,1,bool,true)) { goto error }
    return
  }
  :error
  if ($error) { reseterror }
  if ($isfile(%s)) { .remove %s }
  if ($com(%com)) { .comclose %com }
}

ON *:LOAD: {

  download "echo -a " http://pastebin.com/raw/TCgW0WAQ pokedescription.txt
  download "echo -a " http://pastebin.com/raw/bpYryCMs pokemega.txt
  download "echo -a " http://pastebin.com/raw/YVGwhJyq pokemon.txt
  download "echo -a " http://pastebin.com/raw/qbfZyYTA poketypes.txt
  download "echo -a " http://pastebin.com/raw/0pgZK1XS pokevols.txt

}
alias check { 
  var %legend = 493 144 482 794 251 797 638 790 789 488 491 386 483 719 244 649 487 383 799 485 250 720 385 798 647 382 646 645 380 381 249 792 801 490 802 648 481 151 150 146 800 793 795 484 489 243 384 378 486 377 379 643 492 791 245 787 788 785 786 639 642 641 480 494 640 721 716 796 717 145 644 718
  set %chek $1
  if ( $istok( %legend, %chek, 32) ) { 
    set %info Is a Legendary Pokemon
  }
  else { 
    set %info Is a Non-Legendary Pokemon
  }
}

on *:text:!dex*:#: {
  set %matchs $null
  set %trig 0
  set %m 1 
  %lines = $lines(pokemon.txt)
  if ($2 == $null) { notice $nick Syntax : !dex <pokemon> or !dex <dex number> }
if ( $2 !isnum ) && ( !$read(pokemon.txt,w,$2) ) {  matche $2- }
  if ( %matchs != $null ) { 
    msg $chan 6 Did you mean 4 %matchs ?
    set %trig 1 
  } 

  elseif ($read(pokemon.txt,w, $2- )) {
    if ( %trig == 0 ) { 
      %n = $readn $+
      check %n
      msg $chan  4 Pokedex  7# %n :12 $read(pokemon.txt,%n)   6( %info )  
      msg $chan 4 Description : 6  $read(pokedescription.txt,n,%n)
      msg $chan 5 Type : 5 $read(poketypes.txt,n,%n)  
      if ($read(pokevols.txt, w, * $+ $2 $+ *)) {
      msg $chan 10 $read(pokevols.txt, w, * $+ $2 $+ *) }
      if ($read(pokemega.txt, w, * $+ $2 $+ *)) {
      msg $chan 14 $read(pokemega.txt, w, * $+ $2 $+ *) }

    }
  }

  elseif ($2 > %lines) && ( $2 isnum)  {
    msg $chan 4 Please choose a valid pokedex number or pokemon name. You can select dex number from 1 to %lines .
  }
  elseif ( $2- isnum ) {
    check $2
    msg $chan  4 Pokedex  7# $2 :12 $read(pokemon.txt, n, $2) 6 ( %info ) 
    msg $chan 4 Description : 6 $read(pokedescription.txt,n,$2)
    msg $chan 9 Type : 5 $read(poketypes.txt,n,$2)  

    %m = $read(pokemon.txt,n,$2)
    if ($read(pokevols.txt, w, * $+ %m $+ *)) {
    msg $chan 10 $read(pokevols.txt,w,* $+ %m $+ *) }
    if ($read(pokemega.txt, w, * $+ %m $+ *)) {
    msg $chan 14 $read(pokemega.txt, w, * $+ %m $+ *) }

  }
  else { 
  msg $chan 14 Not Found. }
}
alias matche { 
  var %tosee = $1-
  if ( 2 isin %tosee ) { 
    return
  }
  if ( $read(pokemon.txt,w, * $+ %tosee $+ * ) ) { 
    %pq = $readn $+
    set %rn $read(pokemon.txt, %pq )
    if ( %rn isin %tosee ) { 
      return
    }
  }
  while ( %tosee != $null ) { 

    %tosee = $left( %tosee ,-1) 
    if ( $read(pokemon.txt,w, * $+ %tosee $+ * ) ) { 
      %z = $readn $+
      set %matchs $read(pokemon.txt, %z )

      return
    } 

  }

Comments

Sign in to comment.
manish17   -  Feb 06, 2017

Script updated.
Enjoy v.1.1 of pokedex !!

 Respond  
OrFeAsGr   -  Jan 03, 2017

On the scripting part i might would suggest writing the data on hashtables. They are a lot faster.. but since you're not scanning the .txt files on your own.. (mIRC does it for you) i think the difference would be like .. 0.5 seconds or something..
An other idea is to host the files somewhere like pastebin and make a script download them. So the users dont have to.
I can help with both if you need

Alexandru  -  Apr 04, 2017

Hash tables work with allocated memory to mirc so even hash are fast, sometimes errors must occur, in dependence. Working with files, is not so fast, but is more secure and more better than using hash. Hash was in the past and nowadays having a good computer hash or files are practically no difference (10-100ms is just a difference?), especially if you have a SSD. Nowadays is better to work with files that is more secure, you have free allocated memory and is more easy to script through, than to use hash.

In this example, is stupid to use hash, because the txt files contain many tokens and is stupid to load so many tokens in hash tables or to combine hash with read and write.

When the people understand that hash is working with allocated memory and is good to use when you have a slow cpu? If you have a good computer, you can forget about hash :)

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.