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

No, that's not enough information.


Does draw_text_ex handle line breaks? Or process_character? Has process_character been overwritten? If so, can you show that method? Is height the height of a single line, or the whole block (5 lines) of text?


Need to see the method that determines how high the whole text area is going to be, and how far to move down when going to a new line.


Also, how do you define item_desc? Is it something you've put in the script itself, or something you've added via a note tag? Could we please see where/how it's defined?


Is this your own script, or one that's available online? Got a link?
By looking at the code, item_desc is the variable itself. He probably stored the text in the variable, and automatically changes it when selecting the stuffs on the scene or somewhere else.


The source of your issue comes from the 'process_new_line' method in Window_Base.


You did overwrite the initial line_height calculation, but the method mentioned above still uses the default one ('calc_line_height'). If you want to get rid of this issue, you can let the default 'draw_text_ex' method be as is, just remove the reset_font_settings from it.


After this, go and overwrite the 'calc_line_height' method (keep the arguments, remove everything, and simply return contents.font.size at the end).


Now, change the text size for your desired value (it is 14 in your code) before you call 'draw_text_ex'.


This should solve your issue.


Btw, Megan is a male name? I always thought it's for females. 😀
Nah, that is a private script 😛

Oh, nice one sixth ~ I had just started typing what you suggested.. Saved me a good few minutes 😀
@Shaz I looked at the methods involved and posted anything that was related or overwritten~ the description are in the variable which is pushed to it when the customer decides on what to buy (or sell). This is a commissioned script from Dekita~

@Sixth That seemed to have solved the issue. Here's the result and the changes I made. I overwrote calc_line_height above draw_text_ex. Will this affect anything else that uses calc_line_height? Let me know if I did it correctly~

mzGDyDS.png


Code:
  #--------------------------------------------------------------------------  # * Calculate Line Height  # // Overwrite From Super  #--------------------------------------------------------------------------  def calc_line_height(text, restore_font_size = true)    return contents.font.size  end  #-----------------------------------------------------------------------------  # // Overwrite From Super  #-----------------------------------------------------------------------------    def draw_text_ex(x, y, text)    ##reset_font_settings    text_size = 14    self.contents.font.size = text_size    text = convert_escape_characters(text)    pos = {:x => x, :y => y, :new_x => x, :height => text_size}    process_character(text.slice!(0, 1), text, pos) until text.empty?    reset_font_settings  end
By default, only draw_text_ex uses that method, unless I missed something.

If you overwrote that method in the new window class only and not in Window_Base, than it should not bother anything else.

Just remember to change the font's size after drawing your text again if you want to use draw_text_ex after that description text with a different font size.

But for draw_text_ex, you can simply use the default method without changing anything else in it, just remove the reset_font_settings method from it.

You overwrote the calc_line_height method, so there is no need to do anything with the :height there, it will return the correct height.

If you want, you can place a reset_font_settings at the end of draw_text_ex (like you did it already), although I usually leave that out, because I always need to change the font's properties afterwards anyway.
How can I determine the name of my actor's current weapon?
actor_object.equips[weapon_slot_id].nameThis would be the basic syntax.
'actor_object' is a valid actor object, like $game_actors[id] or $game_party.members[id], etc.


'weapon_slot_id' is the slot id where the actor got the weapon equipped (usually 0, or 0 and 1 if dual wielding).


You must put in a nil check before it, to avoid crashes when the actor got no weapon equipped.


If you want to display 2 weapon names if the actor is dual wielding, you will need to add an extra check if dual wield is active on the actor, and display two weapon names in that case (if you want it that way, that is).
Thanks, that solved it.
-- Recently I tried out the Open Save File event on a project, and when I tried to access it, this showed up.

Spoiler
tumblr_nky1mcORRS1tm4btko1_500.png
In which I didn't even touch that script? So I opened the scripts and this shows up

Spoiler
tumblr_nky1nlLjn71tm4btko1_r1_1280.png
-- I'm close to havin little to no knowledge of ruby scipt, so.. could someone tell me what this means? If you need to know any other information, please let me know.
Dumb question? Why could a coder/scripter just not add to script of XP and ace and make rgss work in Rgsss3 and vice versa?
@Jestereir

Do you use any custom scripts?

@ShinGamix

There are many other factors but these are some:

 - Database Structure is different

 - Ruby Version is different

Theoretically you could make RGSS work with Ace with some modifications, but it wouldnt be worth the efford, cause RGSS3 is so much better to work with.
@Jestereir:

This line is responsible for processing custom event script commands. If the error message refers to this line, usually something is wrong with one of your "Script..." commands.

Edit: Normally the event execution should not start during the loading screen. So I'd join Evgenijs post.

In this case, you are trying to access the current scenes spriteset from an event. It seems the command was meant to be run while on the map, but got called during an initial update process before the scene was switched from the load menu.

If you find out which script command is responsible for the error, you can try adding this line right before it:

Fiber.yield  until SceneManager.scene_is?(Scene_Map)

Coundn't test that line yet though.

@ShinGamix:

A problem is that the standard scriptsets of XP and VXAce each provide a closed system. The main script invokes a chain of methods that takes control over the entire gameflow. Scripts modify this flow by redefining methods. As there are some differences in how XP and VXAce work, these redefinitions can't be easily transferred into each other system.

To make things more complicated, scripts have access to a large part of the systems actual implementation and can make use of it, so you'd actually have to adopt huge parts of both systems and somehow merge them if you don't want to overhaul the scripts.

The general problem is mixing both systems though, using either the one or the other system in one of the makers is another story. But even there you'd have to work around some differencies in the standard library of the used Ruby versions and built in classes.
Shin, that would be a very complicated thing to do, and is certainly NOT a "question that does not deserve its own thread".


If you search, you will see that there is already a thread explaining how to create a hybrid XP/Ace project, where you can do your mapping in XP and your eventing and scripting in Ace.


@Jesterier, why are you using the Script command instead of the Call Save Screen event command to open the window? I'm also wondering if you have any other scripts that redefine the save screen.
I cant get my credits menu choice to show up on the title screen could use some advice

View attachment 19767

I got this much but it wont show on screen
Have you added it to Window_TitleCommand?


And why are you recreating the variable? Just put in your call to the aliased method, and then your handler to the new option. Get rid of the @command_window = Window_TitleCommand.new because that's already done in the aliased method (in fact, I'd expect what you're doing to not actually handle any of the other inputs).
Is it possible to replace the battlers of the enemy to sprites instead? I am asking this because my map is wide and it would be nice to see the whole small sprites there instead.
I'm getting back into writing scripts after taking a few months off. I'm writing a script that has windows that will change their size depending on the amount of information that needs to be shown and various objects on the screen will adjust their positions off of this window. I usually write something like this:

def create_some_sprite  @sprite = Sprite.new(@viewport)  @sprite_y = @display_window.y + @display_window.height  @sprite.x = @display_window.x  @sprite.y = @sprite_yenddef update  some_code  if @sprite_y != @display_window.y + @display_window.height    @sprite_y = @display_window.y + @display_window.height    @sprite.y = @sprite_y  endendI wanted to know if it's faster or more efficient (or just lazy) to just continuously set the y position in the update instead of checking if it needs to update first. Like this:

def update some_code @sprite.y = @display_window.y + @display_window.heightendOr are the gains from either way so minor as to not even matter? I'm just curious and figured someone might know 🙂
Milena, you can just change the images in the Battlers folder to be the sprites (copy the sprite character sheet and crop it to the desired image).


If you want them animated, that's more work, and you would need to make a script request for it. It's too complicated to discuss in this thread.
Ohhh, that's neat. I have another question, I am playing an animation at the start of battle. It works fine, but is there is a way to determine the actor's location on the battle? This is my script:

def play_start_animation $game_party.battle_members.each do |battler| @sprite_actor= Sprite_Base.new @sprite_actor.x = battler.screen_x # error, there's no screen_x in Game_Actor @sprite_actor.y = battler.screen_y # error, there's no screen_y in Game_Actor battler_anim_id = 37 next unless battler_anim_id @sprite_actor.animation_id = battler_anim_id wait_for_animation end end As you can see there's an error there because I can't seem to find a way to find the current location of the actor and screen and play the animation there. Basically what I wanted is that when I play the animation on the actor, it won't just flash right there like the default way how actor animations are handled. I want it to play like how you play animations to the enemy battlers. Is there a way to track it?
It works okay in Sprite_Battler. You must have a script that shows your party members on the screen? In that case, you'll need to create a screen_x and screen_y method for them.

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