Help - Search - Members - Calendar
Full Version: RM Web Browser
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS2-Submissions
berka
RM Web Browser
Version: 1.0
By: Berka


Introduction

Now, you're able to launch a web browser directly in the Rgss Player.

Features

  • Esc key quits the browser
  • The Maximize Window button is activated. You can resize your rgss player


Screenshots

Is it really usefull ?

Demo

None

Script

The dll: copy it into the root of your project:
there

CODE
#===============================================================================
#                              RM Web Browser                             4/8/09
#-------------------------------------------------------------------------------
#  par Berka                        v 1.0                           rgss 1 & 2        
#-------------------------------------------------------------------------------
# Display a web browser in the rgss player.
#  - NEED the cwebpage.dll. It HAS TO be placed on the root of the project.
#  - Esc to close the browser, F5, Back keys
#  - Clic on the maximize button to resize the window
#  call: Net.browser("http://rpgmakervx.1fr1.net")
#===============================================================================

wdll="cwebpage.dll"
GPPS = Win32API.new('kernel32', 'GetPrivateProfileString', 'pppplp', 'l')
FW   = Win32API.new('user32',   'FindWindow',              'pp',     'i')
SWL  = Win32API.new('user32',   'SetWindowLong',           'lll',    'l')
GCR  = Win32API.new('user32',   'GetClientRect',           'lp',     'i')
GAKS = Win32API.new('user32',   'GetAsyncKeyState',        'i',      'i')
EBO  = Win32API.new(wdll,       'EmbedBrowserObject',      'l',      'i')
DHP  = Win32API.new(wdll,       'DisplayHTMLPage',         'lp',     'i')
RB   = Win32API.new(wdll,       'ResizeBrowser',           'lll',    'i')
UEBO = Win32API.new(wdll,       'UnEmbedBrowserObject',    'l',      'l')
DPA  = Win32API.new(wdll,       'DoPageAction',            'll',     'l')
def handle
  GPPS.call("Game","Title","",title="\0"*256,256,".//Game.ini")
  FW.call("RGSS Player",title.delete!("\0"))
end

SWL.call(handle,-16,0x10C70000|0x00080000)

def dimensions
  GCR.call(handle,rect=[0,0,0,0].pack('l4'))
  rect.unpack('l4')[2..3]
end
module Net
  def self.browser(url)
    EBO.call(handle)
    DHP.call(handle,url)
    RB.call(handle,*dimensions)
    loop do
      break if GAKS.call(0x1b)&0x01==1
      DPA.call(handle,0)if GAKS.call(0x08)&0x01==1
      DPA.call(handle,4)if GAKS.call(0x74)&0x01==1
      RB.call(handle,*dimensions)
    end
    UEBO.call(handle)
  end
end
Net.browser("http://rpgmakervx.1fr1.net")


Instructions

See comments in the script, please.

Compatibility

Does not work for RMXP: hangup bugs.

Credits and Thanks

Notepad++, for his hexadecimal browser.
The Dll's creator.

Terms and Conditions

Free for use... but DO NOT post my script everywhere whithout permission. Thanks !

best regards,

berka
Speed@
You are the best french rgss2 scripter! This will provably be used as a framework in Phoenix script and Enix 2 (MMORPG)
Speed@
OK, I tested it, i don't like how it blacks out for a few seconds if I write something or click and such.
JoRu
A little buggy (for example, if I call the script from an event the map I called it from reappears for a few seconds while I'm browsing sometimes) but otherwise it works surprisingly well! Could be useful! smile.gif
silvershadic
It opens up the webpage at the beginning of the game, and when i try to call it it doesn't work. i get the error message:

Argument error occurred while running the script

wrong number of arguments (0 of 1)

It opens up the webpage at the beginning of the game, and when i try to call it it doesn't work. i get the error message:

Argument error occurred while running the script

wrong number of arguments (0 of 1)
berka
Well, the last line of the script is a sample call.
You have to remove it before using that.
And you can replace the url by your own.

berka
silvershadic
QUOTE (berka @ Aug 4 2009, 12:38 PM) *
Well, the last line of the script is a sample call.
You have to remove it before using that.
And you can replace the url by your own.

berka

this is what my script looks like:
CODE
#=================================================================
==============
# RM Web Browser 4/8/09
#-------------------------------------------------------------------------------
# par Berka v 1.0 rgss 1 & 2
#-------------------------------------------------------------------------------
# Display a web browser in the rgss player.
# - NEED the cwebpage.dll. It HAS TO be placed on the root of the project.
# - Esc to close the browser, F5, Back keys
# - Clic on the maximize button to resize the window
# call: Net.browser("http://rpgmakervx.1fr1.net")
#===============================================================================

wdll="cwebpage.dll"
GPPS = Win32API.new('kernel32', 'GetPrivateProfileString', 'pppplp', 'l')
FW = Win32API.new('user32', 'FindWindow', 'pp', 'i')
SWL = Win32API.new('user32', 'SetWindowLong', 'lll', 'l')
GCR = Win32API.new('user32', 'GetClientRect', 'lp', 'i')
GAKS = Win32API.new('user32', 'GetAsyncKeyState', 'i', 'i')
EBO = Win32API.new(wdll, 'EmbedBrowserObject', 'l', 'i')
DHP = Win32API.new(wdll, 'DisplayHTMLPage', 'lp', 'i')
RB = Win32API.new(wdll, 'ResizeBrowser', 'lll', 'i')
UEBO = Win32API.new(wdll, 'UnEmbedBrowserObject', 'l', 'l')
DPA = Win32API.new(wdll, 'DoPageAction', 'll', 'l')
def handle
GPPS.call("Game","Title","",title="\0"*256,256,".//Game.ini")
FW.call("RGSS Player",title.delete!("\0"))
end

SWL.call(handle,-16,0x10C70000|0x00080000)

def dimensions
GCR.call(handle,rect=[0,0,0,0].pack('l4'))
rect.unpack('l4')[2..3]
end
module Net
def self.browser(url)
EBO.call(handle)
DHP.call(handle,url)
RB.call(handle,*dimensions)
loop do
break if GAKS.call(0x1b)&0x01==1
DPA.call(handle,0)if GAKS.call(0x08)&0x01==1
DPA.call(handle,4)if GAKS.call(0x74)&0x01==1
RB.call(handle,*dimensions)
end
UEBO.call(handle)
end
end


and this is my call:
CODE
Net.browser
("http://theendlesswar.ning.com/")
berka
try that:
CODE
Net.browser("http://theendlesswar.ning.com/")

or, if you havn't enough space:
CODE
Net.browser(
"http://theendlesswar.ning.com/")
silvershadic
QUOTE (berka @ Aug 4 2009, 12:56 PM) *
try that:
CODE
Net.browser("http://theendlesswar.ning.com/")

or, if you havn't enough space:
CODE
Net.browser(
"http://theendlesswar.ning.com/")

thanks it works
Speed@
Hey berka, you should tweak the update method more, while you click on something or write, it either shows a black screen, if launching directly, or if from a map, it shows the map you launched it from for a few seconds.
Herendil
Oh yes, this is very useful!
I looked for a way to show mein Handbook ingame and and with this here I can call it as a PDF by Script!
I love it!

Edit: Oh man, there is a major bug: If I resize the Window by clicking the button, the window isnīt really 544*416 px! In addition I can pull the window bigger when I pull at the corners.... Pls fix this....
AmIMeYet
Pretty nice smile.gif

Oh, and the dll's creator is called Jeff Glatt.
I will add though, that there are some security issues with this (using IE as a base is not the brightest idea ever; almost no security), and there are some possible memory leaks, etc.

So guys, be carefull what url you throw at your users!
onidsouza
Great! It supports php, JavaScripts, RubyOnRails and all that special stuff?

Not planning to use it, but will be good to know!
ZeroFrost
is there anyway to make the internet part of this just a small hud. i might link my forum's chat window into the game
Xzygon
Lol, necroposter!

As far as I can tell, no, there's no way to make it into an HUD. It put the WHOLE browser into the game, it doesn't turn it into a little hud.
Even if you can turn it into a HUD, you'll have to make it center exactly onto the chat window and lock it there, otherwise the player can just move about the window and exit the chat altogether, and I'm pretty sure you don't want that.
ZeroFrost
i got the

wrong number of arguments (0 of 1) popup... idk why it does that but could someone help????

EDIT: now i get the Syntax error thing... anyone know a fix for that/
Speed@
QUOTE (sailorspx @ Dec 30 2009, 05:34 PM) *
i got the

wrong number of arguments (0 of 1) popup... idk why it does that but could someone help????

EDIT: now i get the Syntax error thing... anyone know a fix for that/

Nobody yet got this error, so you must have been trying to do something yourself. And as we cannot see what you did (script code) we cannot help. Also for the Syntax error, that's usually the easiest error to fix, if you look at the script. But we cannot see the code so = no help.

ZeroFrost
if ya wanna see what im using, scroll up and look at that one but take out the last line and thats what i have
dokdo2005
Can I post your script on another site, "http://www.niotsoft.com"?
berka
@dokdo: Yes, you can. Thanks for asking !
@sailorspx: could you post your call there ?

regards,
berka
dokdo2005
When I use your script in a event, the player outputs the error, "SyntaxError occured while running script."
This is my script.
CODE
#===============================================================================
#                              RM Web Browser                             4/8/09
#-------------------------------------------------------------------------------
#  par Berka                        v 1.0                           rgss 1 & 2        
#-------------------------------------------------------------------------------
# Display a web browser in the rgss player.
#  - NEED the cwebpage.dll. It HAS TO be placed on the root of the project.
#  - Esc to close the browser, F5, Back keys
#  - Clic on the maximize button to resize the window
#  call: Net.browser("http://rpgmakervx.1fr1.net")
#===============================================================================

wdll="cwebpage.dll"
GPPS = Win32API.new('kernel32', 'GetPrivateProfileString', 'pppplp', 'l')
FW   = Win32API.new('user32',   'FindWindow',              'pp',     'i')
SWL  = Win32API.new('user32',   'SetWindowLong',           'lll',    'l')
GCR  = Win32API.new('user32',   'GetClientRect',           'lp',     'i')
GAKS = Win32API.new('user32',   'GetAsyncKeyState',        'i',      'i')
EBO  = Win32API.new(wdll,       'EmbedBrowserObject',      'l',      'i')
DHP  = Win32API.new(wdll,       'DisplayHTMLPage',         'lp',     'i')
RB   = Win32API.new(wdll,       'ResizeBrowser',           'lll',    'i')
UEBO = Win32API.new(wdll,       'UnEmbedBrowserObject',    'l',      'l')
DPA  = Win32API.new(wdll,       'DoPageAction',            'll',     'l')
def handle
  GPPS.call("Game","Title","",title="\0"*256,256,".//Game.ini")
  FW.call("RGSS Player",title.delete!("\0"))
end

SWL.call(handle,-16,0x10C70000|0x00080000)

def dimensions
  GCR.call(handle,rect=[0,0,0,0].pack('l4'))
  rect.unpack('l4')[2..3]
end
module Net
  def self.browser(url)
    EBO.call(handle)
    DHP.call(handle,url)
    RB.call(handle,*dimensions)
    loop do
      break if GAKS.call(0x1b)&0x01==1
      DPA.call(handle,0)if GAKS.call(0x08)&0x01==1
      DPA.call(handle,4)if GAKS.call(0x74)&0x01==1
      RB.call(handle,*dimensions)
    end
    UEBO.call(handle)
  end
end

And this is my call.
CODE
Net.browser("http://www.xpressengine.com")

What is a problem?
ZeroFrost
im trying call http://vampirepikapal.chatango.com
jomarcenter
it can be use as an HTML file?
ex. D:/program file/{game name}/instruction.HTML
Shadyone
Totally awesome biggrin.gif I'll be needing this in my game Solid Beats, of course I'm also wondering if it can just load .html files like the above person said, since that's what I'm planning to do with it. Custom web browser xD (I know how to code html files)
stripe103
I think it can. But the address may be such as jomar says, or it can be with for example file:// in the beginning, so just try it out. Test everything that you can find out.
berka
Hi,

The script is able to display every kind of html pages. The type of protocol does not matter as long as the file is founded: file, http, https or even ftp are supported.

Thanks for using my script
Regards,

Berka
Shadyone
Oh that's cool, thats berka
dotsonface
Pretty good, but has no security software with it. I doubt you would want to create security software with it anyway though.
stripe103
I don't remember how it is with this script, but if there isn't any address bar, then it's up to the developer(s) to make sure the pages used is secure.
If there is an address bar, then it's just like any kind of browser, it's up to the user on what pages they visit.
joshuathen
thanks for script, iwill put credits for thi9s one
Jay287
Hey,

Sorry if this is a necropost but, line 19 gives me an error O:
Night_Runner
Make sure to download the dll file (the link is directly where the script is), and put it in the root folder of your game (along the top in your game's editor >> Game >> Open Game Folder).
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.