Alphabetized Lists

Discussion in 'RGSS3 Script Requests' started by Golden Unicorn Gaming, Nov 18, 2015.

  1. Golden Unicorn Gaming

    Golden Unicorn Gaming Savior of Astoria Veteran

    Messages:
    245
    Likes Received:
    565
    Location:
    Astoria
    First Language:
    English
    Primarily Uses:
    N/A
    Hello All,

    I've looked and haven't found anything, and am now looking for help.  I use VX ACE, and the yanfly engines as add ons.  I made my game mostly stream of consciousness (so spells and items weren't planned out beforehand) and now that it's gigantic I'm looking to make searching through menus easier for the player.  As an example, the spell Heal is acquired early, so I created the skill early (it's slot #3 on skill list).  The Heal 2 spell is found much later in the game, probably after 40 more spells have become available to the player (it's slot #44 on skill list).  Rather than have to scroll through those 40 spells to find Heal 2, is there a script out there that will alphabetize the skill list, or the item list, or weapon/armor lists?  It would make things much easier on the player, IMO. 

    I realize that I can solve this by redoing all of my skills but that ain't gonna happen.  Thanks in advance.

    Luke
     
    #1
  2. Andar

    Andar Veteran Veteran

    Messages:
    28,646
    Likes Received:
    6,584
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    That is not as easy as you think it is, because the engine itself doesn't know any skill names, it works with the skill numbers.

    If you have for example an event where the player learns "Skill # 10", then that event will always teach skill #10, even if you changed the skills in the database - as soon as you do, that event would list the new name and skill under #10 as learned.

    Your only option is to have only the display in the engine resorted, and that

    1) requires a script

    2) that script will need some time to resort every time you open the skill menu

    I've moved this thread to Script Request. Please be sure to post your threads in the correct forum next time. Thank you.
     
    #2
  3. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Insert this little snippet anywhere below Materials but above Main:

    class Window_SkillList < Window_Selectable alias sort_skills9974 make_item_list def make_item_list sort_skills9974 if @data && @data != [] @data.sort_by! {|sk| sk.name} end endendclass Window_ItemList < Window_Selectable alias sort_items9974 make_item_list def make_item_list sort_items9974 if @data && @data != [] @data.sort_by! {|it| it.name} end end end
    This will sort the skill/item lists automatically for you.

    And no, it won't slow down your game at all.
     
    #3
    ZirconStorms likes this.
  4. MeowFace

    MeowFace Meow Veteran

    Messages:
    1,034
    Likes Received:
    179
    Location:
    La La Land
    First Language:
    Meowish
    Sorting has nothing to do with the graphic, so unless it's over 10k items in the list, the sort process should be instant.

    But the graphical fonts for item/skill name + icons should cause the slow down, if the list is gigantic as the OP said, the lag is already there. He might already suffer the random crash in battle/menu opening skill/item scene if he's using a custom font. Mithran's cache script should prevent those lag/crashes in a way.

    edit:

    A question though, are you sure you want to sort things by alphabetic? That won't help much in easing the player's selection imo. Since you will be mixing strong/weak skill/items by name that way. Why not sort skills by mp/tp cost and items by price?
     
    Last edited by a moderator: Nov 18, 2015
    #4
  5. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Custom fonts got nothing to do with lag. Every font is drawn the same way, all of them takes the same time to draw.


    I tested the above snippet with 140 items on the list without Mithran's script. Not even a single frame lag time. I would test with more, but I am too lazy to make hundreds of items just to test it.


    Point is, the sorting will not slow down anything, like you wrote. It is from the drawing, but even so, only if you got a really huge amount of items/skills on the list, or maybe if your PC is a toaster. :D


    Mithran's script surely helps for any scene with lotsa text displayed, and honestly, everyone who values their game enough should already use it.


    Everyone who can play RPG games knows the alphabet, therefore if the list is sorted alphabetically, the players knows exactly where to look for the specific item/skill without even knowing what that item/skill is for, regardless of the list's size.


    Sorting the lists based on other criteria (like your examples) won't help the player at all, unless he/she actually memorizes every skill and item on the list, and what they do, what they cost, and so on.


    I would surely take alphabetically sorted lists over any other sorted lists.
     
    #5
  6. MeowFace

    MeowFace Meow Veteran

    Messages:
    1,034
    Likes Received:
    179
    Location:
    La La Land
    First Language:
    Meowish
    Nope, the problem with custom font is the draw method. Some custom fonts are a few pixels bigger in size than the standard fonts. Those are the one causing the crashes. And no, 140 items is not much imo.. you will need at least 500+ with an individual icons for each to see the lag.

    well, you should see the lag with a large icon sheet even without a large list.

    Depends on the language they are using. And nope, as a player, some will prefer their skills to be sorted by weak to strong for fast access. If it's a large list. skill cost is more effective than alphabetic order. Especially if you can't remember the skill name/effect, one will have to read through every single skill to check which's stronger or cost effective, because sorting by name will have weak/strong skill scrambled all over the list. A veteran will mostly just press the up key to go to the last skill as it's being expected to be the strongest available. There are other sort like by types, heal/atk/def, and each are further sorted down by cost. That's the best imo.
     
    #6
  7. Golden Unicorn Gaming

    Golden Unicorn Gaming Savior of Astoria Veteran

    Messages:
    245
    Likes Received:
    565
    Location:
    Astoria
    First Language:
    English
    Primarily Uses:
    N/A
    Thanks to all for the help, especially Sixth.  That script works beautifully, and should make things easier on everyone.  My game is intended to be commercial.  Is it alright if I credit you?

    Luke
     
    #7
  8. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Sure, if you want, you can credit me. I don't require it for that little snippet, but it is always a nice gesture regardless.


    You are welcome!
     
    #8
  9. ZirconStorms

    ZirconStorms VX & VX Ace Scripts Veteran

    Messages:
    332
    Likes Received:
    108
    First Language:
    English
    Primarily Uses:
    RMVXA
    Script snippet reformatted.

    Code:
    #Credit: Sixth
    #Sorts item list alphabetically.
    
    class Window_SkillList < Window_Selectable
      alias sort_skills9974 make_item_list
      def make_item_list
        sort_skills9974
        if @data && @data != []
          @data.sort_by! {|sk| sk.name}
        end
      end
    end
    
    class Window_ItemList < Window_Selectable
      alias sort_items9974 make_item_list
      def make_item_list
        sort_items9974
        if @data && @data != []
          @data.sort_by! {|it| it.name}
        end
      end
      end
     
    #9

Share This Page