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

http://cleovlyers.blogspot.com/
Are there any backups for any of this user's scripts?
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
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.
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.
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.
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
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
Removed code, use the code provided by Sixth.
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.
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.
My bad, Kept messing up with the draw_text method and rushed for a solution.
change_color(actor.level > 9 ? text_color(17) : normal_color) draw_text(x + 32, y, 24, line_height, sprintf("%02d", actor.level), 2)
Thank you so much, what I meant was to change color only in the "0".

Thank youu
For window_message, how do you/can you calculate the width of escape character text used in a message box?
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?
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
How exactly do I return the value from party_level?
Well, you can just run your own code
Code:
$game_party.get_all_level / $game_party.all_members.size
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".
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
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
That worked beautifully, thank you kind sir.
adding this to your scripts

That worked beautifully

Fascinating, this does not work for me in a test project at all.
Fascinating, this does not work for me in a test project at all.
You probably need to refresh the party command window
Fascinating, this does not work for me in a test project at all.
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.

Original thread: https://forums.rpgmakerweb.com/threads/ruby-rgssx-questions-that-dont-deserve-their-own-thread.150/