Some people get confused of the SDK. Its not some monster thats trying to eat your scripts, no, its more like an angel that makes it esier for you to make compatible scripts.
The SDK Module also has some usefull things like Auto-Writing credits, event reading and turning off/on scripts.
In this tutorial I will try to explain how to use the SDK, how converte scripts and how to custimize the SDK to your needs. It won't be easy for me to explain since SDK is pretty much self-explonatory so cirticsm is ok and expected
.
What is SDK?SDK can be broken in to two parts;
- SDK Module - Makes some diffucult commands easy to use.
- SDK Script Overwrite - It rewrites some scripts in the database to increase compability and performance, if used the right way.
Mostly people have compatiblity issues with the SDK script overwrite. Why?
Like I said before it overwrites some commands in the script database.
Here is a list of commands that are rewritten in the SDK;
Game_Map - setup
Game_Map - update
Game_Character - update
Game_Event - refresh
Game_Player - update
Sprite_Battler - update
Spriteset_Map - initialize
Spriteset_Map - update
Scene_Tile - main
Scene_Map - main
Scene_Map - update
Scene_Save - write_save_data
Scene_Load - read_save_data
Scene_Menu - initialize
Scene_Menu - main
Scene_Menu - update & command input
Scene_Battle - main
Scene_Battle - update
Scene_Battle - update_phase3_basic_command
Scene_Battle - make_basic_action_result
Before we contuniue, read a tutorial on Alias;
http://www.hbgames.org/forums/showthread.php?t=5698Thats what the SDK is for
Using the SDKWhen you are making a script, you often need to refer to RMXPs default classes. The most refered default classes are;
Game_Player
Game_Character
Scene_Map
The most overwritten classes are;
Scene_Battle
Scene_Map
Game_Character
Scene_Menu
Every time you overwrite a class, you decrease the chance of compability with other scripts, not only the SDK
.
Thats where SDK comes in to help. SDK Script Overwrite part of the SKD breaks methods(functions or defs) in to sections and parts. Lets observe Scene_Map for a sec;
This is method main in Scene_Map(non-sdk);
#--------------------------------------------------------------------------
def main
# Make command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Save"
s6 = "End Game"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(4)
end
# Make play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 224
# Make steps window
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = 320
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@status_window.dispose
end
Do you see that big mess??Now this is the SDK version;
def main
main_draw
# Main loop
loop [do
main_loop
break if main_scenechange?
end
main_dispose
main_tiletrigger
end
Now do you see the
difference? The SDK just broke it into smaller parts, this increases compability. Because now you can
alias esier. No need to overwrite anything.
Lets say you want to make a hud;
Firs you look at what you need to edit.
A hud is made of a cauple of windows and it appears on the map. So we need to use Scene_Map.
Usually you would need to edit Scene_Map directly. But with the SDK you don't need to. Lets say we already have the window for the hud called @hud_window.
Usually you want to do 3 things with a window;
Call
Update
Dispose
In the SDK, go to Scene_Map > def main, you see cauple of method calls;
- main_draw - Used to call the windows.
- main_dispose - Used to dipose windows.
Now, still in the SDK, go to Scene_Map > def update, there is one method we can use there;
- update_graphics - updates the windows and sprites
If you know how to alias then you know whats coming next. Now all you need to do is aliase with those controls. No need to over write anything.
In this lesson we learned to think of what need before we code, and how SDK can help us increase compability and why and how it does that.
How to Converte Scripts;To converte scripts we use the same method as before. Converting long scripts can be a pain, so that why you need notepad to help you make a list.
What list you ask?
As we said before the SDK replaces most methods and thats why it incompatible with other scripts, because scripts are usuall poor coded(no offense to anyone).
In the script you are looking to converte, see if it refers to any method or classes that is in the SDK and add it to your list.
After that go to the SDK and see what methods you can use to improve compability and convert the script.
For example, we are trying to converte an Hud script;
Look at the hud script, and lets say it is overwriting Scene_Map > Main. Now go to the other Default Scene_Map and compare the 2. By comparing you should be able to tell whats new and whats not.
Cut everything new in the method and paste it to an empty script. Now we look at the code. What does it have?(in this case, same as the Hud from the previous tutorial)
It calls the window and it disposes it.
What are the methods in the SDK you can aliase with to do this?
Thats right;
Now just aliase with them in the script you are converting. Its that simple.
I hope that helped.
Thats is. I hope that helped. Can't say i didn't try ;)