RPG Maker Forums

Universal Module
v1.2.6, by Holy87

Features

Provides more functionalities for scripters (and it is used in a lot of my scripts), let's see what you can do:

System communication

You can obtain the screen resolution, Pictures/My Documents/Music/Video/Desktop folders, Windows user account name, Windows version and language, and changing the game window's width and height.

Internet

You can downlaod files and get response with async methods: you don't have to check when the download is terminated, just set the method that will be automatically called when the file will be downloaded.

You can also open the system default browser to a specific URL!

Universal data that not depends on savegames

You can store variables and switches that not depend on savegame, but are universal: for example, if I want unlock an "Extra" option in the title screen when the player completes the game. You can do that with this!

String options and crypting

You can encode/decode a string in ROT13 or Base64, and also get a random string if you want.

Other functionalities

Version class: You can create a version class with major, minor, build and revision informations (like 1.0.15.3). You can also compare versions and, obviously, set a game version creating a version.ini file in the project root.

println method: like p and print methods, but automatically adds a newline in the console.

How to Use

Place the script under Mateirals and above Main.

Code Examples:

How to get system Informations

print Win.username #=> "Francesco"print Win.version #=> 10.0print Win.getFolderPath:)dskt) #=> "C:/Users/Francesco/Desktop"print Win.resolution #=> [1024,730]. Note that it's not all the display resolution, but only the part#of the screen not covered by the taskbar, so you know how big you can resize the game window.Internet and HTTP

Async method are easy-to-use, but by default are avaiable only in the Scene and Window class. You can make it avaiable in other classes including the Async_Downlads module (see in the script)

Let see how they work. For example, I want to download automatically a new picture for the title screen. What I've to do is:

class Scene_Title < Scene_Base  def download_new_title    download_async("http://myhost.com/title_wallpaper.jpg", method:)title_downloaded), "Graphics/Pictures/")  end   def title_downloaded #launched automatically when the download is completed    @sprite2.bitmap = Cache.picture("title_wallpaper.jpg")  endendHow to open the browser to a web page:

Browser.open("www.google.com")Using universal data

The universal data (variables and objects) are stored in the Game_Settings.rvdata2 in the project's root. Let's see how to use them. You can use the $game_settings instance.

$game_settings[:game_completed] = trueThe data will be automatically saved when the value changes, so I can read the data using the same methodology

unlock_extra if $game_settings[:game_completed]String encoding

The Base64 codification is useful for making secure communication between client and server.

print Base64.encode("Hello World") #=> "sgvsbg8gv29ybgq="Using Base64.decode method you can return to the normal string.

Version Class

You can make a game version (to show in the title screen or for use in other scripts) just creating a version.ini file in the project's root, and writing inside a number with one or more digits, like

1.2.50.3where

1 is the major release, 2 the minor release, 50 the build and 3 the revision.

You can call the game version from script using

print $game_system.game_version #=> "1.0" by default, if no version.ini file is createdThis method returns a Version object file, that has the major, minor, build and revision public attributes, but with the .to_f method returns a formatted string.

You can create a new version object by using

new_version = Version.new("1.3.5.0")The versions are also comparable, then you can do this

if new_version > $game_system.game_version  print "A new update is avaiable"endThere's much more described in the script documentation.

Download

You can download the script from GitHub.

Blog's page

FAQ

Q: Is this script for everyone?

A: A lot of my script require this module, then you have to copy and paste in your project. You can also use this script for your scripts, but it requires scripting skills.

Q: Can I use this script for my commercial project?

A: Yes, you can. all my scripts are distributed under CC-BY license. You just have to credit me.

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,469
Members
137,821
Latest member
Capterson
Top