Fight Game

By newklear on Apr 16, 2018

Simple Fight game

Syntax: !fight nickname or !fight stats nickname

Note: Variables are saved once an hour after use, just reload the Fight.ini if need be .
Feel free too edit the randomisers for different outcomes.

on *:TEXT:!fight*:#:{
  if (%flfight. [ $+ [ $address($nick,2) ] ] >= 5) { halt }
  if (%flfight. [ $+ [ $address($nick,2) ] ] == 3) { .notice $nick You have one more !fight use within a 1 minute period. }
  inc -u60 %flfight. [ $+ [ $address($nick,2) ] ] 1
  if ($2 == $nick) { .notice $nick You cannot attack yourself silly! | halt }
  if ($2 == $me) { .notice $nick You cannot attack the Bot :p | halt }
  if ($2 == help) { .notice $nick Fight Help Commands are: !fight, !fight Stats, !fight help | halt }
  if ($2 == stats) {
    if ($3) {
      if (!%SA. [ $+ [ $address($3,2) ] ]) { .notice $nick There is no Attack Record for $3 $+ . | halt }
      .notice $nick $3 $+ 's Strike Attack == %SA. [ $+ [ $address($3,2) ] ]
    }
    else { .notice $nick Syntax: !fight stats nickname }
    halt
  }
  if ($2) {
    .timersavefight 1 3600 save -rv Fight.ini  
    if ($2 ison $chan) {
      var %sa $calc(%SA. [ $+ [ $address($nick,2) ] ] + $r(1,10) / 10)
      var %da $calc(%SA. [ $+ [ $address($2,2) ] ] + $r(1,10) / 10)
      if (%sa == %da) { 
        .msg $chan the Fight is a 13draw! Your SA: %sa vs $2 $+ 's DA: %da 
        set %SA. [ $+ [ $address($nick,2) ] ] $calc(%SA. [ $+ [ $address($nick,2) ] ] + $r(1,30) / 10)
        set %SA. [ $+ [ $address($2,2) ] ] $calc(%SA. [ $+ [ $address($2,2) ] ] + $r(1,30) / 10)
        ;**************************************Fight - by newklear 2018***************************************
      }
      if (%sa > %da) { 
        .msg $chan You have 9beaten $2 $+ ! Your SA: %sa vs $2 $+ 's DA: %da  
        set %SA. [ $+ [ $address($nick,2) ] ] $calc(%SA. [ $+ [ $address($nick,2) ] ] + $r(1,30) / 10)
        set %SA. [ $+ [ $address($2,2) ] ] $calc(%SA. [ $+ [ $address($2,2) ] ] + $r(1,70) / 10)
      }
      if (%sa < %da) { 
        .msg $chan You 4lost to $2 $+ ! Your SA: %sa vs $2 $+ 's DA: %da  
        set %SA. [ $+ [ $address($nick,2) ] ] $calc(%SA. [ $+ [ $address($nick,2) ] ] + $r(1,60) / 10)
        set %SA. [ $+ [ $address($2,2) ] ] $calc(%SA. [ $+ [ $address($2,2) ] ] + $r(1,40) / 10)
      }
    }
    else { .notice $nick You can only fight someone in the channel. }
  }
  else { .notice $nick Syntax: !fight nickname or !fight stats nickname }
}

Comments

Sign in to comment.
Karlien   -  Jun 04, 2018

Is there a simple way to change the way this saves without a complete rewrite? As it is, every time it saves, it removes my current .vars and replaces it with fight.ini. Obviously that causes some issues since my bot has over 50 scripts in it. I'd like to use this but can't the way it is.Having it write to an .ini file more like the Dice you have would be preferable.
p.s. likes the Dice, simple but still fun :)

newklear  -  Jul 18, 2018

Hi Karlien, thank you for your comment

You could do this:
This line: ".timersavefight 1 3600 save -rv Fight.ini"
Can be changed to: ".timersavefight 1 3600 saveini"

That way your current vars.ini will be updated and not resaved.

Karlien  -  Jul 19, 2018

Oh thank you. That's perfect. Works like a charm now :)

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.