!attack (user v. user battle)

Platform:  mIRC
Published  Jan 04, 2008
Updated  Jan 04, 2008
Wrote this month or two ago and never got around to posting it out of boredom(or editing it to be simpler out of laziness).

It's a very simple to use battle snippet that pits one user in a room against another one. Just set yourself as the bot's owner with the alias and say '!attacker on,' and anyone is free to attack anyone else aside from yourself and the bot.

Meant to run on ircd, with ChatSpace this will just act goofy half of the time.

Please post with comments/anything I blatantly screwed up. ;The alias to set yourself as the bot's owner.
;
alias /battlemaster {
unset %battlemaster
set %battlemaster $1
echo -a 12[712]4 $1 7 has been set as the battlemaster 12[712]
}

;The code to turn the attacker off, and punishment for anyone who flees.
;

on *:text:*:#: {
if ($nick == %battlemaster) {
if (($1 == !attacker) && (%attacker == off) && ($2 == on)) {
unset %attacker
set %attacker on
set %attackchan $chan
msg $chan 12[712]7 My attack function has been turned on and set to run in $chan 12[712]
}
if (($1 == !attacker) && (%attacker == on) && ($2 == off)) {
unset %attacker
set %attacker off
unset %attackchan
msg $chan 12[712]7 My attack function has been turned off 12[712]
} } }

on *:part:#: {
if ($nick == %attackee) {
set %finisher $nick
.timer 1 3600 %unset finisher
halt
} }

on *:join:#: {
if (($nick == %finisher) && ($me isop $chan)) {
msg $chan 12[712]7 FINISH HIM! 12[712]
describe $chan tears $nick $+ 's heart out through their throat.
mode $chan +b $address($nick,2)
kick $chan $nick 12[712]7 Fatality! 12[712]
msg $chan 12[712]7 FLAWLESS VICTORY. 12[712]
unset %finisher
halt
} }

;The bulk of the code, feel free to edit for simplicity/balance.
;

on *:text:*!attack *:#: {
if (%attacker == off) || ($2 == %battlemaster) { halt }
elseif ((%fight == on) && ($chan == %attackchan)) {
msg $chan 12[712]7 You will have to wait to fight,4 $nick $+ 7. 12[712]
halt }
elseif ((%attacker == on) && ($chan == %attackchan)) {
set -u10 %fight on
set -u10 %fighter $nick
set -u10 %attackee $2
set %attack $rand(1,1000)
if (%attack >= 950) {
msg $chan 12[712]12 $nick $+ 7's attack struck for %attack $+ ! Critical hit! 12[712]
.timer 1 3 mode $chan +b $address($2,2)
.timer 1 3 kick $chan $2 12[712]7 Hasta la bye bye. =) 12[712]
.timer 1 4 unset %attack
.timer 1 63 mode $chan -b $address($2,2)
halt }
elseif ((%attack >= 501) && (%attack <= 600)) {
msg $chan 12[712]12 $nick $+ 7's attack struck for %attack $+ ! A poor hit. =( 12[712]
.timer 1 3 mode $chan +b ~n: $+ $address($2,2)
.timer 1 4 unset %attack
.timer 1 33 mode $chan -b ~n: $+ $address($2,2)
halt }
elseif ((%attack >= 601) && (%attack <= 700)) {
msg $chan 12[712]12 $nick $+ 7's attack struck for %attack $+ ! A decent hit. 12[712]
.timer 1 3 mode $chan +b ~q: $+ $address($2,2)
.timer 1 4 unset %attack
.timer 1 33 mode $chan -b ~q: $+ $address($2,2)
halt }
elseif ((%attack >= 701) && (%attack <= 800)) {
msg $chan 12[712]12 $nick $+ 7's attack struck for %attack $+ ! Good hit! =) 12[712]
.timer 1 3 mode $chan +b ~q: $+ $address($2,2)
.timer 1 3 mode $chan +b ~n: $+ $address($2,2)
.timer 1 4 unset %attack
.timer 1 33 mode $chan -b ~q: $+ $address($2,2)
.timer 1 33 mode $chan -b ~n: $+ $address($2,2)
halt }
elseif ((%attack >= 801) && (%attack <= 950)) {
msg $chan 12[712]12 $nick $+ 7's attack struck for %attack $+ ! Excellent! =D 12[712]
.timer 1 3 kick $chan $2 12[712]7 You haff been slain. =O 12[712]
.timer 1 4 unset %attack
halt }
elseif (%attack == 500) {
msg $chan 12[712]7 The clash between 12 $+ $nick $+ 7 and 12 $+ $2 $+ 7 has ended in a stalemate. 12[712]
unset %attack
halt }
elseif (%attack >= 101) {
if (%attack >= 500) { halt }
if (%attack <= 275) {
msg $chan 12[712]12 $nick $+ 7's attack has failed to strike: %attack $+ . =( 12[712]
unset %attack
set %cattack $rand(1,4)
.timer 1 1 msg $chan 12[712]12 $2 $+ 7 is now counterattacking 12[712]
if (%cattack <= 2) {
.timer 1 3 msg $chan 12[712]7 Failure. =( 12[712] }
if (%cattack == 3) {
.timer 1 3 msg $chan 12[712]7 Success. =) 12[712]
.timer 1 4 kick $chan $nick 12[712]7 You haff been slain in combat. =O 12[712] }
if (%cattack == 4) {
.timer 1 3 msg $chan 12[712]7 Success. =) 12[712]
.timer 1 5 mode $chan +b $address($nick,2)
.timer 1 6 kick $chan $nick 12[712]7 You have been mortally wounded by your opponent. Try again later. 12[712] }
.timer 1 7 unset %cattack
.timer 1 35 mode $chan -b $address($nick,2)
halt }
if ((%attack <= 499) && (%attack >= 276)) {
msg $chan 12[712]12 $nick $+ 7's attack has failed to strike: %attack $+ . =( 12[712]
unset %attack
set %cattack $rand(1,4)
.timer 1 1 msg $chan 12[712]12 $2 $+ 7 is now counterattacking 12[712]
if (%cattack <= 2) {
.timer 1 3 msg $chan 12[712]7 Failure. =( 12[712] }
if (%cattack == 4) {
.timer 1 3 msg $chan 12[712]7 Success. =) 12[712]
.timer 1 4 mode $chan +b $address($nick,2)
.timer 1 4 kick $chan $nick 12[712]7 You haff been slain in combat. =P 12[712]
.timer 1 34 mode $chan -b $address($nick,2)
}
if (%cattack == 3) {
.timer 1 3 msg $chan 12[712]7 Success. =) 12[712]
.timer 1 5 mode $chan +b ~q: $+ $address($nick,2)
.timer 1 5 mode $chan +b ~n: $+ $address($nick,2)
.timer 1 6 msg $chan 12[712]7 You have been wounded by your opponent. You will have to rest. =) 12[712] }
.timer 1 7 unset %cattack
.timer 1 35 mode $chan -b ~q: $+ $address($nick,2)
.timer 1 35 mode $chan -b ~n: $+ $address($nick,2)
halt } }
elseif (%attack <= 100) {
msg $chan 12[712]12 $nick $+ 7's attack has resulted in failure: %attack $+ . 4Critical failure! 12[712]
.timer 1 3 mode $chan +b $address($nick,2)
.timer 1 3 kick $chan $nick 12[712]7 Your weak body has crumbled to dust. 12[712]
.timer 1 5 unset %attack
.timer 1 63 mode $chan -b $address($nick,2)
halt }
} }

Comments

Sign in to comment.
cptpan   -  Jan 12, 2012
how the fark does this even work? I set battlemaster and no triggers work and nothing !@#$ happens
 Respond  
Tankgeneral   -  Jan 05, 2008
maybe set battlemaster as defender? cause you attack a person then the person who gets attacked needs to defend hisself
 Respond  
EL   -  Jan 04, 2008
Sup jewsus lol yeah i can\'t test this on my server cause of chatspace but looks fun.`-.-
 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.