The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Other Level Scripts and Setvars Questions and Issue

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 June 27th, 2014 (11:58 AM).
CosmicBlazer's Avatar
CosmicBlazer CosmicBlazer is offline
Batman
 
Join Date: Jan 2013
Location: USA
Gender: Male
Posts: 190
Alright, I got my first level script working, but the problem is that it keeps activating. i have setvar 4000 0x1 used.

Spoiler:
#dynamic 0x800000

#org @start
checkflag 0x82F
if 0x1 goto @dont
applymovement 0x1 @move
waitmovement 0x0
msgbox @hi 0x6
setflag 0x82F
applymovement 0x1 @do
waitmovement
setvar 0x4000 0x0
release
end

#org @dont
clearflag 0x82F
release
end

#org @move
#raw 0x62
#raw 0x11
#raw 0x13
#raw 0x13
#raw 0x4A
#raw 0xfe

#org @hi
= Hey hunny. Here are your \n Running shoes.

#org @do
#raw 0x12
#raw 0x12
#raw 0x10
#raw 0x2



Second, "So, if we take the situation above where we had the var as 0x4050 and the value at 0 and we don't want the script to run again, simply add this to the end of your script. setvar 4050 0x1" quoted from the Flags,Vars and Script Tutorial thread. I did this except had 4000 has the var, but it keeps activating.

Third (sorry last one xD) quoted from the same thread "Vars are like the X in math. They can be anything up to 0xFFFF which is a little over 65,000. Like flags, they are used to track progression throughout the game, but they are also used to store information."

Does this imply that I could use the var 4000 as many times?
__________________
Pokemon Cosmic: A New Threat

For God so loved the world, that he gave his only begotten Son, that who ever believe in him should not perish, but have everlasting life. - John 3:16

I believe in Jesus Christ my Savior. If you do too, and aren't scared to admit it, then copy and paste this in your signature.[/sig-reason]
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old June 27th, 2014 (12:08 PM).
Mana's Avatar
Mana Mana is offline
 
Join Date: Jan 2009
Location: UK
Age: 31
Gender: Male
Posts: 10,075
You've set 0x4000 to 0x0 in your script :( needs to he 0x1.

And no, what that last bit means is that variables have different values. Unlike flags, you can set them to 0x2, 0x3, etc. similar to flags there are also quite a few you can use. Check out karatekid's flags/variables thread for safe variables for flags. :)
__________________
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old June 27th, 2014 (12:12 PM).
Renegade's Avatar
Renegade Renegade is offline
Time for real life...
 
Join Date: Nov 2011
Location: United States
Gender: Male
Nature: Careful
Posts: 995
I was going to reply with a code fix, but Magic basically said what needs to be done. However there's a bit of the script that I don't understand your reasoning behind:
Code:
#dynamic 0x800000

#org @start
checkflag 0x82F
if 0x1 goto @dont
applymovement 0x1 @move
waitmovement 0x0
msgbox @hi 0x6
setflag 0x82F
applymovement 0x1 @do
waitmovement
setvar 0x4000 0x0
release 
end

#org @dont
clearflag 0x82F
release
end

#org @move
#raw 0x62
#raw 0x11
#raw 0x13
#raw 0x13
#raw 0x4A
#raw 0xfe

#org @hi
= Hey hunny. Here are your \n Running shoes.

#org @do
#raw 0x12
#raw 0x12
#raw 0x10
#raw 0x2
Why do you check if the Running Shoes have already been set? Once your level script runs once, it won't run again, so you don't need to check anything. Also, even if this format was correct, why would you clear the Running Shoes flag right after activating it? If that happened, you would obtain the Running Shoes and then you would be confiscated of them, so it would make no sense.

So basically, the parts in red can be deleted as they serve no purpose whatsoever.
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old June 27th, 2014 (12:44 PM).
CosmicBlazer's Avatar
CosmicBlazer CosmicBlazer is offline
Batman
 
Join Date: Jan 2013
Location: USA
Gender: Male
Posts: 190
Quote:
Originally Posted by Renegade View Post
I was going to reply with a code fix, but Magic basically said what needs to be done. However there's a bit of the script that I don't understand your reasoning behind:
Code:
#dynamic 0x800000

#org @start
checkflag 0x82F
if 0x1 goto @dont
applymovement 0x1 @move
waitmovement 0x0
msgbox @hi 0x6
setflag 0x82F
applymovement 0x1 @do
waitmovement
setvar 0x4000 0x0
release 
end

#org @dont
clearflag 0x82F
release
end

#org @move
#raw 0x62
#raw 0x11
#raw 0x13
#raw 0x13
#raw 0x4A
#raw 0xfe

#org @hi
= Hey hunny. Here are your \n Running shoes.

#org @do
#raw 0x12
#raw 0x12
#raw 0x10
#raw 0x2
Why do you check if the Running Shoes have already been set? Once your level script runs once, it won't run again, so you don't need to check anything. Also, even if this format was correct, why would you clear the Running Shoes flag right after activating it? If that happened, you would obtain the Running Shoes and then you would be confiscated of them, so it would make no sense.

So basically, the parts in red can be deleted as they serve no purpose whatsoever.
Hehe, I'm still a noob at this stuff but even though I had the clearflag it still gave me the running shoes XD anyway thank you very much. However, i changed it 0x1 but it still resetted the script. This script occurs when I go downstairs from my room. I'm using script type 2 do I need to use another type?
__________________
Pokemon Cosmic: A New Threat

For God so loved the world, that he gave his only begotten Son, that who ever believe in him should not perish, but have everlasting life. - John 3:16

I believe in Jesus Christ my Savior. If you do too, and aren't scared to admit it, then copy and paste this in your signature.[/sig-reason]
Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old June 27th, 2014 (1:36 PM).
Renegade's Avatar
Renegade Renegade is offline
Time for real life...
 
Join Date: Nov 2011
Location: United States
Gender: Male
Nature: Careful
Posts: 995
Quote:
Hehe, I'm still a noob at this stuff but even though I had the clearflag it still gave me the running shoes XD
The shoes won't be confiscated the first time you run the script. Rather, if it runs a second time, the result of checkflag 0x82F will be 0x1 (true) resulting in the confiscation.
Quote:
i changed it 0x1 but it still resetted the script.
Your AdvancedMap values must be wrong. Care to take a screen shot?
__________________
Reply With Quote
  #6   Link to this post, but load the entire thread.  
Old June 27th, 2014 (1:44 PM).
CosmicBlazer's Avatar
CosmicBlazer CosmicBlazer is offline
Batman
 
Join Date: Jan 2013
Location: USA
Gender: Male
Posts: 190
Quote:
Originally Posted by Renegade View Post
The shoes won't be confiscated the first time you run the script. Rather, if it runs a second time, the result of checkflag 0x82F will be 0x1 (true) resulting in the confiscation.

Your AdvancedMap values must be wrong. Care to take a screen shot?
Here you go
Attached Images
File Type: png Amap header.png‎ (12.6 KB, 4 views) (Save to Dropbox)
__________________
Pokemon Cosmic: A New Threat

For God so loved the world, that he gave his only begotten Son, that who ever believe in him should not perish, but have everlasting life. - John 3:16

I believe in Jesus Christ my Savior. If you do too, and aren't scared to admit it, then copy and paste this in your signature.[/sig-reason]
Reply With Quote
  #7   Link to this post, but load the entire thread.  
Old June 27th, 2014 (1:55 PM).
Mana's Avatar
Mana Mana is offline
 
Join Date: Jan 2009
Location: UK
Age: 31
Gender: Male
Posts: 10,075
http://www.pokecommunity.com/showthread.php?t=302347

0x4000 is a temporary variable - you need a more permanent one. Have a look on the link above for some ideas of better values :).
__________________
Reply With Quote
  #8   Link to this post, but load the entire thread.  
Old June 27th, 2014 (1:56 PM).
Renegade's Avatar
Renegade Renegade is offline
Time for real life...
 
Join Date: Nov 2011
Location: United States
Gender: Male
Nature: Careful
Posts: 995
So, I tested out your script in a clean ROM and I see what your problem is. The variable you used (0x4000) is appearently already being taken by something else in the game and is constantly being updated.

Short story-short, I changed your variable to 0x4011 and the script worked as intended and only ran a single time.

If you want to know which flags/variables are safe to use in your ROM, give this thread a quick read: http://www.pokecommunity.com/showthread.php?t=302347
Near the bottom will be the safe vars/flags that you should be using.
__________________
Reply With Quote
  #9   Link to this post, but load the entire thread.  
Old June 27th, 2014 (2:07 PM).
CosmicBlazer's Avatar
CosmicBlazer CosmicBlazer is offline
Batman
 
Join Date: Jan 2013
Location: USA
Gender: Male
Posts: 190
Quote:
Originally Posted by Renegade View Post
So, I tested out your script in a clean ROM and I see what your problem is. The variable you used (0x4000) is appearently already being taken by something else in the game and is constantly being updated.

Short story-short, I changed your variable to 0x4011 and the script worked as intended and only ran a single time.

If you want to know which flags/variables are safe to use in your ROM, give this thread a quick read: http://www.pokecommunity.com/showthread.php?t=302347
Near the bottom will be the safe vars/flags that you should be using.
Thank you very much Renegade, it worked now. Yeah that was the thread i was looking at. I don't know why i used 4000. Anyway now when i was reading the safe vars 4011-40FF. I can use 4099? or 40AA? Something like that, it seems dumb but i want to make sure.
__________________
Pokemon Cosmic: A New Threat

For God so loved the world, that he gave his only begotten Son, that who ever believe in him should not perish, but have everlasting life. - John 3:16

I believe in Jesus Christ my Savior. If you do too, and aren't scared to admit it, then copy and paste this in your signature.[/sig-reason]
Reply With Quote
  #10   Link to this post, but load the entire thread.  
Old June 27th, 2014 (2:38 PM).
Renegade's Avatar
Renegade Renegade is offline
Time for real life...
 
Join Date: Nov 2011
Location: United States
Gender: Male
Nature: Careful
Posts: 995
Quote:
Anyway now when i was reading the safe vars 4011-40FF. I can use 4099? or 40AA?
Yes, variables 0x4011-0x40FF are all safe to use and aren't really being used by the game (in any significant way). So this would include: 4011-4019, 401A-401F, 4020-4029, etc. It's all hexadecimal, so if you don't already know how to count using it, just use the calculator on the right side of XSE.

So punch in (hex mode) '4019 + 1' and you will get '= 401A'. You can keep using these until you hit 40FF.

In case it crosses your mind, don't worry about running out of variables because it won't happen. I mean, you have like 200 or 500 flags you can use (forgot exactly how many) and you'll be using them a lot more then variables. In case it ever does occur (where you run out of vars or flags), read this thread to learn how to expand the amount that you can use: http://www.pokecommunity.com/showthread.php?t=302476
__________________
Reply With Quote
  #11   Link to this post, but load the entire thread.  
Old June 27th, 2014 (3:06 PM).
CosmicBlazer's Avatar
CosmicBlazer CosmicBlazer is offline
Batman
 
Join Date: Jan 2013
Location: USA
Gender: Male
Posts: 190
Quote:
Originally Posted by Renegade View Post
Yes, variables 0x4011-0x40FF are all safe to use and aren't really being used by the game (in any significant way). So this would include: 4011-4019, 401A-401F, 4020-4029, etc. It's all hexadecimal, so if you don't already know how to count using it, just use the calculator on the right side of XSE.

So punch in (hex mode) '4019 + 1' and you will get '= 401A'. You can keep using these until you hit 40FF.

In case it crosses your mind, don't worry about running out of variables because it won't happen. I mean, you have like 200 or 500 flags you can use (forgot exactly how many) and you'll be using them a lot more then variables. In case it ever does occur (where you run out of vars or flags), read this thread to learn how to expand the amount that you can use: http://www.pokecommunity.com/showthread.php?t=302476
Ok thank you for all your help Renegade
__________________
Pokemon Cosmic: A New Threat

For God so loved the world, that he gave his only begotten Son, that who ever believe in him should not perish, but have everlasting life. - John 3:16

I believe in Jesus Christ my Savior. If you do too, and aren't scared to admit it, then copy and paste this in your signature.[/sig-reason]
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:09 AM.