Yay updates!
Script will now state how much silvers you spent every time you send a package:
Code:
|-------------------------------------------------|
|Service Cost |
|-------------------------------------------------|
|Box 900 |
|Shipping 5,350 |
|Total 6,250 |
|-------------------------------------------------|
Script can now automatically collect all of your incoming packages via using the check command line variable, for example ;mail check
When started the script will run to the nearest post office, collect each package you have waiting, gather all of the items inside and STOW them all, then throw away the empty package. Script will NOT collect packages that are COD. The script will then note each package you received, who it was from, and what was inside, if a package is COD it will state it did not pick up the package and will say how much the COD of that package is.
Code:
-------------------------------------------------
Package number: 123002323
Sender: Vonaq
Contents:
yellow zircon
-------------------------------------------------
-------------------------------------------------
Package number: 123002319
Sender: Vonaq
Contents:
This package is payment upon delivery and was not collected. The COD is 500
-------------------------------------------------
-------------------------------------------------
Package number: 123002324
Sender: Vonaq
Contents:
snowflake zircon
-------------------------------------------------
Script code:
Code:
order_number = 4 #Order number of the shipping container you want to use.
get_silvers_from_bank_first = true #Enter true to have script get silvers from bank first. Enter nil to have it skip going to bank.
amount_of_silvers_to_get_from_bank = 30000 #Enter amount of silvers script will withdraw from bank. Script always deposits all silvers you have before withdrawing.
room_number_to_mail_packages_from = 30187 #Room number in the town you can mail packages from.
#Mail Speeds:
#standard = 60 minutes
#express = 20 minutes
#first = immediate
mail_speed = "first"
if script.vars.any?{ |i| i =~ /check/i }
all_mail_received = Hash.new
package_numbers_and_names = Hash.new
fput "stow left" if checkleft
fput "stow right" if checkright
start_script "go2", ["mail"]
wait_while{ running? "go2" }
fput "mail check"
while line = get
if line =~ /I'm sorry, .*, but it doesn't appear that anything has come in for you.|If you'd like to retrieve one of your parcels/
break
elsif line =~ /(\d+)\s*([a-zA-Z]+)\s+/
package_number = $1
sender = $2
package_numbers_and_names.store(package_number, :number_package => package_number, :package_sender => sender)
end
end
if package_numbers_and_names.count == 0
_respond "|-------------------------------------------------|"
_respond "|No mail. |"
_respond "|-------------------------------------------------|"
else
package_numbers_and_names.each{ |key,value|
fput "mail collect #{package_numbers_and_names[key][:number_package]}"
while line = get
if line =~ /They disappear for a little while before returning with .*, which they hand to you./
container = GameObj.right_hand
fput "open ##{container.id}"
fput "look in ##{container.id}"
wait_until { container.contents }
package_all_contents = Array.new
container.contents.each{ |i| package_all_contents.push(i.name) }
all_mail_received.store(package_numbers_and_names[key][:number_package], :number_package => package_numbers_and_names[key][:number_package], :package_sender => package_numbers_and_names[key][:package_sender], :package_contents => package_all_contents)
container.contents.each{ |i|
fput "get ##{i.id}"
fput "stow ##{i.id}"
}
fput "throw #{checkright}"
break
elsif line =~ /has been marked for payment upon delivery at a cost of (.*) silvers? by its sender/
cod_silver = $1
all_mail_received.store(package_numbers_and_names[key][:number_package], :number_package => package_numbers_and_names[key][:number_package], :package_sender => package_numbers_and_names[key][:package_sender], :package_contents => "This package is payment upon delivery and was not collected. The COD is #{cod_silver}.")
break
end
end
}
all_mail_received.each{ |key,value|
_respond
_respond "-------------------------------------------------"
_respond "Package number: #{all_mail_received[key][:number_package]}"
_respond "Sender: #{all_mail_received[key][:package_sender]}"
_respond "Contents:"
if all_mail_received.kind_of?(Array)
all_mail_received[key][:package_contents].each{ |i| _respond i }
else
_respond all_mail_received[key][:package_contents]
end
_respond "-------------------------------------------------"
_respond
}
end
else
if checkright && checkleft
echo "You need one free hand to run this script. Hold just the one item you want to mail."
elsif checkright.nil? && checkleft.nil?
echo "You must be holding the item you want to mail."
elsif script.vars[1].nil?
echo "You must specify the name of the person you are sending to. For example: ;mail Dreaven"
else
if checkright
item_to_mail = checkright
else
item_to_mail = checkleft
end
if get_silvers_from_bank_first
start_script "go2", ["bank"]
wait_while{ running? "go2" }
fput "depo all"
fput "withdraw #{amount_of_silvers_to_get_from_bank} silvers"
end
start_script "go2", [room_number_to_mail_packages_from]
wait_while{ running? "go2" }
fput "order #{order_number}"
while line = get
if line =~ /(\d+|\d+,\d+) silver/ || line =~ /price to (.*)\.\"/
box_cost = $1
elsif line =~ /You may order a QUANTITY of this item/
break
end
end
fput "buy"
if checkright != item_to_mail
fput "put my #{item_to_mail} in my #{checkright}"
fput "close my #{checkright}"
else
fput "put my #{item_to_mail} in my #{checkleft}"
fput "close my #{checkleft}"
end
fput "mail send #{script.vars[1]} #{mail_speed}"
while line = get
if line =~ /cost (.*) silvers? based/
shipping_cost = $1
break
end
end
fput "mail send #{script.vars[1]} #{mail_speed}"
box_text = "|Box #{box_cost}"
(32 - box_cost.length).times{ box_text += " " }
box_text += "|"
shipping_text = "|Shipping #{shipping_cost}"
(32 - shipping_cost.length).times{ shipping_text += " " }
shipping_text += "|"
total_cost = (box_cost.delete(",").to_i + shipping_cost.delete(",").to_i).to_i.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
total_text = "|Total #{total_cost}"
(32 - total_cost.length).times{ total_text += " " }
total_text += "|"
_respond "|-------------------------------------------------|"
_respond "|Service Cost |"
_respond "|-------------------------------------------------|"
_respond box_text
_respond shipping_text
_respond total_text
_respond "|-------------------------------------------------|"
end
end