Go Back   The PokéCommunity Forums > ROM Hacking > Tools, Tutorials & Resources

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
Click here to go to the first staff post in this thread.  
Thread Tools
  #26    
Old November 9th, 2013 (06:07 AM).
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote originally posted by mf91:
Thanks for reply

I have had some basic Java and C++, so I know what a variable is.. Very basic tough! But yeah, I think I get it now! Just to be 100% sure, you could say setvar 0x4050 0x1 would be int 4050 = 1 basically? And everything from 0x0000 to 0xFFFF are variables the game can use?

I guess what made me a bit confused is the random use of 1 and 4 numbers as the value, which probably is very common in languages I havent used yet. What is the value set to; 0x0001 or 0x1000?
On the first part, you are right. That is how it works.

Second, did you even read the Vars section of this tutorial? I clearly outlined what variables could be used.

The 1s and 4s aren't random, the vars are incremented over events. Normally, GF only uses a var 4 times, so the first time it is used, it is set to 1, then events take place and eventually it ends up being set to 4 and stays there.

The value will be set to 0x0001, but if you look at it in the ram, it will be 0100. This is only for storage purposes. Whenever you access it, it will automatically be loaded at 0x0001.

------
In case you wanted to know, GBA roms are written in C.
__________________

Paired with Simba
Reply With Quote
  #27    
Old November 9th, 2013 (09:40 AM).
mf91
 
Join Date: Sep 2013
Quote originally posted by karatekid552:
On the first part, you are right. That is how it works.

Second, did you even read the Vars section of this tutorial? I clearly outlined what variables could be used.

The 1s and 4s aren't random, the vars are incremented over events. Normally, GF only uses a var 4 times, so the first time it is used, it is set to 1, then events take place and eventually it ends up being set to 4 and stays there.

The value will be set to 0x0001, but if you look at it in the ram, it will be 0100. This is only for storage purposes. Whenever you access it, it will automatically be loaded at 0x0001.

------
In case you wanted to know, GBA roms are written in C.
Allright, Im futher into this stuff now Might aswell look some into C! Thanks a bunch for your help

PS: I ment what variables the game have access to, not which I can use.. But its obvious now anyways
Reply With Quote
  #28    
Old November 9th, 2013 (02:32 PM).
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote originally posted by mf91:
Allright, Im futher into this stuff now Might aswell look some into C! Thanks a bunch for your help

PS: I ment what variables the game have access to, not which I can use.. But its obvious now anyways
Oh, okay. In that case, anything over 0x3FFF will be read as a variable by the game. Anything below is read as a static number. This is how script commands are able to use both variables and static numbers without changing syntax.
__________________

Paired with Simba
Reply With Quote
  #29    
Old November 24th, 2013 (10:32 AM).
Le pug's Avatar
Le pug
Creator of Pokémon: Discovery
Community Supporter
 
Join Date: Aug 2013
Location: Le bed
Age: 22
Gender: Male
Nature: Bold
uh ive been told many times anything from 900 to like 1F00 or something are safe flags and using them ive had no problem so why are you saying theyre not safe?
__________________



Check out some of my contributions:
• Check out my easy tile insertion tutorial, Inserting Tiles Into AdvanceMap For Dummies
Click here to find out how to remove clouds from the Emerald titlescreen
• Check out the most updated Emereld Decapitalization Patch around by clicking here
• Need help fixing a gross bug in your hack? Let me show you how by clicking here



Click here to view the PC thread of Pokémon: Discovery.
Click here to view the PC thread of Pokémon: Fat Kid.

Pokétch ROM Hacking Community Discovery Twitter Discovery FB IRC Chat
Reply With Quote
  #30    
Old November 24th, 2013 (03:20 PM).
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote originally posted by Le pug:
uh ive been told many times anything from 900 to like 1F00 or something are safe flags and using them ive had no problem so why are you saying theyre not safe?
Because I have physically seen the RAM corruption that using them causes. To prove this point, I want you to run this script:

Code:
#Dynamic 0x800000
#org @start
setvar 0x4000 0x0
compare 0x4000 0x0
if 0x1 jump @safe
setflag 0x900
compare 0x4000 0x0
if 0x1 jump @safe
end

#org @safe
msgbox @safe_msg 0x3
return

#org @safe_msg
= var 0x4000 is safe

#org @corrupted
msgbox @corrupted_msg 0x3
return

#org @corrupted_msg
= var 0x4000 has been corrupted
You will notice that the safe message only plays before flag 0x900 has been set. It does not run twice. This is because flags 0x900->0x90F exist in the RAM that holds var 0x4000. The RAM overlaps, because in Assembly, unlike high-level languages, there is no concept of Scope. Scripting is calling certain assembly functions and passing them parameters. Because there is no scope, you can pass them anything. Doesn't mean it is good.
__________________

Paired with Simba
Reply With Quote
  #31    
Old November 24th, 2013 (03:29 PM).
RichterSnipes's Avatar
RichterSnipes
Simpleton
 
Join Date: Oct 2011
Location: USA
Age: 21
Gender: Male
Nature: Modest
Is there any indicator on what flag values in the 300s are used for, if anything? When I was testing flag values for a completed save file a couple of weeks ago, all the values I used in the 300s (which I think was the vast majority of them) were cleared in the game. Are they only set in specific circumstances then cleared right afterwards (like in certain screens), or is there something else about them?

Great thread, BTW. Anyone working on hacks nowadays should be wary of what specific flag values they add to the game.
__________________


Who says hacks have to radically changes things up from their base games?
Red doesn't necessarily think so. He's literally spinning in circles thinking of a "definitive" version of his adventure in Kanto!
Want to see what he has in mind? Click him for a throwback worth experiencing!
Reply With Quote
  #32    
Old November 24th, 2013 (03:59 PM).
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote originally posted by RichterSnipes:
Is there any indicator on what flag values in the 300s are used for, if anything? When I was testing flag values for a completed save file a couple of weeks ago, all the values I used in the 300s (which I think was the vast majority of them) were cleared in the game. Are they only set in specific circumstances then cleared right afterwards (like in certain screens), or is there something else about them?

Great thread, BTW. Anyone working on hacks nowadays should be wary of what specific flag values they add to the game.
I honestly don't know about those flags. Why not try and set them, then see if they get cleared on warp? My best guess is that they are temporary.
__________________

Paired with Simba
Reply With Quote
  #33    
Old November 25th, 2013 (12:18 PM).
RichterSnipes's Avatar
RichterSnipes
Simpleton
 
Join Date: Oct 2011
Location: USA
Age: 21
Gender: Male
Nature: Modest
Quote originally posted by karatekid552:
I honestly don't know about those flags. Why not try and set them, then see if they get cleared on warp? My best guess is that they are temporary.
Okay, so I was actually crazy enough to test this out as thorough as I could.

I set several flags with various values in the 300s in my hack (in this case, through starting/ending events I put in the game). I then tested them immediately afterwards to make sure they stay set. The only things keeping them set are the scripts themselves; there are no map scripts that keep them that way. I then proceeded to access every warp easily available in the game. Every map, every building, every cave, every teleporter...everything. I even beat the Pokémon League just to make extra sure. I also flew to each place in the game. Upon checking back at my events, the flags remained set.

So, unless by pure coincidence every last one of those flags in the 300s that I set are cleared by warps on the S.S. Anne, I can say within reason that the flags in the 300s are not cleared when warping.
__________________


Who says hacks have to radically changes things up from their base games?
Red doesn't necessarily think so. He's literally spinning in circles thinking of a "definitive" version of his adventure in Kanto!
Want to see what he has in mind? Click him for a throwback worth experiencing!
Reply With Quote
  #34    
Old November 25th, 2013 (01:47 PM).
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote originally posted by RichterSnipes:
Okay, so I was actually crazy enough to test this out as thorough as I could.

I set several flags with various values in the 300s in my hack (in this case, through starting/ending events I put in the game). I then tested them immediately afterwards to make sure they stay set. The only things keeping them set are the scripts themselves; there are no map scripts that keep them that way. I then proceeded to access every warp easily available in the game. Every map, every building, every cave, every teleporter...everything. I even beat the Pokémon League just to make extra sure. I also flew to each place in the game. Upon checking back at my events, the flags remained set.

So, unless by pure coincidence every last one of those flags in the 300s that I set are cleared by warps on the S.S. Anne, I can say within reason that the flags in the 300s are not cleared when warping.
You went a little overkill.:p Most warps work the same. Now, you just need to make sure nothing else uses that area of RAM. There is a reason GF doesn't use those flags. (hopefully, the compiler just skipped those.:p) Now, clear them all, and periodically check if they are set.
__________________

Paired with Simba
Reply With Quote
  #35    
Old November 25th, 2013 (03:01 PM).
RichterSnipes's Avatar
RichterSnipes
Simpleton
 
Join Date: Oct 2011
Location: USA
Age: 21
Gender: Male
Nature: Modest
Quote originally posted by karatekid552:
You went a little overkill.:p Most warps work the same. Now, you just need to make sure nothing else uses that area of RAM. There is a reason GF doesn't use those flags. (hopefully, the compiler just skipped those.:p) Now, clear them all, and periodically check if they are set.
Whoops. Which area of RAM would I be looking at for those flags?
__________________


Who says hacks have to radically changes things up from their base games?
Red doesn't necessarily think so. He's literally spinning in circles thinking of a "definitive" version of his adventure in Kanto!
Want to see what he has in mind? Click him for a throwback worth experiencing!
Reply With Quote
  #36    
Old December 20th, 2013 (01:26 PM).
haven1433
Modder / Programmer
 
Join Date: Oct 2013
Gender: Male
Very detailed stuff! I'm working on a hack, and was very confused as to how to figure out which flags were used and which are available. You answered all that, so thanks!
Reply With Quote
  #37    
Old January 1st, 2014 (03:20 PM).
HidoranBlaze's Avatar
HidoranBlaze
 
Join Date: Apr 2013
Age: 18
Gender: Male
Hey karatekid552 I have a question.
I was looking through Prof Oak's scripts in Pallet Town (The scripts where he brings you to his lab and gives you pokemon).
And I noticed flags like 0x2CF and 0x247, which were listed as unknown on your list.
And somewhere in the comments, you said this.
Quote originally posted by karatekid552:
The unknown, is just that, unknown. There are quite a bit of things like this in the coding and are often called fillers or constants and they don't do anything other than separate data.
So does that mean that I could possibly skip those flags if I wanted to re-create Oak's script?
Reply With Quote
  #38    
Old January 1st, 2014 (03:22 PM).
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote originally posted by pikapoke33:
Hey karatekid552 I have a question.
I was looking through Prof Oak's scripts in Pallet Town (The scripts where he brings you to his lab and gives you pokemon).
And I noticed flags like 0x2CF and 0x247, which were listed as unknown on your list.
And somewhere in the comments, you said this.

So does that mean that I could possibly skip those flags if I wanted to re-create Oak's script?
Lol, that quote is referencing the unknown bytes in script tile making, not vars or flags.

Either way, if you are re-scripting the entire game, you pick the flags and vars, so it doesn't matter what GF's compiler used. The only flags that matter are those in the 800s, since those control the necessary in game stuff.
__________________

Paired with Simba
Reply With Quote
  #39    
Old January 1st, 2014 (03:34 PM).
HidoranBlaze's Avatar
HidoranBlaze
 
Join Date: Apr 2013
Age: 18
Gender: Male
Quote originally posted by karatekid552:
Lol, that quote is referencing the unknown bytes in script tile making, not vars or flags.
Either way, if you are re-scripting the entire game, you pick the flags and vars, so it doesn't matter what GF's compiler used. The only flags that matter are those in the 800s, since those control the necessary in game stuff.
Oh ok I see.
I'm trying to recreate some of the game's scripts as practice, since I'm still fairly new to scripting.
Reply With Quote
  #40    
Old February 22nd, 2014 (05:03 PM).
M0ZEPH's Avatar
M0ZEPH
Formally 'Resultz' - Returned!
 
Join Date: Feb 2014
Gender: Male
You say only these vars x-y are safe, yet you say they can be any value upto 65000, does that mean every other one is used, or am I missing something major here?
__________________
CURRENTLY LOOKING FOR HELP WITH MY ROMHACK! HELPERS WILL BE GIVEN JOINT CREDIT

PLEASE PM ME FOR INFO!
Reply With Quote
  #41    
Old February 22nd, 2014 (07:09 PM).
HidoranBlaze's Avatar
HidoranBlaze
 
Join Date: Apr 2013
Age: 18
Gender: Male
Quote originally posted by M0ZEPH:
You say only these vars x-y are safe, yet you say they can be any value upto 65000, does that mean every other one is used, or am I missing something major here?
You are missing something lol. You have to distinguish between the var itself and the var value. What happens with a variable is that you assign a value to the variable itself. Think of it like algebra where you say x or y is equal to 1 or something like that. You can assign a value up to 0xFFFF, which is why there can be 65000 values for a variable. But you have limits on the variables themselves. Some are safe, some are not.
Reply With Quote
  #42    
Old February 22nd, 2014 (08:47 PM).
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Yes, that is what I mean.

Let me explain it slightly differently using a rice and cup analogy: each var is a cup. That cup is pretty big as it can hold ~65000 pieces of rice (0xFFFF, 2 bytes). Now, just because it can hold that many pieces, doesn't mean it has to. The cup could be empty, it could have just 2 pieces of rice, or it could have 30,000. It all depends on how many you put in it. Vars are like that cup of rice, each one can hold a number between 0x0 and 0xFFFF (~65,000 or 256*256). So when you use set var, you are filling the cup with that number after first dumping it out. If you use addvar and subvar, you will be adding that much rice to the cup or taking away that much rice, respectively.

More clear?
__________________

Paired with Simba
Reply With Quote
  #43    
Old April 9th, 2014 (10:31 AM).
Ethanb900
 
Join Date: Mar 2014
Gender: Male
Quote originally posted by karatekid552:
Yes, that is what I mean.

Let me explain it slightly differently using a rice and cup analogy: each var is a cup. That cup is pretty big as it can hold ~65000 pieces of rice (0xFFFF, 2 bytes). Now, just because it can hold that many pieces, doesn't mean it has to. The cup could be empty, it could have just 2 pieces of rice, or it could have 30,000. It all depends on how many you put in it. Vars are like that cup of rice, each one can hold a number between 0x0 and 0xFFFF (~65,000 or 256*256). So when you use set var, you are filling the cup with that number after first dumping it out. If you use addvar and subvar, you will be adding that much rice to the cup or taking away that much rice, respectively.

More clear?
So say I want to set a variable for the starters... I will use 0x4011 as the variable. Would it be like this: "0x4011 0x1" for Bulba, "0x4011 0x2" for Char, and "0x4011 0x3" for Squirt? Or would I use three different variables (4011-4013) respectively?
Reply With Quote
  #44    
Old April 9th, 2014 (04:56 PM).
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote originally posted by Ethanb900:
So say I want to set a variable for the starters... I will use 0x4011 as the variable. Would it be like this: "0x4011 0x1" for Bulba, "0x4011 0x2" for Char, and "0x4011 0x3" for Squirt? Or would I use three different variables (4011-4013) respectively?
1. Don't use that var, it is temporary.

2. Why use 3 vars when it can be done with 1? Less is more bro, less is more. If you use 3, you may as well use flags instead since those can only be turned on and off.
__________________

Paired with Simba
Reply With Quote
  #45    
Old July 1st, 2014 (04:04 AM).
JabrZee
 
Join Date: Jun 2014
Gender: Male
Thank you so much for this guide!

I was stuck with tiles scripting, but thanks to you I finally got around making it work! :D
Reply With Quote
  #46    
Old July 8th, 2014 (06:38 AM).
Rambon99's Avatar
Rambon99
 
Join Date: Jul 2014
Location: Caracas Venezuela
Gender: Male
Nature: Lonely
Hey there the tutorial was great but I still seem to be having some problems. I'm trying to create a script where the player takes a step back if he hasn't completed a certain requirement (Or activated a flag). However when I try it in game nothing winds up happening and I really don't know why. I'm fairly new to hacking pokemon so I would really appreciate some help I'll put the script here if you'd like to take a look at it.
Spoiler:
#dynamic 0x71B4C2
#org @start
setvar 0x4050 0x1
lock
checkflag 0x213
if 0x1 goto @done
msgbox @1 0x6
applymovement 0xFF @move
release
end

#org @done
release
end

#org @1
= \c[red_fr][Player]: I don't wanna go outside! There's people there!

#org @move
#raw 0x13
#raw 0xFE
__________________
Omg spriterz pls! Right nao I'm looking for someone who can sprite decently to help me on my game! I don't have any money but I can give lots of love and kisses ;3. PM for mo' info'!
Reply With Quote
  #47    
Old July 8th, 2014 (08:00 AM).
pokemontutorialTV's Avatar
pokemontutorialTV
 
Join Date: Feb 2014
Location: Germany, K-Town
Gender: Male
Nature: Calm
Send a message via Skype™ to pokemontutorialTV
@Rambon99 You forgot waitmovement I think so...
__________________
Making Youtube Videos about Pokémon.
_______________________________________________
Pokémon Zoisit:

_______________________________________________
My Youtube Channel with over 1000 videos to Pokémon: http://www.youtube.com/user/pokemontutorialTV
Reply With Quote
  #48    
Old July 8th, 2014 (08:11 AM).
Rambon99's Avatar
Rambon99
 
Join Date: Jul 2014
Location: Caracas Venezuela
Gender: Male
Nature: Lonely
No that doesn't seem to fix anything
__________________
Omg spriterz pls! Right nao I'm looking for someone who can sprite decently to help me on my game! I don't have any money but I can give lots of love and kisses ;3. PM for mo' info'!
Reply With Quote
  #49    
Old July 9th, 2014 (12:53 AM). Edited July 9th, 2014 by DarkPsychic.
DarkPsychic's Avatar
DarkPsychic
 
Join Date: Jul 2012
Gender: Male
Quote originally posted by Rambon99:
Hey there the tutorial was great but I still seem to be having some problems. I'm trying to create a script where the player takes a step back if he hasn't completed a certain requirement (Or activated a flag). However when I try it in game nothing winds up happening and I really don't know why. I'm fairly new to hacking pokemon so I would really appreciate some help I'll put the script here if you'd like to take a look at it.
Spoiler:
#dynamic 0x71B4C2
#org @start
setvar 0x4050 0x1
lock
checkflag 0x213
if 0x1 goto @done
msgbox @1 0x6
applymovement 0xFF @move
release
end

#org @done
release
end

#org @1
= \c[red_fr][Player]: I don't wanna go outside! There's people there!

#org @move
#raw 0x13
#raw 0xFE







Hello let me see if I may be able to help... Now I am not the best but I have done this one before...
Try this,

Code:
#dynamic 0x800000
#org @start
checkitem 0x4 0x1
compare LASTRESULT 0x1
if 0x1 call @yes
msgbox @nomsg 0x2
end
#org @yes
msgbox @yesmsg 0x6
applymovement 0x03 @move1
waitmovement 0x0
pause 0x30
end
#org @nomsg
= Nope, you don't have a Pokemon or\npokeballs. Tall grass is\ldangerous!
#org @yesmsg
= Aha, thanks for showing it to us.\nPlease proceed
#org @move1
#raw 0x13
#raw 0x11
#raw 0xFE
Now this script would have to be messed with for you to get it to work for you.
For instance the applymovements would differ and also this would move a Npc that is standing in the way of a door or something similar.. You can very easily change this to fit what you are wanting to do but in order to do so I really think it would do you wonders to read this tutorial
http://www.pokecommunity.com/showthread.php?t=164276
and really try to understand it by practicing everything at least 2 or 3 times. You will be a master scripter in no time
Reply With Quote
  #50    
Old July 9th, 2014 (09:12 AM).
karatekid552's Avatar
karatekid552
What happens if I push it?....
 
Join Date: Nov 2012
Location: Do you really want to know? Really?
Gender: Male
Nature: Bold
Send a message via AIM to karatekid552 Send a message via Windows Live Messenger to karatekid552 Send a message via Skype™ to karatekid552
Quote originally posted by Rambon99:
Hey there the tutorial was great but I still seem to be having some problems. I'm trying to create a script where the player takes a step back if he hasn't completed a certain requirement (Or activated a flag). However when I try it in game nothing winds up happening and I really don't know why. I'm fairly new to hacking pokemon so I would really appreciate some help I'll put the script here if you'd like to take a look at it.
Spoiler:
#dynamic 0x71B4C2
#org @start
setvar 0x4050 0x1
lock
checkflag 0x213
if 0x1 goto @done
msgbox @1 0x6
applymovement 0xFF @move
release
end

#org @done
release
end

#org @1
= \c[red_fr][Player]: I don't wanna go outside! There's people there!

#org @move
#raw 0x13
#raw 0xFE

Do you ever actually setflag 0x213??? If you don't then nothing will happen, just like you are getting right now.
__________________

Paired with Simba
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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 02:28 AM.