Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

iRPG - idle Role Playing Game (v4.0)

Recommended Posts

  • Administrators
or use with channel #iRPG and #iRPG_scores

Mode +N is no longer needed.

If you want to use a channel besides #iRPG or #iRPG_scores, just replace each text "#iRPG" or "#iRPG_scores" with your own channel.

 

This was inspired by the iRPG game on deviantART's chat system. Since I couldn't find an open source iRPG IRC bot anywhere, I decided to build my own. This does not implement leaving/kicking penalties, godsends, or calamities. I might include those in a later version.

 

Custom greet messages are now implemented! Type "!greet message" to set your welcome-back to "message". (Without quotes.)

 

One thing I included that the original iRPG doesn't is the nickname formatting for long-time players. When you reach 1 hour, 12 hours, 2 days, and 1 week of playing, your greet message gets fancier. ^_^ I also implemented the highscore table for the top 3 players.

 

For manual nick linking (when somebody comes into the channel with a different nick than they usually have), type this:

/linkscore NewNickname OldNickname

If the game doesn't initialize, type this in the server window:

/twelveseconds

To delete a player from the system, use:

/delplayer Nickname

 

v3.0 has a cleaner overall system and much better highscore table.

v3.1 has a fixed, foolproof highscore table and cleaner greet messages. Also implemented delplayer.

v3.11 has better defense against retards; also updated a very old #iRPG_scores feature, "!score username".

 

v4.0 implements "!greet ", less code junk, and a self-correcting highscore system.

 

on *:JOIN:#: {

  if ( $nick != $me ) {

    if ( $chan == #iRPG ) {

      if ( %play. [ $+ [ $nick ] ] == 1 ) { msg $chan Welcome back, 15 $+ $nick $+ . Your current score is $floor($sqrt(%score. [ $+ [ $nick ] ] )) $+ . }

      if ( %play. [ $+ [ $nick ] ] == 2 ) { msg $chan Welcome back,  $+ $nick $+  %greet. [ $+ [ $nick ] ] $+ . Your current score is $floor($sqrt(%score. [ $+ [ $nick ] ] )) $+ . }

      if ( %play. [ $+ [ $nick ] ] == 3 ) { msg $chan Welcome back, 4 $+ $nick $+  %greet. [ $+ [ $nick ] ] $+ . Your current score is $floor($sqrt(%score. [ $+ [ $nick ] ] )) $+ . }

      if ( %play. [ $+ [ $nick ] ] == 4 ) { msg $chan Welcome back,  $+ $nick $+  %greet. [ $+ [ $nick ] ] $+ . Your current score is $floor($sqrt(%score. [ $+ [ $nick ] ] )) $+ . }

      if ( %play. [ $+ [ $nick ] ] == 5 ) {

        msg $chan Welcome back, $+ $nick $+ %greet. [ $+ [ $nick ] ] $+ . Your current score is $floor($sqrt(%score. [ $+ [ $nick ] ] )) $+ .

        voice $nick

      }

      if ( %play. [ $+ [ $nick ] ] == $null ) {

        msg $chan Welcome to iRPG,15 $nick $+ . Please read the topic before you begin idling!

        set %play. [ $+ [ $nick ] ] 1

        set %score. [ $+ [ $nick ] ] 0

        inc %numberofplayers

        set %number. [ $+ [ $nick ] ] %numberofplayers

        set %scorenum. [ $+ [ %numberofplayers ] ] $nick

      }

    }

    if ( $chan == #iRPG_scores ) {

      unset %hi*

      set %hinumber 0

      set %hiloop 0

      set %hiabove.0 $chr(32)

      while ( %hiloop  %hi ) {

              set %hi %score. [ $+ [ %hiname ] ]

              set %hihiname %hiname

            }

          }

        }

        if ( $count(%hilist , %hihiname) != 0 ) {

          dec %numberofplayers

          set %hiErrorOccured 1

        }

        msg #iRPG_scores %hiloop $+ : %hihiname (Played $int(%hi) minutes, currently has $floor($sqrt(%hi)) points, and is on level %play. [ $+ [ %hihiname ] ] $+ .)

        set %hilist %hilist $+ $chr(32) $+ %hihiname

      }

      if ( %hiErrorOccured == 1 ) { msg #iRPG_scores The highscore board encountered an error and has recovered. It should work fine next time. }

    }

  } 

  else if ( $chan == #iRPG ) {

    set %listing 0

    timer1 0 15 twelveseconds

  }

}

 

alias twelveseconds {

  set %increasing 1

  while ( $nick(#iRPG,%increasing) != $null ) {

    if ( $nick(#iRPG,%increasing) != $me ) {

      inc %score. [ $+ [ $nick(#iRPG,%increasing) ] ] 0.2

      if ( $sqrt( %score. [ $+ [ $nick(#iRPG,%increasing) ] ] ) == $int( $sqrt( %score. [ $+ [ $nick(#iRPG,%increasing) ] ] ) ) ) msg #iRPG $nick(#iRPG,%increasing) $+ , your score is now $sqrt( %score. [ $+ [ $nick(#iRPG,%increasing) ] ] ) $+ .

      if ( %score. [ $+ [ $nick(#iRPG,%increasing) ] ] > 60 && %play. [ $+ [ $nick(#iRPG,%increasing) ] ] == 1 ) {

        msg #iRPG $nick(#iRPG,%increasing) $+ , you have advanced to Level 2 for logging 1 hour in iRPG. Good job!

        set %play. [ $+ [ $nick(#iRPG,%increasing) ] ] 2

      }

      if ( %score. [ $+ [ $nick(#iRPG,%increasing) ] ] > 720 && %play. [ $+ [ $nick(#iRPG,%increasing) ] ] == 2 ) {

        msg #iRPG $nick(#iRPG,%increasing) $+ , you have advanced to Level 3 for logging 12 hours in iRPG. Wow!

        set %play. [ $+ [ $nick(#iRPG,%increasing) ] ] 3

      }

      if ( %score. [ $+ [ $nick(#iRPG,%increasing) ] ] > 2880 && %play. [ $+ [ $nick(#iRPG,%increasing) ] ] == 3 ) {

        msg #iRPG $nick(#iRPG,%increasing) $+ , you have advanced to Level 4 for logging 48 hours in iRPG. Incredible!!

        set %play. [ $+ [ $nick(#iRPG,%increasing) ] ] 4

      }

      if ( %score. [ $+ [ $nick(#iRPG,%increasing) ] ] > 10080 && %play. [ $+ [ $nick(#iRPG,%increasing) ] ] == 4 ) {

        msg #iRPG $nick(#iRPG,%increasing) $+ , you have advanced to Level 5 for logging one week in iRPG. Unbelievable!!!

        set %play. [ $+ [ $nick(#iRPG,%increasing) ] ] 5

      }

    }

    inc %increasing

  }

}

 

on *:TEXT:*:#: {

  if ( $nick != $me && $chan == #iRPG && $1 != !greet ) { decscore $nick $len($1-) }

  if ( $chan == #iRPG_scores && $1 == !score ) { if ( %score. [ $+ [ $2 ] ] != $null ) { msg $chan $2 $+ 's exact score is $sqrt(%score. [ $+ [ $2 ] ]) $+ . } }

  if ( $chan == #iRPG && $1 == !greet && %greet. [ $+ [ $nick ] ] != $null ) {

    decscore $nick $len($1-)

    msg #iRPG You've already set your greet message!

  }

  if ( $chan == #iRPG && $1 == !greet && %greet. [ $+ [ $nick ] ] == $null ) {

    if ( %score. [ $+ [ $nick ] ] > 60 ) {

      if ( $pos($1-,fuck,1) == $null && $pos($1-,shit,1) == $null && $pos($1-,damn,1) == $null && $pos($1-,nigg,1) == $null ) {

        set %greet. [ $+ [ $nick ] ] 15 $+ $chr(91) $+  $+ $2- $+ 15 $+ $chr(93)

        msg #iRPG $nick $+ , your greet message has been set to: $2-

      }

      else { msg #iRPG Swearing is not allowed in your greet message. Do not try to bypass the censors, or you will be banned from iRPG indefinitely. }

    }

    if ( %score. [ $+ [ $nick ] ]  %score. [ $+ [ $nick ] ] ) linkscore $newnick $nick 1

  if ( %score. [ $+ [ $newnick ] ] 

Link to comment
Share on other sites



×
×
  • Create New...