View difference between Paste ID: dzdywtzr and DbL697DB
SHOW: | | - or go back to the newest paste.
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;;; BASIC CONTROL
3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4
5
raw 421:*:echo -a 4,1Unknown Command: ( $+ $2 $+ ) | echo -a 4,1Location: %debug.location | halt
6
7
; EDIT: [Andrio Celos] Regain the regular nickname.
8
on 1:QUIT: { if ($nick = %bot.name) { /nick %bot.name } | .auser 1 $nick | .flush 1 }
9
on 1:EXIT: { .auser 1 $nick | .flush 1 }
10
on 1:PART:%battlechan:.auser 1 $nick | .flush 1
11
on 1:KICK:%battlechan:.auser 1 $knick | .flush 1 
12
on 1:JOIN:%battlechan:{  .auser 1 $nick | .flush 1 }
13
on 3:NICK: { .auser 1 $nick | mode %battlechan -v $newnick | .flush 1 }
14
; EDIT: [Andrio Celos] Stop the keep-alive timer from spamming the status window.
15
CTCP *:PING*:?:if ($nick == $me) haltdef
16
on *:CTCPREPLY:PING*:if ($nick == $me) haltdef
17
on *:DNS: { 
18
  if ($isfile($char($nick)) = $true) { writeini $char($nick) info lastIP $iaddress  }
19
  set %ip.address. [ $+ [ $nick ] ] $iaddress
20
}
21
22
on 50:TEXT:!quit*:*:{ /quit $battle.version }
23
24
on 1:START: {
25
  echo 12*** Welcome to Battle Arena Bot version $battle.version written by James "Iyouboushi" *** 
26
27
  /.titlebar Battle Arena version $battle.version written by James  "Iyouboushi" 
28
29
  if (%first.run = false) { 
30
    set %bot.owner $readini(system.dat, botinfo, bot.owner) 
31
    if (%bot.owner = $null) { echo 4*** WARNING: There is no bot owner set.  Please fix this now. 
32
    set %bot.owner $?="Please enter the bot owner's IRC nick" |  writeini system.dat botinfo bot.owner %bot.owner }
33
    else { echo 12*** The bot owner list is currently set to:4 %bot.owner 12***  |  
34
35
      var %value 1 | var %number.of.owners $numtok(%bot.owner, 46)
36
      while (%value <= %number.of.owners) {
37
        set %name.of.owner $gettok(%bot.owner,%value,46)
38
        .auser 50 %name.of.owner
39
        inc %value 1
40
      }
41
      unset %name.of.owner
42
    }
43
44
    set %battlechan $readini(system.dat, botinfo, questchan) 
45
    if (%battlechan = $null) { echo 4*** WARNING: There is no battle channel set.  Please fix this now. 
46
    set %battlechan $?="Please enter the IRC channel you're using (include the #)" |  writeini system.dat botinfo questchan %battlechan }
47
    else { echo 12*** The battle channel is currently set to:4 %battlechan 12*** }
48
49
    set %bot.name $readini(system.dat, botinfo, botname)
50
    if (%bot.name = $null) { echo 4*** WARNING: The bot's nick is not set in the system file.  Please fix this now.
51
    set %bot.name $?="Please enter the nick you wish the bot to use" | writeini system.dat botinfo botname %bot.name | /nick %bot.name }
52
    else { /nick %bot.name } 
53
54
    var %botpass $readini(system.dat, botinfo, botpass)
55
    if (%botpass = $null) { 
56
      echo 12*** Now please set the password you plan to register the bot with
57
      var %botpass $?="Enter a password"
58
      writeini system.dat botinfo botpass %botpass
59
      echo 12*** OK.  Your password has been set to4 %botpass  -- Don't forget to register the bot with nickserv.
60
    }
61
62
    $system_defaults_check
63
  }
64
65
  if ((%first.run = true) || (%first.run = $null)) { 
66
    echo 12*** It seems this is the first time you've ever run the Battle Arena Bot!  The bot will now attempt to help you get things set up.
67
    echo 12*** Please set your bot's nick/name now.   Normal IRC nick rules apply (no spaces, for example) 
68
    set %bot.name $?="Please enter the nick you wish the bot to use"
69
    writeini system.dat botinfo botname %bot.name | /nick %bot.name
70
    echo 12*** Great.  The bot's nick is now set to4 %bot.name
71
72
    echo 12*** Please set a bot owner now.  
73
    set %bot.owner $?="Please enter the bot owner's IRC nick"
74
    writeini system.dat botinfo bot.owner %bot.owner
75
    echo 12*** Great.  The bot owner has been set to4 %bot.owner
76
77
    echo 12*** Now please set the IRC channel you plan to use the bot in
78
    set %battlechan $?="Enter an IRC channel (include the #)"
79
    writeini system.dat botinfo questchan %battlechan
80
    echo 12*** The battles will now take place in4 %battlechan
81
82
    echo 12*** Now please set the password you plan to register the bot with
83
    var %botpass $?="Enter a password"
84
    writeini system.dat botinfo botpass %botpass
85
    echo 12*** OK.  Your password has been set to4 %botpass  -- Don't forget to register the bot with nickserv.
86
87
    set %first.run false
88
    .auser 50 %bot.owner
89
90
    $system_defaults_check
91
92
  }
93-
  ; EDIT: [Andrio Celos] The timer isn't necessary.
93+
94
95
on 1:CONNECT: {
96
  ; Start a keep alive timer.
97
  ; EDIT: [Andrio Celos] Stop the keep-alive timer from spamming the status window.
98
  /.timerKeepAlive 0 300 /.ctcp $me PING
99
100
  ; Join the channel
101
  /join %battlechan
102
103
  ; EDIT: [Andrio Celos] Use the NickServ GHOST command.
104
  ; Send password
105
  var %bot.pass $readini(system.dat, botinfo, botpass)
106
  if (%bot.pass != $null) { /.msg nickserv identify %bot.pass |
107
  if ($me != %bot.name) { /.msg NickServ GHOST %bot.name %bot.pass } }
108
109
  if (%battleis = on) { 
110
    if ($readini(battle2.txt, BattleInfo, Monsters) = $null) { $clear_battle }
111
    else { $next }
112
  }
113
  if (%battleis = off) { $clear_battle } 
114
}
115
116
117
on 50:TEXT:!debug dump*:*:{ 
118
  var %debug.filename debug_dump $+ $day $+ $rand(a,z) $+ $rand(1,1000) $+ $rand(a,z) $+ .txt
119
  .copy remote.ini %debug.filename
120
121
  write %debug.filename ------------------------------------------------------
122
  write %debug.filename debug location: %debug.location 
123
  write %debug.filename battlefield: %current.battlefield
124
  write %debug.filename battlefield event number: %battlefield.event.number
125
  write %debug.filename boss type: %boss.type 
126
  write %debug.filename portal bonus: %portal.bonus 
127
  write %debug.filename holy.aura: %holy.aura 
128
  write %debug.filename five min warning: %darkness.fivemin.warn  
129
  write %debug.filename battle.rage.darkness: %battle.rage.darkness 
130
  write %debug.filename battle conditions: %battleconditions 
131
  write %debug.filename ai target: %ai.target
132
  write %debug.filename ai tech: %ai.tech
133
134
  $display.system.message(4Variables File dumped as file: %debug.filename, private)
135
}