The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Other How much free space do i need for a script?

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old January 16th, 2015 (5:53 PM). Edited March 27th, 2015 by Sefuree.
Sefuree's Avatar
Sefuree Sefuree is offline
Canada Goose
 
Join Date: May 2014
Location: Canada
Age: 22
Gender: Male
Nature: Adamant
Posts: 3,183
How much free space do i need for a script?

Examples:

- sign post
- Give pokemon
- Normal npc
- wild battle
- choose starter script

Help???
__________________

:)
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old January 16th, 2015 (6:06 PM). Edited January 16th, 2015 by DrFuji.
DrFuji's Avatar
DrFuji DrFuji is offline
Heiki Hecchara‌‌
 
Join Date: Sep 2009
Location: Aussie
Age: 30
Gender: Male
Nature: Jolly
Posts: 1,693
Well there's no real constant for how much space an average script will take up. Depending on the length of text and what you want your event to do it can vary quite a lot. For example, the following script takes up 15 bytes:

Spoiler:
#dynamic 0x800000

#org @start
msgbox @talk 0x2
release
end

#org @talk
= Hello


Ten of those bytes are taken up by the three commands and their parameters while the other five bytes are accounted for by the five letters used in the @talk pointer. Even extending the text by a few words can double or triple its length so there is no way you can talk about an 'average script length'. If you look at each command in XSE command guide it will tell you how many bytes each command will take so if you really want to count their lengths, just add up each command's size and then the length of any text you've added.

Scripts take up very little space in the ROM (they're absolutely tiny when compared to graphics) so there's no need to be concerned about how much free space you need, particularly if you use a dynamic offset like I have done.

edit: my math is dumb i suck
__________________
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old January 16th, 2015 (6:11 PM).
Sefuree's Avatar
Sefuree Sefuree is offline
Canada Goose
 
Join Date: May 2014
Location: Canada
Age: 22
Gender: Male
Nature: Adamant
Posts: 3,183
Quote:
Originally Posted by DrFuji View Post
Well there's no real constant for how much space an average script will take up. Depending on the length of text and what you want your event to do it can vary quite a lot. For example, the following script takes up 10 bytes:

Spoiler:
#dynamic 0x800000

#org @start
msgbox @talk 0x2
release
end

#org @talk
= Hello


5 of those bytes are 10 bytes are taken up by the three commands and their parameters while the other five bytes are accounted for by the five letters used in the @talk pointer. Even extending the text by a few words can double or triple its length so there is no way you can talk about an 'average script length'. If you look at each command in XSE command guide it will tell you how many bytes each command will take so if you really want to count their lengths, just add up each command's size and then the length of any text you've added.

Scripts take up very little space in the ROM (they're absolutely tiny when compared to graphics) so there's no need to be concerned about how much free space you need, particularly if you use a dynamic offset like I have done.
ok, thanks alot for your help!
__________________

:)
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old January 19th, 2015 (2:34 PM).
miksy91's Avatar
miksy91 miksy91 is offline
Dark Energy is back in action! ;)
 
Join Date: Oct 2008
Location: Finland
Gender: Male
Posts: 1,480
Adding to everything DrFuji already said here, since there are less than 256 scripting commands in the scripting system, all of them take exactly one byte. So therefor "release", "end", "msgbox" and other commands are compiled as single bytes in the rom.
@talk in DrFuji's example is a pointer. GBA pointers are 4 bytes long.
And other parameters like 0x2 there are of course one byte long because the script editor will compile that 0x2 as byte "02". Then again, for example value 0x4A32 would be compiled as 4A 32 (or 32 4A) and that would take 2 bytes.

It's pretty self-explanotary really.
__________________
Pokémon Dark Energy
Some ROM hacking related stuff
Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old January 19th, 2015 (4:47 PM).
Sefuree's Avatar
Sefuree Sefuree is offline
Canada Goose
 
Join Date: May 2014
Location: Canada
Age: 22
Gender: Male
Nature: Adamant
Posts: 3,183
Quote:
Originally Posted by miksy91 View Post
Adding to everything DrFuji already said here, since there are less than 256 scripting commands in the scripting system, all of them take exactly one byte. So therefor "release", "end", "msgbox" and other commands are compiled as single bytes in the rom.
@talk in DrFuji's example is a pointer. GBA pointers are 4 bytes long.
And other parameters like 0x2 there are of course one byte long because the script editor will compile that 0x2 as byte "02". Then again, for example value 0x4A32 would be compiled as 4A 32 (or 32 4A) and that would take 2 bytes.

It's pretty self-explanotary really.
Ok, thanks!
This really helped!
__________________

:)
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content

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 GMT -8. The time now is 9:10 AM.