alias clear_battle {
; Erase any stray monsters/bosses..
if (($lines(battle.txt) != 0) && ($lines(battle.txt) != $null)) {
var %battletxt.lines $lines(battle.txt) | var %battletxt.current.line 1
while (%battletxt.current.line <= %battletxt.lines) {
var %who.battle $read -l $+ %battletxt.current.line battle.txt
var %clear.flag $readini($char(%who.battle), info, flag)
if ((%clear.flag = monster) || (%clear.flag = npc)) { .remove $char(%who.battle) }
if ($file($char(%who.battle)).size = 0) { $zap_char(%who.battle) }
inc %battletxt.current.line
}
}
; Full everyone that was in battle.
unset %clear.flag
var %value 1
while ($findfile( $char_path , *.char, %value , 0) != $null) {
set %file $nopath($findfile($char_path ,*.char,%value))
set %name $remove(%file,.char)
if ($lines(status $+ %name $+ .txt) != $null) { .remove status $+ %name $+ .txt }
if ((%name = new_chr) || (%name = $null)) { inc %value 1 }
else {
var %clear.flag $readini($char(%name), Info, Flag)
; It may seem silly to check for monsters twice on this, after we just did it, but I've found that if there's too many files in the folder it
; may not get them all. This is a double check to get rid of them.
if ((%clear.flag = monster) || (%clear.flag = npc)) { .remove $char(%name) }
if ((%clear.flag = $null) && ($readini($char(%name), basestats, hp) = $null)) { .remove $char(%name) }
if ($file($char(%name)).size = 0) { $zap_char(%name) }
; If the person is a player, let's refill their hp/mp/stats to max.
if ((%clear.flag = $null) && ($readini($char(%name), basestats, hp) != $null)) { writeini $char(%name) DCCchat Room Lobby | $fulls(%name) }
inc %value 1
}
}
}