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

@ Evgenij

Yeap, I use a few custom scripts-- Here:

http://www.rpgmakervxace.net/topic/8188-nerdigaming-title-menu-version-12/?hl=title

http://rpgmaker.net/scripts/424/

https://victorscripts.wordpress.com/rpg-maker-vx-ace/field-scripts/step-sound/

https://victorscripts.wordpress.com/rpg-maker-vx-ace/basic-scripts/basic-module/

http://galvs-scripts.com/galvs-character-effects/

http://www.rpgmakervxace.net/topic/560-message-box-size-and-position-options-updated/

http://forums.rpgmakerweb.com/index.php?/topic/23562-michael-super-simple-diagonal-movement-patch/

http://www.rpgmakervxace.net/topic/5107-save-file-output-control/

@AnotherFen

Weird, I don't think I have any events that have 'Script...' in the first place? I looked around my events, and definitely can confirm that.

@Shaz

I actually am using the Call Save Screen event command, and not a Script Command?

As for other scripts, the ones that might have refined the save screen would be the ' Save file Output Control ' and maybe Soulpour's Menu á la Majo no Ie script?
@Jestereir, why are you posting in this thread, if you're using an event command? This is for script support, not event support.
I am wrapping the command in the refresh method of my new window, actually.

This is how I make it as a representation:

class Window_Actors < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0, window_width, fitting_height(1)) refresh end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 160 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear $game_party.battle_members.each do |mem| draw_text_ex(x, 10*$game_party.battle_members.index(mem), mem.name) end endend
I am not sure of this, but could it be that the refresh method is also called in the update method? so it is called in initialize and update which causes to appear the names twice?!? 

as I said, I am definitely not sure about this as I don't look into the class right now, but I could imagine this...
@Jestereir:
Mmm, could you perhaps add this script for testing and see if the error message changes?

The script should try to find the corresponding event and print some more stack information if a script command causes an error (it's not very clean, however)

Spoiler
class Game_Interpreter   alias_method🙂eval_ILC_eventErrorInfo, :eval)  def eval(*args)    begin      eval_ILC_eventErrorInfo(*args)    rescue      bt_overhead = $!.backtrace[0][/^\{\d+\}/]      backtrace = $!.backtrace.drop_while { |s| s.start_with?(bt_overhead) }      # ----      bt_text = backtrace.map { |string|        data = string.match(/(.*?)\d*)(?:.*))/)        next string  unless data        if (index = data[1][/^\{(\d+)}/, 1])          script = $RGSS_SCRIPTS.fetch(index.to_i, [])[1] || "Script #{index}"          source = "\"#{script}\""        else          source = "'#{data[1]}'"        end        line = "line #{data[2]}"        add = data[3] ? ": #{data[3]}" : ""        next "#{source} #{line} #{add}"      }.join("\n")      # ----      message = "#{$!.message}\n\n\nException occurred in "\      "#{event_identity_text} near line #{@index + 1}\n\n#{args[0].rstrip}"\      "\n\nBacktrace Info:\n#{bt_text}"      # -----      fail $!.class, message, backtrace    end  end   def event_identity_text    $game_map.events.each do |id, ev|      pi = ev.instance_variable_get🙂@event).pages.index do |page|        page.list.equal?(@list)      end      next  unless pi      return "<Map %03d, Event %03d, Page %d>" % [$game_map.map_id, id, pi + 1]    end    $data_common_events.each_with_index do |ce, id|      next  unless ce and ce.list.equal?(@list)      return "<Common Event %03d>" % [id]    end    return "<Unknown Source (Map-ID: #{@map_id}, Event-ID: #{@event_id})>"  endend
@Milena:

How many Window_Actors instances are you creating ingame? Are these windows supposed to show the name of one actor each or shall all names get written into the same window?

I'm curious since you create the window with a fitting height for one line of text (fitting_height(1)).
I have solved it. Somehow I was drawing it everytime, so they are repeated throughout the window. Reason being I am creating the window with multiple instances instead of one. Anyway, I have another problem, which I don't know why this is making the map causing a lag.

class Window_ActorHUD < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0, window_width, fitting_height(1)) refresh end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 340 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear draw_actor_face($game_party.members[0], x, -30) draw_actor_health($game_party.members[0], 100, -5, 150) end #-------------------------------------------------------------------------- # * Draw HP #-------------------------------------------------------------------------- def draw_actor_health(actor, x, y, width = 124) draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2) end endclass Scene_Map < Scene_Base alias milena_start start alias milena_update update alias milena_terminate terminate #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start milena_start @actor_hud = Window_ActorHUD.new end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate milena_terminate end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update @actor_hud.refresh milena_update endendAs far as I know this is the correct way to orchestrate this, but why is it making my map lag?
@Shaz

I wasn't too sure where to go for help, haha-- So sorry about that

@Another Fen

I tried that script, but it made another error. Though I created a new projects and pasted all the scripts and stuff that I have on the original file, and it works fine! 

Thanks so much for the help though--
@Jestereir:
The script itself won't fix any error, I was just hoping for a more detailed error message.

Anyway, if you could get rid of your problem without losing to much of your work that's glad to hear. 🙂 .

(btw: did the error only occur for one specifiic savestate or for all?)

@Milena:
As a general rule, try to use bitmap manipulation commands sparingly (especially set_pixel and draw_text). Instead of redrawing a bitmap continuously, you could try to refresh it only when necessary.
So what is the better way of implementing this?

I mean if I remove the refresh method, it would not refresh in the map and thus only when I go to another scene will I be able to see the changes of the hud. Are there things that could be a mistake in my draw methods that makes this wrong?

I just discovered that the problem is in my draw_actor_face method. It makes the Map lag. Anything wrong with drawing faces in the map just like what I did?
Hey guys! I have a little problem with HE - Main Menu.

I don't understand why the text is always cut off at the start

UXk2ESO.png


This happens with every text in the menu.

Any suggestion? ( I also tried it in a new project without other scripts but the result was the same )
@Shuji: you mean the 'C' at "CTRL: Optimize equipment" ?? I had this several times too, I change the font size a bit higher and it doesn't cut off then, maybe try this.
If you look it cuts off also the numbers in the stats, and other words. Anyway even changing the font size the result is the same :/
@Another Fen

Well, the error that showed was part of your code instead orz--

As for the savestate-- the error only popped up when I accessed the save event? then it's appear-- I've no idea why though orz
@Shuji


Try to install Mithran's Text Cache script. That tends to fix these display errors for custom font types and even speeds up text processing.


@Milena


It is not the draw_actor_face which kills the FPS. It is the refresh method called constantly, even when you don't need it.


Do not put anything in the update methods without a condition attached to it, or else the FPS will be lowered.


You should first get to know when the refresh method needs to be called, as you surely don't need to redraw everything in every single frame. I suppose it is only needed when the actor's HP has been changed. So, depending on when the HP can be changed, you can drop the window's refresh method there instead of doing it in the update method.
@Sixth

It worked! Thank you[SIZE=11.6666669845581px]  😀  [/SIZE]

EDIT: I just noticed tha the scripts cause those withe lines to show on the hp/mp bars D:

XXgirha.png
@Jestereir:
Do you remember what the error message was about? It's possible I overlooked a bug or the script does not work correctly in your situation, but it seemed to work fine when I tested it.

For the record, the script was supposed to create errors like this:

View attachment 19845

I know the problem is solved, but I'm still curious. 🙂

@Milena:
Just as Sixth said, the easiest way would be to check if the displayed properties have changed since the last update. Otherwise you can refresh the window after certain events (like the refresh_status method of the battle scene).
@Shuji

Wow, that's weird, never happened to me! o.o

Try to change the font type and see if it still draws those lines.

Do you have LoneWolf's little snippet for removing un-displayable characters? Maybe that will help.

Here is the snippet:

Code:
class Window_Base  alias :process_normal_character_vxa :process_normal_character  def process_normal_character(c, pos)    return unless c >= ' '    process_normal_character_vxa(c, pos)  endend
If that won't help, than I am out of ideas, sorry.
Changing the font worked xD

Thank you so much^^ 
One question, is there a way to change the character sprite (current, leader) in map when I press a certain key then turns back to the old sprite when I release the key?
maybe this script is something for you: http://himeworks.com/2013/07/full-input-keyboard/

so you can write a script snippet where you check if your "change sprite" button (maybe H or something) is pressed and change the sprite...

and if it is released, change the sprite back.

/E:

welll... I found this here http://forums.rpgmakerweb.com/index.php?/topic/25759-script-call-collection-for-vxace/#entry247439

I think this should it be for you

Code:
Input.trigger?(:A)Input.repeat?(:A)Input.press?(:A)# Change A to your desired key, refer to F1 when you testplay and see the keys.
Is there a way to determine the number of that enemy in the troop? For example, I have a troop of 4 slimes. What I wanted to know is if its possible to know who the 4th one is on the troop. I want to have the actor not able to target the 4th ones and above in the troop. They can and only should be able to attack the 1st, 2nd and 3rd enemy on the troop...and once they die, they can then attack the 4th onwards.

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