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

You have two options. Use either of
.contents_opacity = 128
OR
.contents.font.color.alpha = 128


Complicated. First, you have to erase the arrow from the windowskin image asset, then add your own sprite to the window.

As for the first one, is done, Thank you ^^

For the sprite, how can I check if there is scrollable content up/down & hide sprite if it hasn't?
How do I check values that can all fit into a condition?
For example, I'm trying to make X action in an event if the player is facing down or right direction.
Instead of checking it like this:

Code:
if $game_player.direction == 2
   do X thing
end
if $game_player.direction == 6
   do X thing
end

Is there a way I can check for both in the same condition? Like this:
Code:
if $game_player.direction == 2 [or] 6
   do X thing
else
   do Y thing
end
Use an array and its include? method to check if it contains that value...
Code:
[2,6].include?($game_player.direction)
That should make it possible for you to check if the direction will ever trigger it.
Does Ruby have an equivalent to the JS clamp function?

That is, can I write something like value.clamp(min, max) to ensure the value stays between the minimum number and the maximum number, or do I have to use something like ((value, 10).max, 9999).min?
Quick google check says not until Ruby version 2.4.0

What you alternatively put is equivalent. Make the clamp method yourself if you want.
Untested, but something like this might work.
Ruby:
class Numeric
  def clamp(min, max)
    return [[self,min].max,max].min
  end
end
You seem to ignore that an Array's min and max methods let you include more than just two values for Arrays have no specific size limit. (OK, Ruby arrays aren't as huge as C's or C++'s vectors...)
You seem to ignore that an Array's min and max methods let you include more than just two values for Arrays have no specific size limit. (OK, Ruby arrays aren't as huge as C's or C++'s vectors...)
Why would you need to use more than two values for a min or max? This comment contributed nothing of value to the question at hand.

Alternatively
Ruby:
class Numeric
  def clamp(min, max)
    [min, self, max].sort[1]
  end
end
You want a quick solution? Here's one!

Code:
class Numeric
  def clamp(mn, mx)
    return mn if self < mn
    return mx if self > mx
    self
  end
end

This one avoids making a value search by index that's unnecessary.
Anyway to use line breaks with bitmap.draw_text commands?
Window_ChoiceList - For animation purposes, how would I be able to dispose of the choice window while not having to rely on close commands?

Code:
  def call_ok_handler
    $game_message.choice_proc.call(index)
    close #to remove?
  end

  def call_cancel_handler
    $game_message.choice_proc.call($game_message.choice_cancel_type - 1)
    close #to remove?
  end
how would I be able to dispose of the choice window while not having to rely on close commands?
You don't technically dispose the window, but you can have a similar effect if you don't want to use close command. Just use
Code:
self.openness = 0
How does one set up a way to allow RGSS3 to read from a .txt file and set a variable from what the text file says?


Just numbers will work perfect.

Edit: I am aware of the External Text script. But is there a simple script call I can use to do a task like I am doing?
8b010af93e955497afd1f52ac8f279bf.png


How would I go about drawing a parameter bar here, for the status menu?
e.g.


a281a57c952e75589df96164aae29f28.png
Generally, you just need to call draw_gauge, however, that does depends on the rate.
What does the stat rate depend on? If HP, it makes sense since the max gauge is when the current hp is equal to max hp, but stats?
How does one set up a way to allow RGSS3 to read from a .txt file and set a variable from what the text file says?


Just numbers will work perfect.

Edit: I am aware of the External Text script. But is there a simple script call I can use to do a task like I am doing?
I am not sure if this will work with RGSS3, but in pure ruby this will do the trick:
Ruby:
File.readlines(file_path)
Just iterate over it using each, map or similar method.
Generally, you just need to call draw_gauge, however, that does depends on the rate.
What does the stat rate depend on? If HP, it makes sense since the max gauge is when the current hp is equal to max hp, but stats?
would max stats if lvl 99 count as rate?

say stat attack at level 10 = 10, and at lvl 99 = 100

then at lvl 10 the bar should be at 10% of the 100%
would max stats if lvl 99 count as rate?

say stat attack at level 10 = 10, and at lvl 99 = 100

then at lvl 10 the bar should be at 10% of the 100%
Honest opinion, drawing gauge bar in stat display does not convey anything. And by that logic it will really be a small fraction of the bar. And not to mention, if you use equip, it may exceed 100. And the bar will be maxed.

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