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

Which I later discovered. It seems re-writing the whole scene is the thing I should do here so I can alias them later.
yep 🙂
I have another question or rather a query about dlls in Ruby though. How does a certain dll handle jpg format? Basically, here's a script I turned out for VX Ace:

Spoiler
#==============================================================================# Screenshot Bitmap EX# Author: Soulpour777#------------------------------------------------------------------------------# This is a port and convert version of KGC's old Screen Capture Script.#==============================================================================module Soul module ScreenCapture STRING_BUF_SIZE = 255 # String Buff Size UTF8_UNICODE = 65001 # UTF-8 Unicode SCREENSHOT_KEY = Input::F8 # Screenshot Key USE_CTRL = false# CTRL Key Option Toggle # This toggle allows you to require the CTRL key to be held while pressing # the Screen Capture Key (Default: F8) # true = CTRL must be held. # false = CTRL is not required. USE_ALT = false # ALT Key Option Toggle USE_SHIFT = false # SHIFT Key Option Toggle NAME_FORMAT = "Screenshot{num}.bmp" # Screenshot Filename Format # Screen Capture Sound Effect if $TEST # VX-Only SUCCESS_SE = RPG::SE.new("Chime1", 100, 100) end endend#==============================================================================# ■ TCap#==============================================================================module TCap #-------------------------------------------------------------------------- # ● The TCap.dll version is aquired. # (Example: 1.23 → 123) #-------------------------------------------------------------------------- def self.version begin api = Win32API.new('TCap.dll', 'DllGetVersion', %w(v), 'l') ret = api.call rescue ret = -1 end return ret end #-------------------------------------------------------------------------- # ● Capture Game Screen # filename : output destination (bmp) #-------------------------------------------------------------------------- def self.capture(filename) begin hwnd = Win32API.GetHwnd if hwnd == 0 hwnd = Win32API.GetActiveWindow end if hwnd == 0 ret = -1 else tcap = Win32API.new('TCap.dll', 'CaptureA', %w(l p l l), 'l') ret = tcap.call(hwnd, filename, 1, Soul::ScreenCapture::UTF8_UNICODE) Graphics.frame_reset end rescue ret = -1 end return ret endend#==============================================================================# ■ Input#==============================================================================if ($DEBUG || $TEST) && Soul::ScreenCapture::SCREENSHOT_KEY != nil module Input @@_capture_num = 1 CAPTURE_FILE_NAME = Soul::ScreenCapture::NAME_FORMAT.gsub(/{num}/) { "%03d" } #-------------------------------------------------------------------------- # ● Frame Update #-------------------------------------------------------------------------- unless defined?(update_Soul_ScreenCapture) class << Input alias update_Soul_ScreenCapture update end def self.update update_Soul_ScreenCapture judge_capture end end #-------------------------------------------------------------------------- # ● Capture Execution Judgement #-------------------------------------------------------------------------- def self.judge_capture if trigger?(Soul::ScreenCapture::SCREENSHOT_KEY) && (!Soul::ScreenCapture::USE_CTRL || press?(CTRL)) && (!Soul::ScreenCapture::USE_ALT || press?(ALT)) && (!Soul::ScreenCapture::USE_SHIFT || press?(SHIFT)) result = TCap.capture(sprintf(CAPTURE_FILE_NAME, @@_capture_num)) if result == 0 capture_se = Soul::ScreenCapture::SUCCESS_SE if capture_se != nil $DEBUG ? $game_system.se_play(capture_se) : capture_se.play end @@_capture_num += 1 end end end endendclass Win32API #-------------------------------------------------------------------------- # ● Read INI File # section : Section name # key : Key # default : default value when a key doesn't exist # inifile : Passing of read INI file #-------------------------------------------------------------------------- def self.GetPrivateProfileString(section, key, default, inifile) get_ini = Win32API.new( 'kernel32.dll', 'GetPrivateProfileStringA', %w(p p p p l p), 'l') buf = "\0" * (Soul::ScreenCapture::STRING_BUF_SIZE + 1) get_ini.call(section, key, default, buf, Soul::ScreenCapture::STRING_BUF_SIZE, inifile) return buf.delete!("\0") end #-------------------------------------------------------------------------- # ● Aquire Window # window_class : Window class name # window_title : Title of window #-------------------------------------------------------------------------- def self.FindWindow(window_class, window_title) find_window = Win32API.new('user32.dll', 'FindWindowA', %w(p p), 'l') return find_window.call(window_class, window_title) end #-------------------------------------------------------------------------- # ● Aquire Active Window #-------------------------------------------------------------------------- def self.GetActiveWindow active_window = Win32API.new('user32.dll', 'GetActiveWindow', %w(v), 'l') return active_window.call end #-------------------------------------------------------------------------- # ● Aquire Game Window #-------------------------------------------------------------------------- def self.GetHwnd name = GetPrivateProfileString("Game", "Title", "", "./Game.ini") return FindWindow("RGSS3 Player", name) endend 
It needs a certain DLL though...

is there a way to change bmp into jpg without getting my Image Editor change the format? If I change that to jpg on the script its just the same, glad my IFview changes the format automatically for me to BMP.
I think Hime's screenshot script saves in multiple formats. Without a dll.
Yes Shaz it does.

It uses Cremno's GDI+Interface to capture the screenshots. (Actually, Cremno's orig script done screenshots, Tsukis can just do more - like full map shots with events on. 🙂

Also - like the new avatar. Its not as blue or nutty enough, buts its good 🙂
Bump!

How do I transform something like [1..4, 7..10] into [1, 2, 3, 4, 7, 8, 9, 10]?
It seems ary.sample only works with "proper" arrays, but I'm too lazy to manually type each element separately every single time I need a random number...
[1..4, 7..10].flat_map(&:to_a)Or if it includes not only ranges, but also integers, for example, you can use:

[1..4, 7..10, 13].flat_map { |e| [*e] }The star here is called the splat operator.
Teeny tiny question!

How do I draw a single equipment slot? I know how to draw an actor's entire equipment set but how do I draw just, for example, his weapon in the status menu without the armor there too?
If you know how to draw the entire set, it shouldn't take much looking around to figure out how to draw a single slot. I imagine there'd be a loop or an array or something, and a certain method or command is called on each iteration/element.
Teeny tiny question!

How do I draw a single equipment slot? I know how to draw an actor's entire equipment set but how do I draw just, for example, his weapon in the status menu without the armor there too?
Simple, remove the draw method that handles the armor.
@Sophitia

    draw_item_name(@actor.equips[EQUIP_SLOT_ID_GOES_HERE], x , y)
😎
Fantastic! Thank you all of your help! <3
Not sure where this is suppose to go but i've tried everything in my power to get any script to work in VX ACE. It just refuse's even after carefully reading and re-reading the instruction's and making changes where neccesary. Frustrated beyond belief

Scripts include

-multiple storage/banking 

-jumping

-custom icons/images

any help?
New post please, in RGSSx Script Support. Add LINKS to any scripts you're using. Also a screenshot of your Scripts window so we can see where you've installed them.
I have a question about commands. Normally, if you want to scroll a command, you'd just press down and up to scroll downwards of upwards of which command you want. Is there a formula involved in doing Arcs or different directions aside from the normal command scrolling? I want to implement a world map navigation system, its all easy and fine but I stumbled upon this problem. I am basing it from Breath of Fire IV system where Ryu goes anywhere on the map, but the sprite follows a certain direction aside from down and upwards, some has arcs and all other formation.
First you're talking about scrolling in a command list (or, I assume, a select list). Then you're talking about moving the character on the world map. They are done in completely different ways.


I suggest you start a new thread and explain exactly what it is you're trying to achieve (and if you say "like Breath of Fire IV", know that you're limiting the number of people who will be able to or interested in helping you).
Hmm, I made them as one because it is what I was intending to do. If you remember Ring Menus, they probably or might have used a different way to make their commands. I was hoping to do this via a command too, where when I press down, I would have the sprite walk down...but it is not an event nor a movement fixed object, but rather a command. If it is impossible for it to be on commands, the more appropriate question I can ask would be like, how can I determine coordinates but engaging movements?
Have you tried Jet's tween script[/ur]? You could tween the character sprite between one point to another.


For arcs, I'd recommend looking at how Game_Character#jump works; arc math depends on a delta time, or a count between two points within the jump. I do believe you could also use a logarithmic function, if you wanted.



As for the commands (and the question as to whether they are appropriate for this situation): I say yes, they can be. But the ultimate question is: how do you intend to setup paths between two locations on screen that the commands represent? If they are straight lines, use Jet's code above. If they are squiggly lines, arcs, etc, I'd recommend using Game_Character (or subclassing it) and a Sprite_Character, and using movement routes, and disable command selection while the character is moving between points (to make this less waiting time and more visual effect, you could up the speed of your Game_Character).



At the beginning of the scene, just 'compile' a list of movement routes that you can 'feed' to the Game_Character instance to make him/her move between your waypoints....Are you averse to using the default movement system?
 

Currently, I am still on the development of putting different commands on the screen rather than using the sprite movement because I still have to learn those things you pointed out and the character movement. I only did movements for them using the original move route. Does that mean I have to create numerous commands for each of the commands I have to select?

 

For example:

 

[IMG]http://www.mobygames.com/images/shots/l/66091-breath-of-fire-iv-windows-screenshot-here-you-can-see-the-map.png[/IMG]

 

This is my original plan to do...where I wanted to move the sprite as I move on to which command I should place. But seeing I am not an expert scripter nor close even to being a good scripter (I am a bad scripter, seriously), I can't still understand where to actually place all the numerous commands and let them be selected while pressing left and right, up and down.

 

Is there a way to implement such system without altering the basic add_command methods in a linear way?
Pretty sure you don't need a script, just a map and events to check pressed keys and move the player.

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