ISXVG now supports all aspects of sending/receiving mail via the in-game mailboxes! While I'm not going to write entire sample scripts, I will give you a few snippets on how to do varoius things (with a few comments/ideas). I will leave it up to the major script authors to put together packaged scripts/executables that interact more fully with the mail system.
Please note that all of these snippets require you to be close to a mailbox.
1. Sending Email
II. Receiving Mail
III. Misc.
Please note that all of these snippets require you to be close to a mailbox.
1. Sending Email
Code:
[B]Pawn[[COLOR=blue]Mailbox[/COLOR]]:DoubleClick[/B]
;; You do not have to be on the 'Compose' tab in order to use this snippet
[B]VGUI[[COLOR=blue]recipient_name[/COLOR]]:SetText[[COLOR=blue]Amadeus[/COLOR]][/B]
[B]VGUI[[COLOR=blue]subject_text[/COLOR]]:SetText[[COLOR=blue]Hello[/COLOR]!][/B]
[B]VGUI[[COLOR=blue]body_text[/COLOR]]:SetText[[COLOR=blue]This is a sample mail from me to you!][/COLOR][/B]
;; Note: setting the 'body_text' is a little buggy in that it won't accept
;; long strings at the moment. Fix will be incoming.
; If you want to attach an item...
[B]Me.Inventory[[COLOR=blue]Pearl[/COLOR]]:AttachToMail[/B]
; Setting the "coin" values (for either sending money, or sending COD)
[B]VGUI[[COLOR=blue]_mail_offer_copper[/COLOR]]:SetText[10][/B]
[B]VGUI[[COLOR=blue]_mail_offer_silver[/COLOR]]:SetText[[COLOR=blue]1[/COLOR]][/B]
[B];VGUI[[COLOR=blue]_mail_offer_gold[/COLOR]]:SetText[[COLOR=blue]2[/COLOR]][/B]
[B];VGUI[[COLOR=blue]_mail_offer_platinum[/COLOR]]:SetText[[COLOR=blue]3[/COLOR]][/B]
; Would you like to send it COD?
[B]Mail:SetCOD[/B]
; Want to know how much the shipping costs will be? (Note: Postage costs are so low that they're not included in this API. So, this only returns a value when you're shipping an item or money.)
[B]echo ${GV[[COLOR=blue]int,MailTotalCost[/COLOR]]}[/B]
; You can cancel by doing "Mail:Cancel" ...or, to send it, use this:
[B]Mail:Send[/B]
Code:
[B]Pawn[[COLOR=blue]Mailbox[/COLOR]]:DoubleClick[/B]
echo I have [B]${Mail.NumMessages}[/B] in my mailbox.
; You would then iterate through if you wished using the concepts below:
echo First Message:
echo FROM: [B]${Mail.Message[1].From}[/B]
echo SUBJECT: [B]${Mail.Message[1].Subject}[/B]
echo BODY: [B]${Mail.Message[1].Body}[/B]
echo Unread: [B]${Mail.Message[1].IsUnread}[/B]
echo ShippingFee: [B]${Mail.Message[1].ShippingFee}[/B]
; Does it have money attached to it? If so, take it!
if ([B]Mail.Message[1].AttachedCoin[/B] > [COLOR=blue]0[/COLOR])
{
[B]Mail.Message[1]:TakeCoin[/B]
}
; does it have an item attached? If so, then take it if the shipping fees
; are less than 1 silver. (You would design your own 'conditions' by which
; you would take an item or not.) Otherwise, Return it.
if (${Mail.Message[1].AttachedItem(exists)})
{
if ( [B]${Mail.Message[1].ShippingFee}[/B] < [COLOR=blue]100[/COLOR] )
{
[B]Mail.Message[1]:TakeItem[/B]
}
else
{
[B]Mail.Message[1]:Return[/B]
}
}
Code:
; To Delete a piece of Mail
[B]Mail.Message[#]:Delete[/B]
; To Read a piece of mail
[B]Mail.Message[#]:Read[/B]
; To REPLY to a piece of mail
[B]Mail.Message[#]:Reply[/B]