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

DerVVulfman

Resident Werewolf
Veteran
Joined
Jun 26, 2012
Messages
315
Reaction score
155
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
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
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.
 

ZirconStorms

Veteran
Veteran
Joined
Dec 22, 2014
Messages
359
Reaction score
111
First Language
English
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.
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.
 

Chucksaints

Veteran
Veteran
Joined
Dec 8, 2016
Messages
34
Reaction score
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
 

ZirconStorms

Veteran
Veteran
Joined
Dec 22, 2014
Messages
359
Reaction score
111
First Language
English
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
Removed code, use the code provided by Sixth.
 
Last edited:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
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

Veteran
Veteran
Joined
Dec 22, 2014
Messages
359
Reaction score
111
First Language
English
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.
My bad, Kept messing up with the draw_text method and rushed for a solution.
 
Last edited:

Chucksaints

Veteran
Veteran
Joined
Dec 8, 2016
Messages
34
Reaction score
1
First Language
Portuguese
Primarily Uses
RMVXA
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
 

ZirconStorms

Veteran
Veteran
Joined
Dec 22, 2014
Messages
359
Reaction score
111
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?
 

Ebanyle

açspasl~d~dfflass
Veteran
Joined
Sep 2, 2016
Messages
338
Reaction score
200
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?
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
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

açspasl~d~dfflass
Veteran
Joined
Sep 2, 2016
Messages
338
Reaction score
200
First Language
Portuguese
Primarily Uses
RMVXA
How exactly do I return the value from party_level?
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
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
 

DumbPomelo

Villager
Member
Joined
Jun 2, 2019
Messages
20
Reaction score
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".
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
281
Reaction score
106
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
 

DumbPomelo

Villager
Member
Joined
Jun 2, 2019
Messages
20
Reaction score
1
First Language
English
Primarily Uses
RMVXA
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.
 

DumbPomelo

Villager
Member
Joined
Jun 2, 2019
Messages
20
Reaction score
1
First Language
English
Primarily Uses
RMVXA
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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,090
Members
137,587
Latest member
Usagiis
Top