Jump to content
Sign in to follow this  
KageDesu

ScriptLoader (protect you scripts)

Recommended Posts

 ScriptLoader

 
Author : Pheonix KageDesu

Version: 1.0
Introduction :
This script add new module ScriptLoader. This module allow you load scripts from text files (.txt or .rb) or binary .sx files.
 
(Google translate)
With this script and utilities you can maintain the integrity of your code by dividing your script into two parts (interface and implementation). As part of the interface to make all the constants and the values ​​that your idea on the user can change to customize your script for themselves. In implementation part other code. Implementation part you can convert to binary format (special utility exists). Implementation is in binary form, and no one can see your code, but code, will be performed in the game. 

 

Very easy to use, see demo.

 

Script:

 

 

 

Link (demo and files) : https://dl.dropboxusercontent.com/u/88841876/ScriptLoader_Demo_ENG.rar (DropBox)

Mirror : https://yadi.sk/d/YKEDJsQcbRsLY (Yandex)

 

Must be first in you scripts DB with name "PKD_ScriptLoader"

It's rule need for work C# Reflector

#ScriptLoader v1.0 by Pheonix KageDesu
Win32API.new('PKD_Wrapper.dll', 'init', '', '').call()

Load you scripts from files:

In any place

#Binary script from .xs file
ScriptLoader.loadX("Script name without extension");

#Text script from .txt or .rb file
ScriptLoader.load("Script name without extension")

 

 

 

How to use:

 

1)Download demo. Demo - simple example and contains all files.

2)RGSS_ScriptToBin.exe - crypt your script (.txt or .rb) to .xs. (Drag and drop text file with code on it)

 

Compatibility issues: [Attention please!]

 

 

1) .NET Framework 4 http://www.microsoft.com/en-us/download/details.aspx?id=17851

2) Visual C++ Redist 2013 http://www.microsoft.com/en-us/download/details.aspx?id=40784

 

3) RGSS_ScriptToBin.exe not convert to binary scripts, if they have regular expression in code. (To avoid transfer regular expr's like a const's to the interface)

4) Tested on 110 ACE Standart RTP Scripts, all were formatted to binary, all were included by ScriptLoader and worked. BUT one script - Window_Base not worked (it's have regular expressions) 

 

 

Example:

 

module MY_SCRYPT
  #This values user can change!
  FONT_SIZE = 62 
  TEXT = "ScriptLoader"
 
#But this code (under) i want to hide. And it will take more place below.

class MyScene < Scene_Base
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
	create_background
	create_test
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
	update_test
 
	#EXIT
	if(Input.trigger?(:)
		SceneManager.return
	end
 
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
	super
	dispose_background
	dispose_test
  end
	#--------------------------------------------------------------------------
  # * Create Background
  #--------------------------------------------------------------------------
  def create_background
    @background_sprite = Sprite.new
    @background_sprite.bitmap = SceneManager.background_bitmap
    @background_sprite.color.set(16, 16, 16, 128)
  end
  #--------------------------------------------------------------------------
  # * Free Background
  #--------------------------------------------------------------------------
  def dispose_background
    @background_sprite.dispose
  end
 
	def create_test
	@s = Sprite.new()
	@s.bitmap = Bitmap.new(Graphics.width,Graphics.height)
	@s.bitmap.font.size = MY_SCRYPT::FONT_SIZE
	@s.bitmap.draw_text(0,(Graphics.height/2)-100,Graphics.width,100,MY_SCRYPT::TEXT,1)
	end
 
	def update_test
	@s.update
	end
 
	def dispose_test
	@s.dispose
	end
 
end

Divede this to two parts :
Interface part

module MY_SCRYPT
  FONT_SIZE = 62 
  TEXT = "ScriptLoader"
end

Implementation part

module MY_SCRYPT
class MyScene < Scene_Base
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
	create_background
	create_test
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
	update_test
 
	#EXIT
	if(Input.trigger?(:)
		SceneManager.return
	end
 
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
	super
	dispose_background
	dispose_test
  end
	#--------------------------------------------------------------------------
  # * Create Background
  #--------------------------------------------------------------------------
  def create_background
    @background_sprite = Sprite.new
    @background_sprite.bitmap = SceneManager.background_bitmap
    @background_sprite.color.set(16, 16, 16, 128)
  end
  #--------------------------------------------------------------------------
  # * Free Background
  #--------------------------------------------------------------------------
  def dispose_background
    @background_sprite.dispose
  end
 
	def create_test
	@s = Sprite.new()
	@s.bitmap = Bitmap.new(Graphics.width,Graphics.height)
	@s.bitmap.font.size = MY_SCRYPT::FONT_SIZE
	@s.bitmap.draw_text(0,(Graphics.height/2)-100,Graphics.width,100,MY_SCRYPT::TEXT,1)
	end
 
	def update_test
	@s.update
	end
 
	def dispose_test
	@s.dispose
	end
 
end
end

Save implementation to .txt file and crypt it with special utility -> we got .xs binary file. (It is optionally)
 
Using ScriptLoader and final result is: (very short and simple)

module MY_SCRYPT
  FONT_SIZE = 62 
  TEXT = "ScriptLoader"
end
ScriptLoader.loadX("file name with implementation");

 

 

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted