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

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
Which I later discovered. It seems re-writing the whole scene is the thing I should do here so I can alias them later.
 

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
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:

#==============================================================================# 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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
I think Hime's screenshot script saves in multiple formats. Without a dll.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
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 :)
 
Last edited by a moderator:

Mihel

Veteran
Veteran
Joined
Mar 13, 2012
Messages
382
Reaction score
42
Primarily Uses
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...
 

cremnophobia

Veteran
Veteran
Joined
Dec 10, 2013
Messages
216
Reaction score
97
Primarily Uses
[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.
 

Sophitia

Veteran
Veteran
Joined
Feb 13, 2014
Messages
38
Reaction score
9
First Language
English
Primarily Uses
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?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
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.
 

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
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.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
@Sophitia

    draw_item_name(@actor.equips[EQUIP_SLOT_ID_GOES_HERE], x , y)
B)
 

Sophitia

Veteran
Veteran
Joined
Feb 13, 2014
Messages
38
Reaction score
9
First Language
English
Primarily Uses
Fantastic! Thank you all of your help! <3
 

RageofLogan

Warper
Member
Joined
Jul 24, 2014
Messages
1
Reaction score
0
First Language
English
Primarily Uses
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?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
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.
 

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
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).
 

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
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?
 

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
 

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:

 



 

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?
 

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,643
Reaction score
420
First Language
Portuguese
Primarily Uses
RMMV
Pretty sure you don't need a script, just a map and events to check pressed keys and move the player.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,472
Members
137,822
Latest member
madelbylz
Top