Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Anyone interested in creating a MAIL script?

  1. #1

    Post Anyone interested in creating a MAIL script?

    Hold item in your hand. ;mail <postage> target

    Any city, picks box, sends.

    Bonus for ;mail check function.

  2. #2

    Default

    I've never gotten around to playing with the in game mail system. Sounded more complicated than it needed to be when they released it. What all is involved? Don't you have to buy stamps and pay more silver based on item weight or something?

  3. #3

    Default

    Quote Originally Posted by Tgo01 View Post
    I've never gotten around to playing with the in game mail system. Sounded more complicated than it needed to be when they released it. What all is involved? Don't you have to buy stamps and pay more silver based on item weight or something?
    Same man. But now I have a use case for my characters. I bought a crucible, so i want to start smelting down stuff i find. I have to mail that stuff to my smelter with as little hassle as possible.

    The mail system was surprisingly simple. Scripting it would be a breeze. You could even do it in Wrayth scripting but lich would be nicer.

    So you:
    1. go to the mail place
    2. order a box from the merchant there
    3. put your item in the box, close it
    4. then mail <priority> <target>

    Prices are on the wiki here: https://gswiki.play.net/Mail_system

    Once in the mail room you can activate the mail commands as follows

    MAIL CHECK - checks your received mail
    MAIL COLLECT {stamp #} - collects a parcel mailed to you
    MAIL DND {on|off} - toggles do not disturb on or off
    MAIL RETRIEVE {stamp #} - retrieves a sent parcel that the recipient has not picked up
    MAIL ESTIMATE {item} - estimates the cost of sending the designated item
    MAIL REJECT {stamp #} - returns a mail item to its sender
    MAIL SEND {name} - send the item in your hands (prioritizing right)
    to the designated person's mailbox
    MAIL SEND {name} COD {amount} - sends mail, requests payment on delivery
    MAIL STATUS - checks the status of your sent mail

    Update: i'm not sure why the wiki talks about stamps. I dont believe i did anything at all with stamps. Maybe its a flavor thing? Or maybe the wiki is outdated.
    Last edited by nocturnix; 03-15-2023 at 07:37 AM.

  4. #4

    Default

    Yeah maybe they got rid of stamps because people complained about the unnecessary hassle.

  5. #5

    Default

    The mail clerk will do all the stamp stuff for you. I think it's slightly more expensive, but we're talking a few hundred silvers more expensive - nothing massive. That change came out a few months ago.

  6. #6

    Default

    Alright, wrote up a simple little script:

    Reason you have to specify which room you mail packages from is because the required room in Icemule isn't tagged at all and ;go2 mail brings you to a room you can't mail packages from. So not sure if the other towns aren't tagged properly or not so it's an option there.

    Just have the item you want to mail in either hand, be sure you have one hand free, and specify the name of the person you are mailing to when starting the script. Example: ;mail dreaven

    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 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}"
    	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
    	2.times{ fput "mail send #{script.vars[1]} #{mail_speed}" }
    end
    Last edited by Tgo01; 03-21-2023 at 01:56 AM.

  7. #7

    Default

    Quote Originally Posted by Tgo01 View Post
    Alright, wrote up a simple little script:

    Reason you have to specify which room you mail packages from is because the required room in Icemule isn't tagged at all and ;go2 mail brings you to a room you can't mail packages from. So not sure if the other towns aren't tagged properly or not so it's an option there.

    Just have the item you want to mail in either hand, be sure you have one hand free, and specify the name of the person you are mailing to when starting the script. Example: ;mail dreaven

    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 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}"
    	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
    	2.times{ fput "mail send #{script.vars[1]} #{mail_speed}" }
    end
    I uploaded this as mail.

    ;repos download mail --game=any

  8. #8

    Default

    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
    Last edited by Tgo01; 05-13-2023 at 04:45 AM.

  9. #9

    Default

    This sounds great! I will try it out next time I'm in game, been working at an actual office lately so have less time to login but should on weekend or so.

  10. #10

    Default

    It seems to be using the wrong room number in Teras. Can I specify the mail room number?

    I tried:

    ;mail name RN

    But i don't think that works.

    FYI teras mail room number is: 30290. ;go mail works there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •