Register
Results 1 to 7 of 7
  1. #1

    TSM_Mailing attachment order

    I'm trying to figure out why TSM_Mailing seems to add attachments to the mail in an almost random order. From looking at the code, shouldn't it be adding things in order of itemid or the bag/slot index?

  2. #2
    Kathroman's Avatar
    Posts
    5,450
    Reputation
    286
    Blog Entries
    20
    Tagged in
    2155 Posts
    Add to this user's reputation
    Quote Originally Posted by morfraen View Post
    I'm trying to figure out why TSM_Mailing seems to add attachments to the mail in an almost random order. From looking at the code, shouldn't it be adding things in order of itemid or the bag/slot index?
    From my experience, it does. You'll probably need to provide a bit more detail about what you feel is "random". Whenever I've used it, it's gone through each destination toon in order, suggesting that it was pulling on a sequential basis.
    Like what you see? Become an Ethereal Contributor to help support the site and gain access to additional perks.

        

    Guides: Thunder Bluff Vendor Supply Route | Entry Level JC Strategy | Alternative DMF Guide

    TSM 2.0: TSM 2.0 Groups & Operations GUIDE | TSM 2.0 Basic JC Shuffler | TSM 2.0 ADVANCED JC Shuffler

  3. #3
    Well right now I have this in my bags, printed in the order StartAutoMailing finds them, which is as expected the bags walked in order.

    name : itemID : bag,slot

    Greenweave Branch : 9769 : 0,1
    Mistscape Stave : 7611 : 0,6
    Elder's Cloak : 7356 : 0,9
    Simple Robe : 9748 : 0,11
    Bright Cloak : 6381 : 0,14
    Bright Cloak : 6381 : 1,20
    Elunarian Cloak : 14459 : 1,25
    Greenweave Vest : 9774 : 2,18
    Simple Britches : 9747 : 2,22
    Bright Boots : 3065 : 2,26
    Shadow Council Orb : 25093 : 3,6
    Seer's Belt : 4699 : 3,9
    Mystical Cape : 10174 : 3,10
    Imperial Red Scepter : 15930 : 4,20
    Royal Cape : 9908 : 4,22


    And then in the order that it tries to mail them, which is the same as the order of private.mailTargets["target player"].

    15930
    9769
    4699
    9908
    7356
    9747
    14459
    15946
    10174
    25093
    3065
    9774

    And that order changes if I move items around in my bags. I'm thinking that there needs to be a sort() somewhere so things are ordered by itemID (or eventually by item name for my purposes).

  4. #4
    Drethic's Avatar
    Posts
    170
    Reputation
    12
    Tagged in
    66 Posts
    Add to this user's reputation
    Quote Originally Posted by morfraen View Post
    Well right now I have this in my bags, printed in the order StartAutoMailing finds them, which is as expected the bags walked in order.

    name : itemID : bag,slot

    Greenweave Branch : 9769 : 0,1
    Mistscape Stave : 7611 : 0,6
    Elder's Cloak : 7356 : 0,9
    Simple Robe : 9748 : 0,11
    Bright Cloak : 6381 : 0,14
    Bright Cloak : 6381 : 1,20
    Elunarian Cloak : 14459 : 1,25
    Greenweave Vest : 9774 : 2,18
    Simple Britches : 9747 : 2,22
    Bright Boots : 3065 : 2,26
    Shadow Council Orb : 25093 : 3,6
    Seer's Belt : 4699 : 3,9
    Mystical Cape : 10174 : 3,10
    Imperial Red Scepter : 15930 : 4,20
    Royal Cape : 9908 : 4,22


    And then in the order that it tries to mail them, which is the same as the order of private.mailTargets["target player"].

    15930
    9769
    4699
    9908
    7356
    9747
    14459
    15946
    10174
    25093
    3065
    9774

    And that order changes if I move items around in my bags. I'm thinking that there needs to be a sort() somewhere so things are ordered by itemID (or eventually by item name for my purposes).
    What are you sending? Looks like disenchantable greens. For something like that it won't sort. @Bart39 may know if it sorts preset lists.
    TSM Web Master / Assistant Addon Developer
    For information: TSM Website, TSM Addon, TSM App.
    Also Follow TSM on Twitter, and Like TSM on Facebook!
    If you need help with any of the above hop on Chat. It's much faster than posting

  5. #5
    They're transmog greens. I added them to a list to avoid the DE code complicating things. This note from http://lua-users.org/wiki/TablesTutorial may explain things.



    "Note, there is no guarantee as to the order in which keys will be stored in a table when using dictionaries so the order of retrieval of keys using pairs() is not guaranteed"

  6. #6
    Drethic's Avatar
    Posts
    170
    Reputation
    12
    Tagged in
    66 Posts
    Add to this user's reputation
    Quote Originally Posted by morfraen View Post
    They're transmog greens. I added them to a list to avoid the DE code complicating things. This note from http://lua-users.org/wiki/TablesTutorial may explain things.



    "Note, there is no guarantee as to the order in which keys will be stored in a table when using dictionaries so the order of retrieval of keys using pairs() is not guaranteed"
    You are correct, any array/table structure is at the mercy of how it was added unless there is another step to create an ipair table that is sorted. @Bart39 has been reworking that code a lot and would know best if a sort feature is in there for any of the functions.
    TSM Web Master / Assistant Addon Developer
    For information: TSM Website, TSM Addon, TSM App.
    Also Follow TSM on Twitter, and Like TSM on Facebook!
    If you need help with any of the above hop on Chat. It's much faster than posting

  7. #7
    Definitely isn't any sort feature in the current code, think I've figured out how to make it do what I want though, which is sort a bag full of transmog greens. Though sorting by itemid is easy, sorting by name may take some more work.

    For general use, it'd be much improved if the default behavior would mail things in the order that they are in the bags rather than the arbitrary table order. For ex. if you open 8+ mails of stuff, it's often preferable that it be mailed out in the same order that it came in.

 

 

Similar Threads

  1. TSM_Mailing
    By Aerodynamic in forum Archive (Addons and Macros)
    Replies: 4
    Last Post: February 7th, 2012, 01:53 PM
  2. TSM_Mailing
    By Lutheros in forum General TradeSkillMaster Discussion
    Replies: 3
    Last Post: January 18th, 2012, 10:29 AM
  3. Alternative to TSM_Mailing?
    By smrdlja in forum Archive (Addons and Macros)
    Replies: 9
    Last Post: September 2nd, 2011, 05:21 PM
  4. Recent Issue with TSM_Mailing
    By Squishes in forum General TradeSkillMaster Discussion
    Replies: 2
    Last Post: July 26th, 2011, 08:38 PM
  5. TSM_Mailing Request
    By pahr in forum General TradeSkillMaster Discussion
    Replies: 3
    Last Post: July 2nd, 2011, 03:17 AM