Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Script Tool - RSC Require

Status
Not open for further replies.
Let's push this topic up a notch. Some screenshot too to show that ScriptEditor works on almost any OS :D

http://i12.photobucket.com/albums/a229/meismeofcourse/script_editor.png[/img]
http://i12.photobucket.com/albums/a229/meismeofcourse/script_editor_mac.png[/img]
Thanks to the Slacked Admin, jamie, for taking this screenshot.
 
Awesome. Here's a question. I know that every game one makes with rmxp requires the rgss102e.dll which is located in C:\Windows\System32. This helps so that one does not have to have a copy of the dll file in every game directory, thus saving some harddrive space. That said, is there a way to put the rsc files in a 'global' directory, like the rgss.dll, and use this script to require them so that one does not have to include them with every game? If so, how would one go about doing this?

I also know that if one does include the rgss.dll in the game's directory, the game will use the local dll rather than the global dll. Can one also do this with the rsc files, in case a game requires an edited version?
 
DraycosGoldaryn's idea is excellent. Get the RTP directory (using those 3 RGSS lines I don't have here right now), and check if the rsc are here in case they weren't in the local directories.

I don't know if you should examine every RTP folder or set up for the root... I guess it's up to you.
 
Ok, Yeyinde answered my question in the IRC chat. He said if one puts
Code:
$: << ENV['SystemRoot'] + '\\System32'
anywhere before one requires, it will search for a local rsc and if it doesn't find one, it will search within System32.

I suppose one could change ENV['SystemRoot'] + '\\System32' to whichever folder one wants the global rsc files to be located.

If you do this multiple times with different directories, it will search each one consecutively until it finds the proper rsc file.

Thank you Yeyinde for this great script, and for answering my questions.
 
Can't these RSC files be edited, so you can basically add any code you want to the game? (Meaning you could easily cheat) Or is there some sort of checksum to make sure the file isn't edited?
 
You can't actually do that because the all the $game_ and $data_ objects do not exist when the RSC files are loaded. They are created during Scene_Title and Scene_Load.
 
Perhaps you could, but who would want to? Any external script library should be considered dangerous and not added unless you know exactly what's in it. Remember that internal scripts are much safer than external scripts. Also, who in their right mind would cheat on an RMXP game? That's just stupid.
 
Any external script library should be considered dangerous and not added unless you know exactly what's in it

This is why I think you really should use load_data, so rsc files can be loaded from an encrypted archive. You should also check if the game is encrypted, and deny any external loading if it is. It really IS a security issue.

Example :

data = load_data('./Data/Scripts.rxdata')
save_data(data, './Scripts.rxdata')

will currently extract Scripts.rxdata from the rgssad and save it to the disc, decrypted. This is a bit worse than cheating, don't you think ?
 
I see. Well, the script is now version 1.1 which uses Kernel#load_data instead of Marshal#load to enable it to read the encrypted archive. The next version will prevent loading external files when there is the archive.
 
Maybe it's just me, but when I use an SDK.rsc and require it instead of including the SDK within scripts.rxdata, I get an error whenever I alias SDK::Scene_Base:

Undefined method `call' for nil:NilClass

Why is this?
 
I aliased SDK::Scene_Base#Update also, When I used Trickster's No F12 script, I get the same thing and he aliased SDK::Scene_Base#main_loop. It works if I include SDK::Scene_Base in the project itself, but if it's only in the SDK.rsc, it does not work.

Here is my script with the line the error appears on red.
Code:
#-----------------------------------------------------------------------------
# * SDK::Scene Base
#-----------------------------------------------------------------------------
class SDK::Scene_Base
  alias advanced_8d_movement_scene_base_update update
  def update
    Mouse.update
    [COLOR=Red]advanced_8d_movement_scene_base_update[/COLOR]
  end
end

And Trickster's script with the offending line red:
Code:
class SDK::Scene_Base
  #--------------------------------------------------------------------------
  # * Main Processing : Loop
  #--------------------------------------------------------------------------
  alias_method :trick_nof12_base_main_loop, :main_loop
  def main_loop
    # Begin
    begin
      # The Usual
     [COLOR=Red] trick_nof12_base_main_loop[/COLOR]
    # If F12 was pressed
    rescue Reset
      # Do Absolutely Nothing about it
    end
  end
end

It doesn't seem to matter if alias_method or alias is used. Because I thought it might be alias_method, but I changed my script to alias and I still get the error. Also, I included Selwyn's Resolution Fix script in an rsc file along with a few other modules I'm using, and I get the same error whenever I call Resolution.update.

I can try to supply a demo, if you want. All these errors go away if the scripts are included in scripts.rxdata, but if they are required via rsc, the error shows.

Nevermind. It's strange, but somehow, I seemed to have deleted Resolution.initialize from my Main and when I put it back in while trying to make a fresh copy to upload, the errors disappeared. So I put it back in in the original project (I'm not sure why I took it out) and now it works. Go figure.

EDIT: Now I've included it in the rsc file and so I no longer have to include it within main. Sorry for the false alarm.

Post Edit: Maybe you should include a way for it to detect errors in rsc files. I believe the reason I was recieving my errors was because in GElib.rsc (which contains selwyn's resolution script) I had aliased SDK::Scene_Base and inserted Resolution.update which, if used without Resolution.initialize will return the error I reported.
 
DraycosGoldaryn;216945":2vfc71d6 said:
Maybe you should include a way for it to detect errors in rsc files. I believe the reason I was recieving my errors was because in GElib.rsc (which contains selwyn's resolution script) I had aliased SDK::Scene_Base and inserted Resolution.update which, if used without Resolution.initialize will return the error I reported.

There is already an error catcher that has been in the script since I released it.
Code:
rescue Exception => error
  print "RSC Script: `#{script_name}'; #{error.type} occured.
#{error.message}"
The game will not close from the error, so things may mess up. Perhaps I'll have it raise the error and close later.
 
My first script is the first part of the script like it should be and below scene_debug a put the require 'lib.rsc' and a got a string load error

see attachement for info... needed help here.. thanks
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top