RGSS WebKit

Gleen

Veteran
Veteran
Joined
Jun 14, 2012
Messages
98
Reaction score
21
First Language
portuguese
Primarily Uses
RGSS Web Kit




by Gustavo Bicalho, demo by Gleen


Introduction

This was an old script made for RPG Maker XP but since it don't overwrites any of RGSS core classes it works in any version of RPG Maker you want. Therefore, since there wasnt a thread for this system I'm posting one now.

The RGSS Web Kit (RWK) was designed to allow simple HTTP access through RGSS. I wanted to download resources from the web, so that's what it does: download resources from the web. However, this isn't a script for people who don't know RGSS, at least some basic stuff. There's no ready-to-use "Scene_ResourceDownloader" or something like that. RWK gives you a way to get online, but it's completely up to you to make it useful.

What you can do with RWK: download resources, send Post data to a server and read the response, send requests with special headers and check the headers of the response.

You can use this to create an Online Ranking, or some kind of chat or bulletin board in your game, or to check and download updates. Like the whole game making thing, it's all up to your creativity.

Remember: this is a HTTP library, not a browser. It won't do everything for you. If you want to access some service that needs cookies, you will have to emulate those cookies by yourself and deal with the HTTP headers. The same applies to everything else beyond the normal "Get" and "Post like a web form". RWK gives you only the basic stuff.

Instructions

Download the open version demo and copy the scripts of the section --codes and the AsyncHTTP.dll to your project. The session --Documentation holds information about how to better use RWK.

The Demo

There are two demo versions, one closed wich show you the system working (a maze with a online ranking), and an open version wich lets you browse the scripts but you can't submit your results (trying to keep the ranking bug-free).

Closed version download

Open version download

Compatibility

RWK should be compatible with any normal scripts. The only way you could have a problem is if some script changes classes from the core Ruby library (like class Thread or class Proc), which (I think) is not frequent.

Terms and Conditions

RWK is released under Creative Commons BY license. That means you must give credit to Gustavo Bicalho for the script if you use or redistribute it.
 

Jet

Flying in a sky near you
Veteran
Joined
Mar 19, 2012
Messages
172
Reaction score
103
First Language
English
Primarily Uses
This actually very interesting, I'll have to take a deeper look to see how to work everything.

Also it seems I hit the high-score after 3 go throughs :3 (Well other than that pesky 0:00, I don't think I can beat that.)
 

Gleen

Veteran
Veteran
Joined
Jun 14, 2012
Messages
98
Reaction score
21
First Language
portuguese
Primarily Uses
This actually very interesting, I'll have to take a deeper look to see how to work everything.

Also it seems I hit the high-score after 3 go throughs :3 (Well other than that pesky 0:00, I don't think I can beat that.)
Haha, that 00:00 record was a bug that i found, I named him "carteiro" in reference to the running man of Zelda OoT
 
  • Like
Reactions: NPC

PK8

I sense there's something in the wind...
Veteran
Joined
Mar 17, 2012
Messages
1,220
Reaction score
152
Primarily Uses
inb4 DLC in RPG Maker games.

This is awesome.
 

Jomarcenter

jomarcenter-MJM
Veteran
Joined
Apr 24, 2012
Messages
1,270
Reaction score
207
First Language
ENGLISH
Primarily Uses
RMMV
look like i can use this for my game. if i can get a server for it.

well i'm going to find a way to make the system have.

-ONLINE mutiplayer battles.

-ONLINE mini-game hi-score system.

-and other ONLINE services. (like accounts... and data cloud system...)

you should also open a forums where people can post add-on for this so for some people who don't know advance RGSS can also use others scripts for that.

question:

and how do i set up this system on the server itself? or you going to provide for it?

if you going to provide it well good luck if your server is now full of savedata lolz...
 
Last edited by a moderator:

Mako

Veteran
Veteran
Joined
Mar 13, 2012
Messages
276
Reaction score
48
First Language
English
Primarily Uses
You should prolly throw up Khas Awesome Light Effects credit for his work in your demo.

Great Job :) Being fantastic with HTML myself I hope I can pull some cool things off.
 

Gleen

Veteran
Veteran
Joined
Jun 14, 2012
Messages
98
Reaction score
21
First Language
portuguese
Primarily Uses
look like i can use this for my game. if i can get a server for it.

well i'm going to find a way to make the system have.

-ONLINE mutiplayer battles.

-ONLINE mini-game hi-score system.

-and other ONLINE services. (like accounts... and data cloud system...)

you should also open a forums where people can post add-on for this so for some people who don't know advance RGSS can also use others scripts for that.

question:

and how do i set up this system on the server itself? or you going to provide for it?

if you going to provide it well good luck if your server is now full of savedata lolz...
Server side it's on your own buddy, you have to do everything. RWK only gives you a way to send HTTP data to a web service through rpg maker... and i actually like the forum idea.

You should prolly throw up Khas Awesome Light Effects credit for his work in your demo.

Great Job :) Being fantastic with HTML myself I hope I can pull some cool things off.
Sure, i'll update the demo with credits for him :)
 

molster

Villager
Member
Joined
Apr 23, 2013
Messages
7
Reaction score
2
Primarily Uses
hello

so I was wondering if you could make a -small- example -

The issue is in the viewable version - you leave out the site info, and there is so much else going on, its a little tricky to see what commands to call and how.

Like, lets say we want to get a variable from http://www.exmaple.com/info.php?character={CHARACTERNAME} and simply store it to a var

and then an exmaple of sending two vars to http://www.exmaple.com/storeinfo.php

update: been working at this for a bit. The information in the help files for it is nice, I just wish they had one simple full example.

update2: turns out I might have had it working, but im getting error 1205 instantly - "Unable to open the network connection profile."

could possibly be a windows 8 thing? not able to try it in the closed version to see if it works (since its an example , you should probably make that maze a little easier :p )

Update3: So I cheated on the maze to take a look, and the script 100% works in that version. so im not sure what is not working on my end. Guess I really do need a generic basic example
 
Last edited by a moderator:

Gleen

Veteran
Veteran
Joined
Jun 14, 2012
Messages
98
Reaction score
21
First Language
portuguese
Primarily Uses
Alright, Let's say youw ant to post something to http://www.exmaple.com/storeinfo.php:

Code:
def post_something      conn = $session.connect("example.com") # Your host, withou http:// and www      path = "storeinfo.php" # Path to your server side file      callback = Proc.new() { |req, done, error|        req.close();        if !done          @help_window.set_text("Failed to send data.") # error message          File.delete("out.txt") # Delete the temp file          break        end        if !conn.has_open_requests?          conn.close()        end        s = ""        # Now create a temp file to hold data        File.open("out.txt") { |f|          f.each_line { |line| s += line }        } # Delete the temp file        File.delete("out.txt")      }      # Now we send our data to our server. See that var1 and var2 are the variable we want to post.      conn.send_post_form_request(path,false,nil,"out.txt", "var1=" + @var1 + "&var2=" + @var2, &callback)end
Now, to get some data from our server:
Code:
#-----------------------------------------------------------------------------  # * Get_Contents  # This method will send a GET HTTP request, connecting with a host and  # downloading data. Then it'll parse the data and prepare it for output in UI.  #-----------------------------------------------------------------------------  def get_contents    conn = $session.connect("example.com") # host adress    path = "storeinfo.php" # path to file    callback = Proc.new() { |req, done, error|      req.close();      if !done        draw_text(Rect.new(0,0,504,32), "Couldn't read data") # Error Message        File.delete("out.txt") # delete the temp file wich hold the results        break      end      # Now I'll create a temp file wich will hold the request results and the process my results      File.open("out.txt") { |f|        #... code to process the results      }      File.delete("out.txt") # Delete the temp file    }    conn.send_get_request(path,false,nil,"out.txt",&callback) # send the request.  end
Hope that helps you.
 

molster

Villager
Member
Joined
Apr 23, 2013
Messages
7
Reaction score
2
Primarily Uses
hah,

so in the instructions it said "It should start  with a slash ("/")" for the path object, and that must have been what was killing it.

Was able to get it to save the data to the text file (however my script I had to read it froze the game hehe, will need to work on that) [still having trouble display the contexts, cant even get the base text to display once got.. but ill get there]

Thank you, I have some grand ideas for this I can't wait to get to work on. 

Fantastic, ty!

edit: 100% working! Thank you so much, Will be pumping out several public scripts now for people to use!
 
Last edited by a moderator:

Hendrik

Villager
Member
Joined
Mar 14, 2012
Messages
38
Reaction score
1
First Language
German
Im interesting using the script aswell,

but im wondering how to connect to a server with a port.

Example:

def get_contents conn = $session.connect("domain.com:443") # host adress path = "/get/test/test2/test" # path to file callback = Proc.new() { |req, done, error| req.close(); if !done draw_text(Rect.new(0,0,504,32), "Couldn't read data") # Error Message File.delete("out.txt") # delete the temp file wich hold the results break end # Now I'll create a temp file wich will hold the request results and the process my results File.open("out.txt") { |f| } File.delete("out.txt") # Delete the temp file } conn.send_get_request(path,false,nil,"out.txt",&callback) # send the request. endit will give me the error code: 12005 = Invalid URL.

What am i missing?
 
Last edited by a moderator:

soulgem

-The one and only-
Member
Joined
Dec 22, 2013
Messages
1
Reaction score
0
First Language
English
Primarily Uses
Im interesting using the script aswell,

but im wondering how to connect to a server with a port.

Example:

def get_contents conn = $session.connect("domain.com:443") # host adress path = "/get/test/test2/test" # path to file callback = Proc.new() { |req, done, error| req.close(); if !done draw_text(Rect.new(0,0,504,32), "Couldn't read data") # Error Message File.delete("out.txt") # delete the temp file wich hold the results break end # Now I'll create a temp file wich will hold the request results and the process my results File.open("out.txt") { |f| } File.delete("out.txt") # Delete the temp file } conn.send_get_request(path,false,nil,"out.txt",&callback) # send the request. endit will give me the error code: 12005 = Invalid URL.

What am i missing?
looks like you are missing the extension, for example ".php"

it should look something like this:

...

path = "/get/test/test2/test.php" # path to file

...

hope hat helps.
 

deathsia

Pegisister
Veteran
Joined
Feb 26, 2014
Messages
651
Reaction score
55
First Language
English
Primarily Uses
Please don't tell me that the maker of this script has disappeared, I could really use his help!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,798
Reaction score
7,880
First Language
German
Primarily Uses
RMMV
Please don't tell me that the maker of this script has disappeared, I could really use his help!
If you move your mouse over the link to the OP's profile, it currently lists "last active" as about eleven months back.
So there is a good chance that the scripter is no longer active in the RM-Community.


But if you ask your questions here, someone else might be able to help you.
 

some1one

Villager
Member
Joined
May 20, 2015
Messages
11
Reaction score
0
First Language
English
Primarily Uses
so, i keep getting the 12005 error. I am assuming it is because I am not using a file extension. Can anyone confirm that this does not work with sites like asp.net that don't have extensions?
 

Cleosetric

Warper
Member
Joined
Nov 28, 2016
Messages
1
Reaction score
0
First Language
Indonesia
Primarily Uses
hi, can i ask? how to get the the size from file currently downloading?

i've sending request of download from link that's in localhost to rgss3 folder.

Code:
link = "http://www." + link
system("start #{ link }")

and from php code :

Code:
$filename = "localhost/patches/update.zip";
if (file_exists($filename)) {
$fileexist = true;
} else {
$fileexist = false;
}

echo . filesize($filename) . ";" . $fileexist;

but how to get the currently file size that in downloading? can anybody help me? thanks in advance.
 

Latest Threads

Latest Posts

Latest Profile Posts

The self-righteous indignation of family when you expect them to pay back money you've leant to them never ceases to amaze me.
Gamedev for relaxing? yes or no?
I've been having a rough couple of months and as such let down some friends of mine in the RPG Maker community. I still need time to get back to my normal self, but it's nice to be back, to read articles, and to design again (albeit at a slow pace). Hope to give updates on Kid Crescent soon.
Friendly reminder that you don't have to be able to do absolutely everything. It's okay to scale back features or assets if things are too much - especially if you're the only one working on the game! And you can always add things in later. <3
My new cutscene system makes it so much easier to add parallel stuff happening in the background, I can easily fill the whole screen with action.

Forum statistics

Threads
107,734
Messages
1,031,734
Members
139,867
Latest member
angeallen
Top