Ruby/RGSSx questions that don't deserve their own thread

Discussion in 'RGSSx Script Support' started by Mr. Bubble, Mar 14, 2012.

  1. ZirconStorms

    ZirconStorms VX & VX Ace Scripts Veteran

    Messages:
    332
    Likes Received:
    107
    First Language:
    English
    Primarily Uses:
    RMVXA
  2. DerVVulfman

    DerVVulfman Resident Werewolf Veteran

    Messages:
    305
    Likes Received:
    149
    First Language:
    English
    Primarily Uses:
    RMXP
    Hopefully, someone has knowledge of this person's scripts, or that he will eventually return to update. That's why I dropped DropBox a year ago. And for the record, the wayback machine did no good as it only grabbed the initial page and none of the additional blogspot links it seems
     
    ZirconStorms likes this.
  3. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,440
    Likes Received:
    5,029
    Location:
    Riftverse
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    I know the person. He was a part of our local Indonesian RM community. But he's already long gone, and I forgot his FB name (or he might change his FB name again or something). In short, yeah idk how to contact him anymore.
     
  4. ZirconStorms

    ZirconStorms VX & VX Ace Scripts Veteran

    Messages:
    332
    Likes Received:
    107
    First Language:
    English
    Primarily Uses:
    RMVXA
    Yeah, I checked through those forums too haha
    His name was cleosetric I believe. Tried visiting his deviantart, other social media, etc - but nothing so far.
    Maybe they're just impossible to retrieve but it'd be nice to archive them.
     
  5. Chucksaints

    Chucksaints Veteran Veteran

    Messages:
    32
    Likes Received:
    1
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
    Hi there!
    How can I put for instance LV 1 to LV 01?
    also how to change the color if the first case is 0 ?

    thanks in advance
     
  6. ZirconStorms

    ZirconStorms VX & VX Ace Scripts Veteran

    Messages:
    332
    Likes Received:
    107
    First Language:
    English
    Primarily Uses:
    RMVXA
    Removed code, use the code provided by Sixth.
     
    Last edited: Apr 15, 2019
  7. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Code:
    change_color(actor.level > 9 ? text_color(17) : normal_color)
    draw_text(x + 32, y, 24, line_height, sprintf("%02d", actor.level), 2)
    
    Use the built-in text formatting options instead.

    Also, never do this in your code:
    Code:
    method_1 if xyz > value
    method_2 if xyz < value
    method_3 if xyz == value
    method_4 if xyz != value
    # Or even worse:
    method_1 if xyz < value
    method_2 if xyz < value
    
    If xyz can't change in the executed conditioned methods, there is no reason to recheck xyz every single time.
    Use elsif or case (if applicable) statements, and group your methods inside a single branch when possible.
     
    ZirconStorms likes this.
  8. ZirconStorms

    ZirconStorms VX & VX Ace Scripts Veteran

    Messages:
    332
    Likes Received:
    107
    First Language:
    English
    Primarily Uses:
    RMVXA
    My bad, Kept messing up with the draw_text method and rushed for a solution.
     
    Last edited: Apr 19, 2019
  9. Chucksaints

    Chucksaints Veteran Veteran

    Messages:
    32
    Likes Received:
    1
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
    Thank you so much, what I meant was to change color only in the "0".

    Thank youu
     
  10. ZirconStorms

    ZirconStorms VX & VX Ace Scripts Veteran

    Messages:
    332
    Likes Received:
    107
    First Language:
    English
    Primarily Uses:
    RMVXA
    For window_message, how do you/can you calculate the width of escape character text used in a message box?
     
  11. Ebanyle

    Ebanyle Veteran Veteran

    Messages:
    264
    Likes Received:
    149
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
    So I set up this to calculate the average level of the party and check it in conditional branches:
    Code:
    class Game_Party
      def get_all_level
      level_a = all_members.collect {|actor| actor.level }
      level_a.inject(0, :+)
      end
    end
    
    class Game_Interpreter
      def party_level
       $game_party.get_all_level / $game_party.all_members.size
      end
    end
    But I was wondering, is there a way to automatically set the value to a variable without the need to use the Set Variable command?
     
  12. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,440
    Likes Received:
    5,029
    Location:
    Riftverse
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    You can override the return value from Game_Variables to your liking for example if you use id 10 to return the party average level
    Code:
    class Game_Variables
      def [](variable_id)
        return <your desired value> if variable_id == 10
        @data[variable_id] || 0
      end
    end
    
     
    Ebanyle likes this.
  13. Ebanyle

    Ebanyle Veteran Veteran

    Messages:
    264
    Likes Received:
    149
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
    How exactly do I return the value from party_level?
     
  14. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,440
    Likes Received:
    5,029
    Location:
    Riftverse
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    Well, you can just run your own code
    Code:
    $game_party.get_all_level / $game_party.all_members.size
    
     
    Ebanyle likes this.
  15. DumbPomelo

    DumbPomelo Villager Member

    Messages:
    20
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMVXA
    How to enable/disable Escape in the middle of a battle?

    Found an old thread that says "@can_escape = false" works.
    It doesn't.
    Neither does "$can_escape = false" or "BattleManager.can_escape? = false".
     
  16. KK20

    KK20 Just some XP Scripter Veteran

    Messages:
    98
    Likes Received:
    40
    Location:
    Orange County, California
    First Language:
    English
    Primarily Uses:
    RMXP
    I don't work with VXA, but I'm sure it's as simple as adding this to your scripts
    Code:
    module BattleManager
      def self.can_escape=(val)
        @can_escape = val
      end
    end
    And using the script call
    Code:
    BattleManager.can_escape = true
     
  17. DumbPomelo

    DumbPomelo Villager Member

    Messages:
    20
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMVXA
    That worked beautifully, thank you kind sir.
     
  18. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,732
    Likes Received:
    381
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    Fascinating, this does not work for me in a test project at all.
     
  19. TheoAllen

    TheoAllen Self-proclaimed jack of all trades Veteran

    Messages:
    4,440
    Likes Received:
    5,029
    Location:
    Riftverse
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    You probably need to refresh the party command window
     
  20. DumbPomelo

    DumbPomelo Villager Member

    Messages:
    20
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMVXA
    Well I'm also using a bunch of other scripts, including but not limited to Yanfly Battle Engine and Yanfly Command List, so maybe that's why. I don't know much.
     

Share This Page