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

thanks, the alignment thingy works fine! =)

but this square... god damn...

so, I tried it with different fonts = square

with fix = square

without fix = square

without word wrapping = no square, but text is goin out of window.

so it must be in this script snippet because this writes the square somewhere...

Spoiler
#-------------------------------------------------------------------------- # * Word Wrapping #-------------------------------------------------------------------------- def word_wrapping(text, pos = 0) # Current Text Position current_text_position = 0 for i in 0..(text.length - 1) if text == "\n" current_text_position = 0 next end # Current Position += character width current_text_position += contents.text_size(text).width # If Current Position > Window Width if (pos + current_text_position) >= (contents.width) # Then Format the Sentence to fit Line current_element = i while(text[current_element] != " ") break if current_element == 0 current_element -= 1 end temp_text = "" for j in 0..(text.length - 1) temp_text += text[j] temp_text += "\n" if j == current_element end text = temp_text i = current_element current_text_position = 0 end end return text end

I have no clue why this draws a square symbol oO
Try another word wrap script, maybe the others won't have that square symbol.


KilloZapit's Word Wrapper script is one of the best one for sure.


But if you won't plan on releasing your script for others, you are better off with hard-coding the texts and their positions instead of using a word wrap script.


Even if you plan to release your script, you can do it without relying on a word wrap script for sure.
I use KilloZapit's Word Wrapper, but even his script wont wrap the texts... and I plan to release the script here as soom as this problem is solved! ^^

but really no clue why the hell it is not wrapped or it prints the square, this really bugs me off!
Okay, I got a question now too. 😀


What's up with Window_HorzCommand?


Every time it's contents get wider than around the current Graphics.width*125%, it just stops scrolling with the cursor when the cursor reaches the X position of the mentioned limit.


The items are there, the cursor moves, but the drawn contents in the window will stay where they are until I enter within the limit again. This means the cursor will get off the screen after the limit.


Is there any way to prevent this? Or a workaround? Something? >.>
Okay, I got a question now too. 😀

What's up with Window_HorzCommand?

Every time it's contents get wider than around the current Graphics.width*125%, it just stops scrolling with the cursor when the cursor reaches the X position of the mentioned limit.

The items are there, the cursor moves, but the drawn contents in the window will stay where they are until I enter within the limit again. This means the cursor will get off the screen after the limit.

Is there any way to prevent this? Or a workaround? Something? >.>
Plug and play:

Code:
class Window_HorzCommand < Window_Command    def top_col=(col)    self.ox = (col < 0 ? 0 : col) * (item_width + spacing)  end  end
Too simple to be true, yet it is! 😀


Thanks a lot!
Uhm... I am curious... I want to change the opacity of all menu windows to a lower value.

Is there a way to do this at one place or must I adjust this in every window class?
class Window_Base alias aliased_init initialize def initialize(*args) aliased_init(*args) self.opacity = 100 # or it could be back_opacity endendUse inheritance
oh, sure!! this was too easy, omg ^^"

thanks!
While we are at windows and their opacity topic, I noticed something when I designed my menu engine...


If all windows on the scene are completely transparent, the FPS will get a whooping 100% boost.


I got from 30 FPS to a stable 55-60 FPS on a resolution of 800x608.


So, if it is possible, I suggest everyone to make their scenes with 0 opacity for all their windows (opacity, not contents.opacity, obviously), and instead use an image file to make the backgrounds/visuals for the windows in the form of a sprite created in the scene itself. Not only will it give countless new and unique ways for making the visuals of the scene, but will greatly increase performance.


Just wanted to share this info, in case someone will find it useful.
Interesting...  So, your suggesting it uses less processing power to blt a semi  transparent image than it would with the same image but non transparent.

Think I'll benchmark that to be sure...

Edit:

Perhaps the window class checks if opacity is 0 before blting, which would explain faster processing...
My thoughts exactly, and it would make sense after all.


The only thing I did was to set all of my windows' opacity to 0, and my FPS doubled instantly.


Regardless of how many windows I used on the scene or how big they were, my FPS was on a stable 55-60.


I can barely reach that FPS on the default game resolution, and now I could reach it on much higher resolutions. *-*
Does it enhance map performance?  Cause I have employed a huge array of techniques to try help map performance, so that would be a helpful if it does ~ I dont use default windows on the map anyway (rarely) 😀
While we are at windows and their opacity topic, I noticed something when I designed my menu engine...


If all windows on the scene are completely transparent, the FPS will get a whooping 100% boost.


I got from 30 FPS to a stable 55-60 FPS on a resolution of 800x608.


So, if it is possible, I suggest everyone to make their scenes with 0 opacity for all their windows (opacity, not contents.opacity, obviously), and instead use an image file to make the backgrounds/visuals for the windows in the form of a sprite created in the scene itself. Not only will it give countless new and unique ways for making the visuals of the scene, but will greatly increase performance.


Just wanted to share this info, in case someone will find it useful.
There have been observations that performance is improved when a sprite is not visible (ie: @visible = false)


They may be skipping certain things from updating when the window is not visible.
While we are at windows and their opacity topic, I noticed something when I designed my menu engine...

If all windows on the scene are completely transparent, the FPS will get a whooping 100% boost.

I got from 30 FPS to a stable 55-60 FPS on a resolution of 800x608.

So, if it is possible, I suggest everyone to make their scenes with 0 opacity for all their windows (opacity, not contents.opacity, obviously), and instead use an image file to make the backgrounds/visuals for the windows in the form of a sprite created in the scene itself. Not only will it give countless new and unique ways for making the visuals of the scene, but will greatly increase performance.

Just wanted to share this info, in case someone will find it useful.
interesting fact! I am anyway a friend of own menus with pictures, but the problem is not to get the windows invisible or the background image, it is the positioning or text sizes, fonts, layouts and so on. 

Sure, with enough knowledge it is "easy" to do (though it is a lot of work) but not for every beginner ^^
Using that method, you only need to adjust the background picture, not the texts etc since you don't really edit the contents of the window in any way...
Where the names of variables and switches are saved? I want to know because when I am working with a team, they usually uses variables and switches (eventing, scripting, mapping). So, if I know where they are, I can update my side from the team project and never get messed with double usage of variables or switches.

P.S.: I mean, in which .rvdata2 file?
I think that's internal... The game's scripts after all uses the array directly ($game_variables and $game_switches) instead of using names...
Where the names of variables and switches are saved? I want to know because when I am working with a team, they usually uses variables and switches (eventing, scripting, mapping). So, if I know where they are, I can update my side from the team project and never get messed with double usage of variables or switches.
$data_system.switches

$data_system.variables

Edit :

System.rvdata2
Using that method, you only need to adjust the background picture, not the texts etc since you don't really edit the contents of the window in any way...
Oh, yeah sure, I thought we talk about entirely custom menus. XD

But in that way, you're right!

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