Go Back   The PokéCommunity Forums > ROM Hacking > Tools, Tutorials & Resources
Reload this Page [Scripting] Percy's Scripting Guide

Notices
For all updates, view the main page.

Tools, Tutorials & Resources Various tools to help you develop your hacks can be found here.
New threads in this forum are to be approved by a moderator before they are displayed.



Reply
 
Thread Tools
  #1    
Old January 30th, 2015 (01:38 AM). Edited February 21st, 2015 by Percy.
Percy's Avatar
Percy Percy is online now
Sceptile ftw
 
Join Date: Sep 2014
Location: Somewhere in the world, obviously
Age: 18
Gender: Male
Nature: Gentle
Posts: 1,462
Hey, there! I'm Percy, and I'm about to teach you scripting. Let's move on since I'm bad at introducing myself.
I'm pretty sure you already know the meaning of scripting, right? Well, then, soon-to-be-scripters. Let's start learning scripting!

Tools You're Gonna Need:

XSE
Advance Map 1.9.2

I think you can find the download links here: http://www.pokecommunity.com/showthread.php?t=341758

Be sure to get the 1.92 version of Advance Map.
Oh, yeah, you need FSF (Free Space Finder): https://www.dropbox.com/s/kni6u0mp2nxvs6z/Free%20Space%20Finder.zip?dl=0

It will find free space for you.

Lesson 1:
Basic Scripting

Code:
#dynamic 0x(free space offset)

#org @pointer
lock
faceplayer
msgbox @hello 0x6
release
end

#org @hello
= Hello to you!
Let me explain line by line.
#dynamic 0x(free space offset)
With #dynamic, you simply state a start offset, say 0x800000, and XSE will automatically insert it in the first suitable instance of free space past that offset. (Said by Spherical Ice) And, in order to have an offset, open FSF, and open your ROM with it. Click Search and you'll gonna have an offset that is safe to use, whatsoever.

#org @pointer
This part is the pointer. It can be anything:
@iamcool etc.
Just remember not to duplicate any pointers, and don't include spaces, too!

lock
Easy, it locks the player, so it can't move and such.

msgbox @hello 0x6
If you want a message box to appear use the msgbox command. The @hello part is where we'll gonna store our text. The 0x6 part decides what message box it will show. There are 5 kinds of message box:

Spoiler: 5 kinds of message box
0x2 - If you use this kind of message box, you don't need lock, faceplayer, release.

0x3 - For the sign posts. Like the 0x2 you don't need lock, faceplayer, and release.

0x4 - A normal message box, you can use lock, faceplayer, and release in this. Its like 0x6 but this doesn't close. Just stick closeonkeypress on your script when you use the 0x4 message box, and the message box will close.

0x5 - The Yes/No message box. Its kind of complicated to explain how this works right now, so maybe in Lesson 2 or something.

0x6 - Normal message box. You can use the lock, faceplayer, and release commands.


Now, back to explaining:

release
It releases the player from the lock command so that you can move again.

end
It ends the script. You must include this in every script you make.

#org @hello
Pointer to your text.

= Hello to you!
Ta-da! This is the text. In your XSE, press CTRL + T. It opens up the Text adjuster so you don't need to add the \n, \l, or \p. If \n is used, the message box scrolls up, same as the \l, but you may only use \l if you have used \n. \p is for new textbox. Now make your own basic scri

Lesson 2
Yes/No Messages

This is the second part of scripting I learned, and when you learn it, you're gonna have fun with it. Anyway, let's start.
Code:
#dynamic 0x800000

#org @start
lock
faceplayer
msgbox @1 0x5
compare LASTRESULT 0x1
if 0x1 goto @2
msgbox @3 0x6
release
end

#org @1
= I am handsome?

#org @3
= No? What the [.]

#org @2
msgbox @4 0x6
release
end

#org @4
= Yes!
There! If you don't understand some of the old commands we've done last lesson, just scroll up, and you'll see.
Let's start explainin'

msgbox @1 0x5
Remember what 0x5 are for? Yes, for Yes/No message boxes. The message box is accompanied with one command ...

compare LASTRESULT 0x1
Get's the lastresult and the 0x1 beside it means yes. (said by tajaros)

if 0x1 goto @2
If you pressed yes, it will goto @2
If you pressed no, it will ignore this part, and continue to @3.
There!
Start making Yes/No scripts!

Spoiler:
How to insert script


First, do your script


(Its made in XSE, I just don't want to reveal my name
And, hit compile.
Here's what the icon looks like:
And, then open up XSE, and focus on the NPC you want to put the script into


Put your script offset you just copied here


(Find the red circle)
Copy and paste of course:
(if you're using A-map 1.92, paste it all over)
Spoiler:


Try it out in-game!


If you have some trouble please post it here!

-Percy
Contact me if you have trouble with this tutorial, or just post it here.


PS: I'm gonna post lesson 3 soon enough!
__________________
Pokémon Ranger Academy
Status: Coming Soon ...
Blaziken is no longer my favorite Pokémon
Credit

Pair

Reply With Quote
  #2    
Old January 30th, 2015 (09:12 AM).
Spherical Ice's Avatar
Spherical Ice Spherical Ice is offline
Moderator
CS
 
Join Date: Nov 2007
Location: UK
Posts: 3,417
Send a message via Skype™ to Spherical Ice
Quote originally posted by Percy:
#dynamic 0x(free space offset)
This part asks for what free space we'll use. This is the part where our script is contained. And, in order to have an offset, open FSF, and open your ROM with it. Click Search and you'll gonna have an offset that is safe to use, whatsoever.
That isn't how the #dynamic operative works, you're thinking of #org 0x8(offset). With #dynamic, you simply state a start offset, say 0x800000, and XSE will automatically insert it in the first suitable instance of free space past that offset.
__________________
Reply With Quote
  #3    
Old January 30th, 2015 (02:20 PM).
Percy's Avatar
Percy Percy is online now
Sceptile ftw
 
Join Date: Sep 2014
Location: Somewhere in the world, obviously
Age: 18
Gender: Male
Nature: Gentle
Posts: 1,462
Quote originally posted by Spherical Ice:
That isn't how the #dynamic operative works, you're thinking of #org 0x8(offset). With #dynamic, you simply state a start offset, say 0x800000, and XSE will automatically insert it in the first suitable instance of free space past that offset.
Haha, sorry. And, thanks, I'll edit the first post.
__________________
Pokémon Ranger Academy
Status: Coming Soon ...
Blaziken is no longer my favorite Pokémon
Credit

Pair

Reply With Quote
  #4    
Old February 1st, 2015 (05:37 PM).
Cayo's Avatar
Cayo Cayo is offline
 
Join Date: Jan 2015
Location: USA
Age: 13
Gender: Male
Nature: Brave
Posts: 212
When you were explaining the #org @pointer you said that anything can be the pointer and you put #iamcool. I understand that you probably meant @iamcool but that would probably confuse somebody new to scripting.
__________________
Check out this cool MMORPG. It's pretty new, but still fun! Hurry! Or the Rattata will get you![/CENTER]

Proud Member of Team Orb
Reply With Quote
  #5    
Old February 3rd, 2015 (03:51 AM).
Percy's Avatar
Percy Percy is online now
Sceptile ftw
 
Join Date: Sep 2014
Location: Somewhere in the world, obviously
Age: 18
Gender: Male
Nature: Gentle
Posts: 1,462
Lesson 3 is posted, everyone!
__________________
Pokémon Ranger Academy
Status: Coming Soon ...
Blaziken is no longer my favorite Pokémon
Credit

Pair

Reply With Quote
  #6    
Old February 3rd, 2015 (08:08 AM).
tzujm33 tzujm33 is offline
 
Join Date: Jul 2014
Posts: 75
Could you add how to edit inserted scripts in the fastest way? for example if i compile a scipt and then found out i forgot something, how to edit it the fastest way?
Reply With Quote
  #7    
Old February 3rd, 2015 (03:24 PM).
Percy's Avatar
Percy Percy is online now
Sceptile ftw
 
Join Date: Sep 2014
Location: Somewhere in the world, obviously
Age: 18
Gender: Male
Nature: Gentle
Posts: 1,462
Quote originally posted by tzujm33:
Could you add how to edit inserted scripts in the fastest way? for example if i compile a scipt and then found out i forgot something, how to edit it the fastest way?
Well, then edit the compiled script, and then hit the compile button, that should do it.
__________________
Pokémon Ranger Academy
Status: Coming Soon ...
Blaziken is no longer my favorite Pokémon
Credit

Pair

Reply With Quote
  #8    
Old February 3rd, 2015 (05:03 PM).
joexv's Avatar
joexv joexv is offline
The True XV
Silver Tier
 
Join Date: Oct 2012
Location: Oregon
Age: 17
Gender: Male
Nature: Quiet
Posts: 619
Send a message via Skype™ to joexv
Quote originally posted by Percy:
Well, then edit the compiled script, and then hit the compile button, that should do it.
Yea but that could overwrite something. If you add a dynamic offset to the script hunk you are editing then doing the same to anything that points to the script so that all of your pointers are fixed. Something along the lines of this:
Spoiler:
Code:
#org 0x123456
lock
applymovement 0x3 0x987654
msgbox 0x654321 0x6
release
end

#org 0x654321
= hi

#org 0x987654
#raw 0x2
#raw 0x3
#raw 0xfe


To this:
Spoiler:
Code:
#dynamic 0x800000
#org @edits
lock
applymovement 0x3 0x987654
waitmovement 0x0
msgbox 0x654321 0x6
release
end

#org 0x654321
= hi

#org 0x987654
#raw 0x2
#raw 0x3
#raw 0xfe
__________________
Jesus Christ is my Savior
Bros with Percy
My Rom hacks
Blackened Night
Holiday Hacks


Hacks I support:
Resolute Version
Victory Fire
Pokemon Yellow Chapter
Fluorite
Hybrid

Find me @
Poketch
Thepokemonnation
Instagram(Personal)
Instagram(Rom hack)
Snapchat @j03xv
Skype @Chao5cow
Reply With Quote
  #9    
Old February 7th, 2015 (03:32 AM).
Percy's Avatar
Percy Percy is online now
Sceptile ftw
 
Join Date: Sep 2014
Location: Somewhere in the world, obviously
Age: 18
Gender: Male
Nature: Gentle
Posts: 1,462
I added my own custom tutorial on how to put scripts into ROM. Here: http://www.pokecommunity.com/showthread.php?t=343282#compilescript
__________________
Pokémon Ranger Academy
Status: Coming Soon ...
Blaziken is no longer my favorite Pokémon
Credit

Pair

Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are UTC -8. The time now is 12:17 AM.