Rewriting Script
Version: 1.0
Introduction
This script offers scripters a new alternative for editing scripts, where they cannot alias methods. With this script you can edit part of scripts without rewriting a whole part (e.g. a method). You can either delete lines add new lines or replace lines of a script.
How does this script work?
This script is quite simple to use. You just have to add some lines of code somewhere in a section. The code has to be structured like that:
(Below you can find an example for easier understanding..)
Methods I can use with this script
Rewriting::delete_lines(section, lines, appearance) (deletes lines in a script)
section: the section in which the code is deleted (can be an Integer or a String)
lines: the lines which are deleted (can be an Integer, a Range, a String or an Array containing some of the other possibilities)
appearance: if section is a String this is used when the section is found more than once (has to be an Integer)
Rewriting::write_lines(section, line, appearance, code = "\r") (adds new lines to a script)
section: the section in which the code is added (can be an Integer or a String)
line: the line in which the code is added (does not replace lines! Integer)
appearance: if section is a String this is used when the section is found more than once (has to be an Integer)
code: the code which is added
Rewriting::replace_lines(section, lines, appearance, code = "\r") (replaces lines in a script)
section: the section in which the code is added (can be an Integer or a String)
lines: the replaced lines (can be an Integer, a Range, a String or an Array containing some of the other possibilities)
appearance: if section is a String this is used when the section is found more than once (has to be an Integer)
code: the code which is added
Example
Demo
you can find the script here:
*klick* (just klick on "Scripts")
Instructions
Just put the script above all other methods (so at the top of the list!) and use the methods shown above.
Compatibility
I think it should be compatible with all other scripts.. But you have to keep in mind, that bugfinding in parts which have been edited with this script will get difficult.. and of course you should not edit the code edited with this script anymore..
Author's Notes
Well.. I hope somebody needs this script.. ^^
I got the idea for this when I tried to alias a method where I only had to replace a single line.. of course this is not possible with aliasing.. but with this script.. (;
if you find any bugs, things to improve, etc. just post here.. ^^
Version: 1.0
Introduction
This script offers scripters a new alternative for editing scripts, where they cannot alias methods. With this script you can edit part of scripts without rewriting a whole part (e.g. a method). You can either delete lines add new lines or replace lines of a script.
How does this script work?
This script is quite simple to use. You just have to add some lines of code somewhere in a section. The code has to be structured like that:
#=# Rewriting Start #=#
[i]method you want to call (see below, the code is written below)[/i]
#=# code #=#
[i]the new code (when deleting this part isnt needed)[/i]
#=# Rewriting End #=#
[i]method you want to call (see below, the code is written below)[/i]
#=# code #=#
[i]the new code (when deleting this part isnt needed)[/i]
#=# Rewriting End #=#
Expand to see the code.
(Below you can find an example for easier understanding..)
Methods I can use with this script
Rewriting::delete_lines(section, lines, appearance) (deletes lines in a script)
section: the section in which the code is deleted (can be an Integer or a String)
lines: the lines which are deleted (can be an Integer, a Range, a String or an Array containing some of the other possibilities)
appearance: if section is a String this is used when the section is found more than once (has to be an Integer)
Rewriting::write_lines(section, line, appearance, code = "\r") (adds new lines to a script)
section: the section in which the code is added (can be an Integer or a String)
line: the line in which the code is added (does not replace lines! Integer)
appearance: if section is a String this is used when the section is found more than once (has to be an Integer)
code: the code which is added
Rewriting::replace_lines(section, lines, appearance, code = "\r") (replaces lines in a script)
section: the section in which the code is added (can be an Integer or a String)
lines: the replaced lines (can be an Integer, a Range, a String or an Array containing some of the other possibilities)
appearance: if section is a String this is used when the section is found more than once (has to be an Integer)
code: the code which is added
Example
#=# Rewriting Start #=#
Rewriting::delete_lines('Game_Character 3', 37..53, 1)
#=# Rewriting End #=#
#=# Rewriting Start #=#
Rewriting::write_lines('Game_Character 3', 37, 1)
#=# code #=#
p 'move_left has been deleted!'
#=# Rewriting End #=#
#=# Rewriting Start #=#
Rewriting::replace_lines('Game_Character 3', 23, 1)
#=# code #=#
@y += 2
p 'move_down has been edited!'
#=# Rewriting End #=#
Rewriting::delete_lines('Game_Character 3', 37..53, 1)
#=# Rewriting End #=#
#=# Rewriting Start #=#
Rewriting::write_lines('Game_Character 3', 37, 1)
#=# code #=#
p 'move_left has been deleted!'
#=# Rewriting End #=#
#=# Rewriting Start #=#
Rewriting::replace_lines('Game_Character 3', 23, 1)
#=# code #=#
@y += 2
p 'move_down has been edited!'
#=# Rewriting End #=#
Expand to see the code.
Demo
you can find the script here:
*klick* (just klick on "Scripts")
Instructions
Just put the script above all other methods (so at the top of the list!) and use the methods shown above.
Compatibility
I think it should be compatible with all other scripts.. But you have to keep in mind, that bugfinding in parts which have been edited with this script will get difficult.. and of course you should not edit the code edited with this script anymore..
Author's Notes
Well.. I hope somebody needs this script.. ^^
I got the idea for this when I tried to alias a method where I only had to replace a single line.. of course this is not possible with aliasing.. but with this script.. (;
if you find any bugs, things to improve, etc. just post here.. ^^