Renian
06-05-2008, 09:25 PM
This is the healbot script that made Itzel flip out against me. I thought I'd post in here in celebration of the new subforum.
Known issues:
Sometimes, the script heals scars with too little mana. This shouldn't be a problem with a large amount of mana.
The script won't always get the person's right hand wound when they are incinerated.
Quirks:
The script automatically removes scars until they hit rank 1.
If you shake your head, it sends 50 mana to you.
If you cry, the healer will cast unpoison on you.
Tapping the healer invokes the healing method.
echo "Just Injuries must be displayed in Stormfront's injuries window for this to work."
echo "if someone nods at tiad he breaks, the command doesn't understand."
load "scripts/innercircle.rb"
innercircle = circle()
def load_wounddat
f = File.new("#{$lich_dir}wounds.dat", "r")
array = f.readlines
f.close
wound_hash = Hash.new
while(!array.empty?)
#echo array.shift
wound_desc = array.shift.chomp
wound_loc = array.shift.chomp
wound_hash[wound_desc] = wound_loc
end
return wound_hash
end
def heal_scar(spell, times)
while(times>0)
fput "incant #{spell}"
sleep 1
sleep_time = matchfind("Roundtime: ? sec", "Cast Roundtime ? seconds")
sleep(sleep_time.to_f + 0.5)
times = times - 1
end
end
def in_rt
#echo $_TAGHASH_["GSq"].to_i #now
#echo $_TAGHASH_["GSQ"].to_i #over
if($_TAGHASH_["GSq"].to_i > $_TAGHASH_["GSQ"].to_i)
return false
end
return true
end
def scar_count(wound)
if(wound>1)
return wound - 1
else
return 0
end
end
def heal_to_rank(level)
while(checkhealth < 145 && checkmana > 5)
echo "Healing blood."
put "prep 1101"
put "cure"
sleep 3.5
end
echo "Healing rank #{level + 1}."
wound_next = false
while(!wound_next)
if(Wounds.rhand > level || Wounds.lhand > level || Wounds.rarm > level || Wounds.larm > level || Wounds.rleg > level || Wounds.lleg > level)
cost = 2
if(Wounds.rhand > 1 || Wounds.lhand > 1 || Wounds.rarm > 1 || Wounds.larm > 1 || Wounds.rleg > 1 || Wounds.lleg > 1)
cost += 5
end
if(checkmana.to_i < cost)
sleep 10
next
end
put "incant 1102"
sleep_time = matchfind("Roundtime: ? sec", "Cast Roundtime ? seconds")
sleep(sleep_time.to_f + 0.5)
else
wound_next = true
end
end
wound_next = false
while(!wound_next)
if(Wounds.nerves > 0)
cost = 3
if(Wounds.nerves > 1)
cost += 5
end
if(checkmana.to_i < cost)
sleep 10
next
end
put "incant 1103"
sleep 1
sleep_time = matchfind("Roundtime: ? sec", "Cast Roundtime ? seconds")
sleep(sleep_time.to_f + 0.5)
else
wound_next = true
end
end
wound_next = false
while(!wound_next)
if(Wounds.head > 0 || Wounds.neck > level)
cost = 4
if(Wounds.head > 1 || Wounds.neck > 1)
cost += 5
end
if(checkmana.to_i < cost)
sleep 10
next
end
put "incant 1104"
sleep_time = matchfind("Roundtime: ? sec", "Cast Roundtime ? seconds")
sleep(sleep_time.to_f + 0.5)
else
wound_next = true
end
end
wound_next = false
while(!wound_next)
if(Wounds.leye > level || Wounds.reye > level || Wounds.chest > level || Wounds.back > level || Wounds.abs > level)
cost = 5
if(Wounds.leye > 1 || Wounds.reye > 1 || Wounds.chest > 1 || Wounds.back > 1 || Wounds.abs > 1)
cost += 5
end
if(checkmana.to_i < cost)
sleep 10
next
end
put "incant 1105"
sleep_time = matchfind("Roundtime: ? sec", "Cast Roundtime ? seconds")
sleep(sleep_time.to_f + 0.5)
else
wound_next = true
end
end
end
$wound_hash = load_wounddat
def wounds_to_array(line)
if(line.nil?)
return Array.new
end
if(line =~ /has no apparent injuries/)
return Array.new
end
array = Array.new
$wound_hash.keys.each{ |wound_key|
if(line =~ /#{wound_key}/)
array[array.length] = wound_key
end
}
return array
end
def heal_target(person)
put "appraise " + person
line = waitfor("You take a quick appraisal of ")
array = wounds_to_array(line)
while(!array.empty?)
str = array.shift
#echo wound_hash[str]
if(str.length > 1 && $wound_hash[str])
put "transfer " + person + " " + $wound_hash[str]
waitfor("You meditate over")
end
end
if(checkhealth > 75)
put "transfer " + person
pause 1
end
nervesrank = scar_count(Wounds.nerves)
limbrank = scar_count(Wounds.rhand) + scar_count(Wounds.lhand) + scar_count(Wounds.rarm) + scar_count(Wounds.larm) + scar_count(Wounds.rleg) + scar_count(Wounds.lleg)
organrank = scar_count(Wounds.leye) + scar_count(Wounds.reye) + scar_count(Wounds.chest) + scar_count(Wounds.back) + scar_count(Wounds.abs)
headrank = scar_count(Wounds.head) + scar_count(Wounds.neck)
heal_to_rank(2)
heal_to_rank(1)
heal_to_rank(0)
heal_scar(1114, organrank)
heal_scar(1113, headrank)
heal_scar(1112, nervesrank)
heal_scar(1111, limbrank)
echo "Healing is complete."
end
################################################## ################################################## ########
start_script("goto", "reload")
while running?("goto")
sleep 0.1
end
while(true)
target_line = waitfor("taps you lightly", "You nod to ", "bursts into tears!", "shakes", "nods to", /\[Private\]\-/)
echo target_line
if(target_line =~ /You nod to (.*)\./i)
heal_target($1)
end
innercircle.each do |person|
if(target_line =~ /#{person} taps you lightly on the shoulder/i)
heal_target(person)
elsif(target_line =~ /#{person} nods to (.*)\./i)
heal_target($1)
elsif(target_line =~ /#{person} shakes .+ head/i)
if mana?(50)
put "send 50 #{person}"
end
elsif(target_line =~ /\[Private\]\-#{person}\: \"Heal (.+) at (\d+)\"/i)
fput "look"
sleep 5
unless ((Room[$2].id > 4972) and (Room[$2].id < 5180))
fput "disband"
fput "group open"
start_script("goto", $2)
sleep 2
unpause_script("goto")
while running?("goto")
sleep 0.5
end
heal_target($1)
start_script("goto", "innercircle")
sleep 2
unpause_script("goto")
while running?("goto")
sleep 0.5
end
end
elsif(target_line =~ /#{person} bursts into tears/i)
if mana?(14)
fput "prep 114"
fput "cast #{person}"
else
fput "wave #{person}"
fput "snicker #{person}"
end
end
end
end
Innercircle.rb is used to parse your innercircle.dat file, which defines the people that can use your healbot. You need it to run healbot.
def circle()
f = File.new("#{$script_dir}/innercircle.dat", "r")
array = f.readlines
f.close
innercircle = Array.new
while(!array.empty?)
#echo array.shift
innercircle.push(array.shift.chomp)
end
return innercircle
end
Known issues:
Sometimes, the script heals scars with too little mana. This shouldn't be a problem with a large amount of mana.
The script won't always get the person's right hand wound when they are incinerated.
Quirks:
The script automatically removes scars until they hit rank 1.
If you shake your head, it sends 50 mana to you.
If you cry, the healer will cast unpoison on you.
Tapping the healer invokes the healing method.
echo "Just Injuries must be displayed in Stormfront's injuries window for this to work."
echo "if someone nods at tiad he breaks, the command doesn't understand."
load "scripts/innercircle.rb"
innercircle = circle()
def load_wounddat
f = File.new("#{$lich_dir}wounds.dat", "r")
array = f.readlines
f.close
wound_hash = Hash.new
while(!array.empty?)
#echo array.shift
wound_desc = array.shift.chomp
wound_loc = array.shift.chomp
wound_hash[wound_desc] = wound_loc
end
return wound_hash
end
def heal_scar(spell, times)
while(times>0)
fput "incant #{spell}"
sleep 1
sleep_time = matchfind("Roundtime: ? sec", "Cast Roundtime ? seconds")
sleep(sleep_time.to_f + 0.5)
times = times - 1
end
end
def in_rt
#echo $_TAGHASH_["GSq"].to_i #now
#echo $_TAGHASH_["GSQ"].to_i #over
if($_TAGHASH_["GSq"].to_i > $_TAGHASH_["GSQ"].to_i)
return false
end
return true
end
def scar_count(wound)
if(wound>1)
return wound - 1
else
return 0
end
end
def heal_to_rank(level)
while(checkhealth < 145 && checkmana > 5)
echo "Healing blood."
put "prep 1101"
put "cure"
sleep 3.5
end
echo "Healing rank #{level + 1}."
wound_next = false
while(!wound_next)
if(Wounds.rhand > level || Wounds.lhand > level || Wounds.rarm > level || Wounds.larm > level || Wounds.rleg > level || Wounds.lleg > level)
cost = 2
if(Wounds.rhand > 1 || Wounds.lhand > 1 || Wounds.rarm > 1 || Wounds.larm > 1 || Wounds.rleg > 1 || Wounds.lleg > 1)
cost += 5
end
if(checkmana.to_i < cost)
sleep 10
next
end
put "incant 1102"
sleep_time = matchfind("Roundtime: ? sec", "Cast Roundtime ? seconds")
sleep(sleep_time.to_f + 0.5)
else
wound_next = true
end
end
wound_next = false
while(!wound_next)
if(Wounds.nerves > 0)
cost = 3
if(Wounds.nerves > 1)
cost += 5
end
if(checkmana.to_i < cost)
sleep 10
next
end
put "incant 1103"
sleep 1
sleep_time = matchfind("Roundtime: ? sec", "Cast Roundtime ? seconds")
sleep(sleep_time.to_f + 0.5)
else
wound_next = true
end
end
wound_next = false
while(!wound_next)
if(Wounds.head > 0 || Wounds.neck > level)
cost = 4
if(Wounds.head > 1 || Wounds.neck > 1)
cost += 5
end
if(checkmana.to_i < cost)
sleep 10
next
end
put "incant 1104"
sleep_time = matchfind("Roundtime: ? sec", "Cast Roundtime ? seconds")
sleep(sleep_time.to_f + 0.5)
else
wound_next = true
end
end
wound_next = false
while(!wound_next)
if(Wounds.leye > level || Wounds.reye > level || Wounds.chest > level || Wounds.back > level || Wounds.abs > level)
cost = 5
if(Wounds.leye > 1 || Wounds.reye > 1 || Wounds.chest > 1 || Wounds.back > 1 || Wounds.abs > 1)
cost += 5
end
if(checkmana.to_i < cost)
sleep 10
next
end
put "incant 1105"
sleep_time = matchfind("Roundtime: ? sec", "Cast Roundtime ? seconds")
sleep(sleep_time.to_f + 0.5)
else
wound_next = true
end
end
end
$wound_hash = load_wounddat
def wounds_to_array(line)
if(line.nil?)
return Array.new
end
if(line =~ /has no apparent injuries/)
return Array.new
end
array = Array.new
$wound_hash.keys.each{ |wound_key|
if(line =~ /#{wound_key}/)
array[array.length] = wound_key
end
}
return array
end
def heal_target(person)
put "appraise " + person
line = waitfor("You take a quick appraisal of ")
array = wounds_to_array(line)
while(!array.empty?)
str = array.shift
#echo wound_hash[str]
if(str.length > 1 && $wound_hash[str])
put "transfer " + person + " " + $wound_hash[str]
waitfor("You meditate over")
end
end
if(checkhealth > 75)
put "transfer " + person
pause 1
end
nervesrank = scar_count(Wounds.nerves)
limbrank = scar_count(Wounds.rhand) + scar_count(Wounds.lhand) + scar_count(Wounds.rarm) + scar_count(Wounds.larm) + scar_count(Wounds.rleg) + scar_count(Wounds.lleg)
organrank = scar_count(Wounds.leye) + scar_count(Wounds.reye) + scar_count(Wounds.chest) + scar_count(Wounds.back) + scar_count(Wounds.abs)
headrank = scar_count(Wounds.head) + scar_count(Wounds.neck)
heal_to_rank(2)
heal_to_rank(1)
heal_to_rank(0)
heal_scar(1114, organrank)
heal_scar(1113, headrank)
heal_scar(1112, nervesrank)
heal_scar(1111, limbrank)
echo "Healing is complete."
end
################################################## ################################################## ########
start_script("goto", "reload")
while running?("goto")
sleep 0.1
end
while(true)
target_line = waitfor("taps you lightly", "You nod to ", "bursts into tears!", "shakes", "nods to", /\[Private\]\-/)
echo target_line
if(target_line =~ /You nod to (.*)\./i)
heal_target($1)
end
innercircle.each do |person|
if(target_line =~ /#{person} taps you lightly on the shoulder/i)
heal_target(person)
elsif(target_line =~ /#{person} nods to (.*)\./i)
heal_target($1)
elsif(target_line =~ /#{person} shakes .+ head/i)
if mana?(50)
put "send 50 #{person}"
end
elsif(target_line =~ /\[Private\]\-#{person}\: \"Heal (.+) at (\d+)\"/i)
fput "look"
sleep 5
unless ((Room[$2].id > 4972) and (Room[$2].id < 5180))
fput "disband"
fput "group open"
start_script("goto", $2)
sleep 2
unpause_script("goto")
while running?("goto")
sleep 0.5
end
heal_target($1)
start_script("goto", "innercircle")
sleep 2
unpause_script("goto")
while running?("goto")
sleep 0.5
end
end
elsif(target_line =~ /#{person} bursts into tears/i)
if mana?(14)
fput "prep 114"
fput "cast #{person}"
else
fput "wave #{person}"
fput "snicker #{person}"
end
end
end
end
Innercircle.rb is used to parse your innercircle.dat file, which defines the people that can use your healbot. You need it to run healbot.
def circle()
f = File.new("#{$script_dir}/innercircle.dat", "r")
array = f.readlines
f.close
innercircle = Array.new
while(!array.empty?)
#echo array.shift
innercircle.push(array.shift.chomp)
end
return innercircle
end