Tool for remove unused variables and swtiches in VX Ace

Discussion in 'Resource Requests' started by toto8080, May 4, 2018.

  1. toto8080

    toto8080 Villager Member

    Messages:
    15
    Likes Received:
    0
    First Language:
    German
    Primarily Uses:
    RMVXA
    There is a program called RMTool for RM2k and RM2k3, which scans RPG Maker games for missing files and gives instructions on how we can fix them.
    My project is pretty huge, and I want to be sure, that I didn't left any unused variables, switches, events in the final product. The problem is, that the RMTool isn't compatible with newer RM versions.

    So, is there any kind built-in mechanism, or Tool for VX Ace, that works the same as RMTool did?
     
    #1
  2. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,488
    Likes Received:
    5,094
    Location:
    Riftverse
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    The question is why bother? Unused switches and variables won't do much on your project (it wont drop your game performance, nor contribute in the game size), unlike unused files.
     
    #2
  3. cabfe

    cabfe Cool Cat Veteran

    Messages:
    2,307
    Likes Received:
    2,405
    Location:
    France
    First Language:
    French
    Primarily Uses:
    RMVXA
    @toto8080 I'm not sure if your question has been correctly formulated, as your example with RM2K is about *missing* resources while your example with VXAce is about *extra* resources (switches, in that case).
     
    #3
  4. toto8080

    toto8080 Villager Member

    Messages:
    15
    Likes Received:
    0
    First Language:
    German
    Primarily Uses:
    RMVXA
    The mentioned project is for education purposes, therefore it's not really good, if I leave in some unused variables and switchies. It will probably confuse the user, which I dont want, of course.

    If I know it correctly, the program could do both. So if there were missing resources it could warn us, and if you had extra resources, you could remove them just one mouseclick with this program. I'm looking for a tool, that is capable to do the second thing, so I could delete the extra, unused resources. :)
     
    #4
  5. Andar

    Andar Veteran Veteran

    Messages:
    28,675
    Likes Received:
    6,594
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    I think you're mixing up things that have nothing to do with each other.

    It is technically impossible to "remove unused variables", because the variables are organized by ID and removing any part of that array will cause all later variables to become unusable and wrong. Your game will simply no longer work.
    And the second wrong assumption is that the user can see the variables - variables are internal and completely invisible to the player unless you (as the developer) specifically display them somewhere.
    Third, while files have their representations, variables and switches have not - there is nothing to remove from a game.

    The only thing you can do is before you deploy and distribute your game, you can go into the variables window and change the maximum to that of the highest switch or variable ID used.
    If you skipped some ID numbers in that list, your only option is to manually change all variables in every event for a new list.
    This can never be automated for a lot of reasons.
     
    #5
  6. toto8080

    toto8080 Villager Member

    Messages:
    15
    Likes Received:
    0
    First Language:
    German
    Primarily Uses:
    RMVXA
    Thats actually not true. Switches and variables act different than events, and their ID's wont shift up when you delete them manually.

    I would like to write a tutorial about the distributed program, and I dont want to show the unused variables in the pictures, because it may confuse the reader. It would be much better and cleaner, if I could just remove the switch, which serves no purpose (idk, maybe there is a tool which can detect variables that are declared, but never used)

    Like you mentioned, it is a possible solution, if I change the ID's manually, but I have a huge project, and it's very likely, that I accindentally forget to change one or two... this is the reason why Im asking about a tool, which could do this job for me, but it seems like that kind of program doesnt exist yet.
     
    #6
  7. Shaz

    Shaz Veteran Veteran

    Messages:
    37,920
    Likes Received:
    11,586
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Which is why it's pointless to try to "remove" them. The best you can do is remove their names, which might save your game a few bytes for each one, but the switch/variable itself is still there because you haven't remove it - you've only removed the name you applied to it. Hardly worth the trouble. And, for the record, if you go into the GameSystem.json file and delete switch and variable names, without leaving a 'null' or something like that in its place, the IDs WILL shift up.

    The reason you could do that (clear the names of unused switches & variables) in the older engines is that the engines controlled ALL use of switches and variables. If it was found in a condition or an event command, you knew it was in use. If it couldn't be found anywhere in the database or events, you knew it wasn't in use. From XP onwards, that is no longer true. The moment scripts were introduced (and plugins for MV), you no longer have full visibility into where switches & variables are used. Just because you can't find it being used in the database or event commands or conditions, does not mean it's not used. There are a number of scripts/plugins that use switches & variables and you never have to use them anywhere else in your game. These would not be picked up by such a tool, so the tool would incorrectly think they're unused.
     
    #7
    toto8080 likes this.
  8. toto8080

    toto8080 Villager Member

    Messages:
    15
    Likes Received:
    0
    First Language:
    German
    Primarily Uses:
    RMVXA
    Oh, I see! Thank you for the explanation! :)
     
    #8

Share This Page