Jethro commented on a Page, Pokemon Catching Snippet  -  Apr 01, 2010

This is what I call "mass if statements abuse." You can do it this way:

on *:text:$($strip(!pokemon)):#: {
  if (!%f) { inc -u4 %f no_flood
    var %p = Bulbasaur|Ivysaur|Venasaur|Charmander|Charzard|Squirtle|Wartortle|$&
      $+ Pidgeotto|Rattata|Raticate|Spearow|Fearow|Ekans|Arbok|Pikachu|Raichu|Sandshrew|$&
      $+ Caterpie|Metapod|Butterfree|Weedle|Kakuna|Beedrill|Pidgey|Pidgeotto|Pidgeot
    ;rest of nicknames here (3rd line)
    ;rest of nicknames here (4th line)
    ;rest of nicknames here (5th line)
    ;so on and so forth
    msg # $gettok(%p,$r(1,$numtok(%p,124)),124) is caught. Congratulations.
  }
}

A trigger flood control is recommended, or else some people may abuse it by flooding the client running the code. My example shows it that people can only command the script trigger every 4 seconds.

There are also a couple of other ways you can go about a randomized script like this:

  1. Put all the message in a text file and either use /play command with the -r switch or simply use the $read(file.txt) to send a random message.

  2. Find a website that lists various pokemon nicknames and make a socket script to fetch and output them in the channel randomly.
 Respond  
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.