iRPG - idle Role Playing Game (v4.0)

By Gforce20 on Jan 08, 2008

For 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 < %numberofplayers ) {
        inc %hiloop
        set %hi 0
        set %hinumber 0
        while ( %hinumber < %numberofplayers ) {
          set %hialready 0
          inc %hinumber
          set %hiname %scorenum. [ $+ [ %hinumber ] ]
          if ( %score. [ $+ [ %hiname ] ] == $null ) { set %score. [ $+ [ %hiname ] ] 0 }
          set %hiscore %score. [ $+ [ %hiname ] ]
          if ( $count(%hilist , %hiname) == 0 ) {
            if ( %score. [ $+ [ %hiname ] ] > %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 ] ] <= 60 ) { msg #iRPG You haven't idled long enough yet! Wait until you've idled an hour (Level 8). }
  }
}

on *:ACTION:*:#:if ( $nick != $me && $chan == #iRPG && $pos($1-,away,1) == $null && $pos($1-,returns,1) == $null ) { decscore $nick $len($1-) }

alias linkscore {
  set %oldnumber %number. [ $+ [ $2 ] ]
  if ( $3 == 2 ) {
    set %play. [ $+ [ $1 ] ] %play. [ $+ [ $2 ] ]
    set %score. [ $+ [ $1 ] ] %score. [ $+ [ $2 ] ]
    set %number. [ $+ [ $1 ] ] %oldnumber
    set %scorenum. [ $+ [ %oldnumber ] ] $1
    set %greet. [ $+ [ $1 ] ] %greet. [ $+ [ $2 ] ]
  }
  unset %play. [ $+ [ $2 ] ]
  unset %score. [ $+ [ $2 ] ]
  unset %number. [ $+ [ $2 ] ]
  unset %oldnumber
  if ( $3 == 1 ) msg #iRPG $1 $+ 's score has been kept, while $2 $+ 's has been deleted.
  if ( $3 == 2 ) msg #iRPG $2 $+ 's score has been transferred to $1 $+ .
}

alias delplayer {
  unset %play. [ $+ [ $1 ] ]
  unset %score. [ $+ [ $1 ] ]
  unset %greet. [ $+ [ $1 ] ]
  set %tmp %number. [ $+ [ $1 ] ]
  unset %number. [ $+ [ $1 ] ]
  unset %scorenum. [ $+ [ %tmp ] ]
  set %scorenum. [ $+ [ %tmp ] ] %scorenum. [ $+ [ %numberofplayers ] ]
  set %tmp2 %scorenum. [ $+ [ %tmp ] ]
  set %number. [ $+ [ %tmp2 ] ] %scorenum. [ $+ [ %tmp ] ]
  unset %tmp*
  dec %numberofplayers
  msg #iRPG $1 $+ 's data has been erased.
}

alias decscore {
  set %decreasing $calc($2 * -12)
  inc %score. [ $+ [ $1 ] ] $calc
  msg #iRPG Do not talk, $1 $+ . That cost you $calc(%decreasing * -1) seconds.
  if ( %score. [ $+ [ $1 ] ] <= 0 || %score. [ $+ [ $1 ] ] == $null ) set %score. [ $+ [ $1 ] ] 0
  unset %decreasing
}

on *:NICK: {
  if ( %score. [ $+ [ $newnick ] ] > %score. [ $+ [ $nick ] ] ) linkscore $newnick $nick 1
  if ( %score. [ $+ [ $newnick ] ] < %score. [ $+ [ $nick ] ] || %score. [ $+ [ $newnick ] ] == $null ) linkscore $newnick $nick 2
}

Comments

Sign in to comment.
Anthrophobic   -  Sep 08, 2009

This script is very good. But still has a few bugs. My #iRPG_Scores room is hung up. It will not add new people to the list. They are leveling up fine. Just not on the list. Froze at 6 people.

 Respond  
Shinybot   -  Sep 08, 2009

Nice i like this script

 Respond  
Gforce20   -  May 28, 2009

Fuzion: Sorry, I had forgotten my password to Hawkee. Development has pretty much ended; if you find any bugs, feel free to fix them yourself and post the fixes as comments.

 Respond  
haddin23451   -  May 18, 2009

Anybody know where the World of Warcraft European servers are located? Someone said they are all in Britain but I am not sure. Would they have some in Germany, some in Finland etc?

I am trying to do a business plan for my own massive multiplayer game and was wonder how they spread out the resources.


haddin

WoW Europe Gold

 Respond  
haddin23451   -  May 18, 2009

Anybody know where the World of Warcraft European servers are located? Someone said they are all in Britain but I am not sure. Would they have some in Germany, some in Finland etc?

I am trying to do a business plan for my own massive multiplayer game and was wonder how they spread out the resources.


haddin

WoW Europe Gold

 Respond  
Fuzion   -  Dec 21, 2008

no more update from gforce20 well thats great

 Respond  
Fuzion   -  Apr 09, 2008

i really like this as im using it for my channel one qestion does it auto restart every month or is their a code to restart scores every month ? or does it just keep going ?

 Respond  
Gforce20   -  Mar 24, 2008

Highscore bug fixed in v3.1.

 Respond  
LordHawk   -  Mar 04, 2008

Gforce your right i didnt have the latest version. I have 1 last problem, someone has 9 scores spots taken up.

4: el_cuervito (Played 9 minutes, currently has 3 points, and is on level 1.)

( 21:05:56 ) ( ~LordHawk ) #5: el_cuervito (Played 9 minutes, currently has 3 points, and is on level 1.)
( 21:05:56 ) ( ~LordHawk ) #6: el_cuervito (Played 9 minutes, currently has 3 points, and is on level 1.)
( 21:05:56 ) ( ~LordHawk ) #7: el_cuervito (Played 9 minutes, currently has 3 points, and is on level 1.)
( 21:05:56 ) ( ~LordHawk ) #8: el_cuervito (Played 9 minutes, currently has 3 points, and is on level 1.)
( 21:05:56 ) ( ~LordHawk ) #9: el_cuervito (Played 9 minutes, currently has 3 points, and is on level 1.)
( 21:05:56 ) ( ~LordHawk ) #10: el_cuervito (Played 9 minutes, currently has 3 points, and is on level 1.)
( 21:05:56 ) ( ~LordHawk ) #11: el_cuervito (Played 9 minutes, currently has 3 points, and is on level 1.)
( 21:05:56 ) ( ~LordHawk ) #12: el_cuervito (Played 9 minutes, currently has 3 points, and is on level 1.)
( 21:05:56 ) ( ~LordHawk ) #13: el_cuervito (Played 9 minutes, currently has 3 points, and is on level 1.)

anyway i can fix that ?

 Respond  
Gforce20   -  Mar 03, 2008

LordHawk: The score isn\'t displayed by using !score, you have to join #iRPG_scores to view it.
Make sure you\'re using the latest version as well. I\'ve updated it quite a few times.

If the score simply isn\'t updating... I\'m not sure what you\'re doing wrong. It works fine on my side.

 Respond  
LordHawk   -  Mar 03, 2008

ok, ive seen alot more bugs now. #Irpg doesnt keep an updated version of the score. !score LordHawk returns . but no score, It doesnt display when someone levels, actually for that matter Drizz has been playing for 8 hours and hasnt leveled the first time yet, (which should be 1 hour after he started )

 Respond  
napa182   -  Mar 02, 2008

thats ok im not useing the script, but thats the first one i saw from looking at ur code on here.

 Respond  
Gforce20   -  Mar 02, 2008

napa182: That has been fixed. There was another bug in that section of the code as well, so I suggest you re-copy the snippet. (As opposed to removing the extra paren. yourself)

 Respond  
napa182   -  Mar 02, 2008

that error is from line #74 he has an extra \")\"
this line has the extra \")\"

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

replace it with this

if ( $sqrt( %score. [ $+ [ $nick(#iRPG,%increasing) ] ] ) == $int( $sqrt( %score. [ $+ [ $nick(#iRPG,%increasing) ] ] ) ) ) msg #iRPG $nick(#iRPG,%listing) $+ , your score is now $sqrt( %score. [ $+ [ $nick(#iRPG,%increasing) ] ] ) $+ .
 Respond  
Gforce20   -  Mar 02, 2008

LordHawk: I just fixed that a minute ago. I had an extra close parentheses at one point. Refresh the page, copy the script again, etc.

 Respond  
LordHawk   -  Mar 02, 2008

::: Error: Unknown command ())
( 21:43:53 ) ::: Error: Unknown command ())
( 21:47:41 ) ::: Error: Unknown command ())
( 21:47:41 ) ::: Error: Unknown command ())

this is what i keep getting. i didnt change anything in your code. Im using the same preset channels you have coded into the script. Any help?

 Respond  
Gforce20   -  Feb 22, 2008

darklong: I suppose with heavy modification, you could, but that\'s not what the script is designed for.

 Respond  
darklong   -  Jan 21, 2008

can i use this for playing trivia or quiz :P

 Respond  
Gforce20   -  Jan 18, 2008

Alexis: Registration is not required, it stores your score as your nickname.
tzar: I\'m fairly new to using /timer, so I\'ll look into that.

 Respond  
tzar469   -  Jan 13, 2008

Name your timers so you don\'t unset every timer at the end. And if you want a repeating timer, set the repetition value to 0.

Look at /help /timer

Good job on this script so far :)

 Respond  
^Alexis^   -  Jan 13, 2008

How do You like register?

 Respond  
Gforce20   -  Jan 13, 2008

I don\'t think it\'s very much like the original. However, I have updated this with many improvements. The game automatically tracks nickname changes, so mode +N is no longer needed. #iRPG_scores can now be used to display the top three scores on any network. It\'s overall quite a bit cleaner than the original code. Also, automatic +v for those who reach Level 5 (one straight week of playing).

 Respond  
^Alexis^   -  Jan 09, 2008

Is it the same as the original idle-rpg? /msg idle-rpg register ? And good job :> in you\'re next version might wanna add like a tourney or item searcher,good luck

 Respond  
Gforce20   -  Jan 09, 2008

Thanks for the tip, Freckle. I fixed that.

 Respond  
Freckle   -  Jan 09, 2008

There is no such command as \"deinc\" it\'s called \"dec\".
For the rest I didn\'t look at it very well I just noticed that thing.

 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.