Main Menu

Launching a Web Page from the RPG program (Bliazzard have you read this ?)

Started by landofshadows, February 16, 2007, 03:41:37 PM

0 Members and 1 Guest are viewing this topic.

landofshadows

I was wondering if there was away of say looking a a sign post in the RPG Maker XP program and it asking if you want to see the WEB page, you say Yes and then it opens it...?

See what I am thinking is to advertise my own WEB site and games from within the game...
 


My RMRK Wikki:- http://wiki.rmrk.net/index.php/Landofshadows
Make a Donation for my Resource making:- https://www.paypal.me/landofshadows

nevfx

Wow...good idea. But I don't have a clue. It must be a script.

:)

wow, I dont know how you would do this but its a great idea...not that this is anything special since you already know this, if it dosen't work out, just show the url.

anyways, good luck with this LOS.   ;D
Watch out for: HaloOfTheSun

landofshadows

#3
Humm... You see another use for it is making a Security login screen at work... I am making an Itranet, and I want it so to go into an area of the Intranet you click a link it opens a cut down version of RPG Maker XP that I have made and then from there I have set an integer script working on a 6 digit code.

A Fun Security application, and fairly unhackable as its embeded into an EXE... WICKED !!!

Just need it to work... Just wondered if there is an ADAVANCED advanced message window script that can launch URL's or Hyperlinks to Drives within a network.

I have found some Ruby Script for GET URL commands... but I don't know nothing about scripting:-
Quoterequire 'mechanize'

class Player

   def initialize(element)
   @data = element
   elementList = @data.elements
   @name = elementList.to_a(".//a[@class='name']")[0].text
        gameLink = elementList.to_a(".//td[@class='gametime']/a")[0]
   if gameLink
      daLink = gameLink.attribute('href')
      if !gameLink.to_s.include?('preview')
         @started = true
      end
      @link = daLink.to_s.sub('recap','boxscore')
      @status = gameLink.text.to_s
   else
      @link = ''
      @status = ''
   end
   
   end

   def started
   @started
   end

   def name
   @name   
   end

   def link
   @link
   end

   def status
   @status
   end
   
end

class BoxScore

   def initialize(url, agent)
   @url = url
   @agent = agent
   page = @agent.get(@url)
   page.watch_for_set = {}
   page.watch_for_set['body']=nil
   body = page.watches['body'][0]
   tables = body.elements.to_a("//table[@class='yspwhitebg']")
   tables.each do | t |
      header = t.elements.to_a('tr[1]/td[1]')[0]
      if header.text   
         if header.text.to_s == 'Rushing'
            @rushing = t
         end
         if header.text.to_s == 'Receiving'
            @receiving = t
         end
         if header.text.to_s == 'Passing'
            @passing = t
         end
      end
   end
   end

   def print_stats(player)
   print_table('Passing', player, @passing, 4,9)
   print_table('Rushing', player, @rushing, 3,6)
   print_table('Receiving', player, @receiving, 3,6)
   end

   def print_table(stat_name, player, table, yd_index, td_index)
   exp = "tr[@class='ysprow1' or @class='ysprow2']"
   if table
      stats = table.elements.each(exp) do |row|
         firstData = row.elements.to_a("td[1]")[0].text
         if  firstData.to_s == player.name
            print stat_name + ' Yds:' + row.elements.to_a("td["+yd_index.to_s+"]")[0].text
            print ' TDs:' + row.elements.to_a("td["+td_index.to_s+"]")[0].text
            puts
         end
      end
   end
   end

end

agent = WWW::Mechanize.new
agent.user_agent_alias = 'Windows IE 6'

username = ARGV[0].strip
password = ARGV[1].strip
teamPage = ARGV[2].strip

#  puts username +"@" + password +':'+ teamPage

loginPage = agent.get('http://login.yahoo.com/config/login')
form = loginPage.forms.find {|f| f.name == 'login_form'}
form.fields.find {|f| f.name == 'login'}.value = username
form.fields.find {|f| f.name == 'passwd'}.value = password
loginResult = agent.submit(form, form.buttons.first)
# puts loginResult.inspect

page = agent.get(teamPage)

page.watch_for_set = {}
page.watch_for_set['tr']=nil

statLines = ['even', 'odd', 'odd first', 'odd last', 'even last', 'even first']

stats = page.watches['tr'].find_all {|n| statLines.include?(n.attributes['class'])}

#puts stats.inspect

for element in stats
   player = Player.new(element)
   puts player.name + ' - ' + player.status
   if player.started
      boxScore = BoxScore.new(player.link, agent)
      boxScore.print_stats(player)
   end
   puts
end
 


My RMRK Wikki:- http://wiki.rmrk.net/index.php/Landofshadows
Make a Donation for my Resource making:- https://www.paypal.me/landofshadows

nevfx

Wow. My school uses a Intranet as a register, they called it e-PORTAL. Where did you find that? I don't understand it either.

landofshadows

The programming language used to script in for RPG Maker XP I have heard is loosely based on Ruby Script... So I searched on GET URL Commands... I think thae above relates to an online football game or some thing ?

I think I may be getting close to working this out... In the Conditional branch function it lets you add a script entry... Or I may be bale to to trigger it using Common events some how...?
 


My RMRK Wikki:- http://wiki.rmrk.net/index.php/Landofshadows
Make a Donation for my Resource making:- https://www.paypal.me/landofshadows

nevfx

Yeah, you can enter a script can't you? I'd never figure it out, but I'm sure you will.

landofshadows

Darn it... I still can't get it to work...

Does any body know the ruby code to launch a page ?
 


My RMRK Wikki:- http://wiki.rmrk.net/index.php/Landofshadows
Make a Donation for my Resource making:- https://www.paypal.me/landofshadows

landofshadows

GRRRrrrr I Still can't get it to blinking work...

Blizzard, if your about do you know how to make RPG Maker Launch a WEB page ?
 


My RMRK Wikki:- http://wiki.rmrk.net/index.php/Landofshadows
Make a Donation for my Resource making:- https://www.paypal.me/landofshadows

Blizzard

Sorry, but I'm not very familiar with web pages. =/ I guess the Ruby script would need to know how to interprete an html script and/or any other of the various scripts. =/ To make a web browser in RMXP would be a lot of work. =/
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

landofshadows

OK... I have found this... does this help ?
- I want RPG Maker XP to call to IE...

QuoteGawnsoft wrote:
>>No, seriously, I've written a number of simple scripts to fetch web
>>pages.  Usually they just construct a URL based on some command-line
>>input, then make a system call to launch a browser.  I search Google
>>this way, as well as look for stuff on buy.com, check TV listings, read
>>the news, grep/navigate my local wiki, a few other things.
>
>
> Could I see them please?
>


Here's a simple case: google

# file g.rb
$: << File.dirname( __FILE__ )
require 'browser'

$url = 'http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q='
if ARGV.size < 1
   puts "You need to enter at least one search word."
else
   $url << ARGV.join("+")
   $stderr.puts "Calling #{$url}"
   Browser.new( 'FB' ).get( $url )
end
# end of file

Next is the code for browser.rb.  It's meant to run on Windows.
I've never bothered to try it on Linux; executable paths would
have to change, as well as the calling convention (e.g., 'call
someApp.exe'), but maybe not much else.  (Actually, I think the big
issue for me is that when I launch Mozilla or Firefox , and there is
already an instance running, it stupidly insists I select another
profile, or create a new one, or I can't use the new instance.  That
doesn't happen on Windows.)

I believe I use a thread to launch the browser so that the script ends
and I get my command prompt back; I run my browser scripts from the
command line,  like so:

C:\> g some search words

Windows handles the file extension stuff automagically, as I've added
the script directory to my PATH variable.

But, without using a thread, the script would just wait until I closed
the browser, which is annoying.

Anyway, once I put together the Browser class I needn't think about it
when I write other scripts for pulling up web sites.  (And 'less
thinking' is one of the goals of coding. :) )

# browser.rb

class Browser
   DEFAULT = 'FB'
   CB = 'CB'
   IE = 'IE'
   MOZ = 'MOZ'
   OP = 'OP'
   FB = 'FB'

   @@exe = Hash.new( 'explorer')
   @@exe['IE'] = 'explorer'
   @@exe['CB'] = '"E:/Program Files/Crazy Browser/Crazy Browser.exe"'
   @@exe['OP'] = 'e:/Program Files/Opera7/opera.exe'
   @@exe['MOZ'] = 'e:/Program Files/mozilla.org/Mozilla/mozilla.exe'
   @@exe['FB'] = 'E:/MozillaFirebird/MozillaFirebird.exe '

   def initialize( browser_name = Browser::DEFAULT  )
     @broswser = browser_name
     @b_exe = select_exe( browser_name )
     $stderr.puts( "Using broswer #@broswser ")
   end

   def get( url )
     $stderr.puts( "get is using #@b_exe" )
     Thread.new( url ){ |t|  `call  "#{@b_exe}" "#{url}"`  }
   end

   def select_exe( bname )
     @@exe[ bname ]
   end

   def self.get( url,
     browser_name = ( @broswser ? @broswser : Browser::DEFAULT ) )
     exe = Browser.new(browser_name).select_exe( browser_name )
     Thread.new( url ){ |t| `start  "#{exe}" "#{url}"`  }
   end
end


# End of browser.rb

Lookng at the code now, there's cruft and goofiness, but it works so I
haven't bothered to clean stuff up.  But for a newcomer, it might be
worthwhile to try writing a class that allows the user to 1) optionally
select a particular browser to use (but have a default browser defined),
  2) pass in the URL to load, 3) ensures that the script can run and
exit without having to wait until the browser closes.

Here's another script; this one calls Yahoo maps, like this:

c:\> map 11123 Main Street, Scottsdale, AZ 85251

# map.rb
$: << File.dirname( __FILE__ )
require 'browser'
$base_url = 'http://maps.yahoo.com/py/maps.py?Pyt=Tmap'

def argstr_to_qstring( str )
   parts = str.split( ',', 2)
   street = parts[0].strip.gsub( / /, '+')
   state = parts[1].strip.gsub( / /, '+')
   "&addr=#{street}&csz=#{state}"
end

def args_to_mapurl( args )
   a  = args.join(' ')
    "#{$base_url}#{argstr_to_qstring( a )}&Get%A0Map=Get+Map"
end

if ARGV.size < 1
   puts "You need to enter an address."
else
   url = args_to_mapurl( ARGV )
   Browser.get( url , Browser::MOZ )
end

# end of map.rb

This one is a bit gnarlier.  But, once someone has written a general way
to launch a Web browser, a next step might be to explore manipulating
the input to construct more complex URLs.  The goal is to make it easy
to type at the command line, and let the code do the busy work.

James
 


My RMRK Wikki:- http://wiki.rmrk.net/index.php/Landofshadows
Make a Donation for my Resource making:- https://www.paypal.me/landofshadows

Blizzard

$explorer = Thread.new("C:\Program Files\Internet Explorer\iexplore.exe")


Using this command anywhere in your script should launch IE. ;8
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!