The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script I want to know if this is safe

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 22nd, 2019 (5:17 AM). Edited January 23rd, 2019 by rubenturen.
rubenturen's Avatar
rubenturen rubenturen is offline
Also Known as: Canned Brain
 
Join Date: Dec 2018
Location: —Denmark
Gender: Male
Nature: Jolly
Posts: 52
(Info:I’m using emerald)
I think I found a way to save vars so I want to know if it’s safe.

Ok, it goes like this you create a script like this:

#dynamic 0x800000
#org @start
Checkflag 0x(flag)
If 0x0 goto @flagisnotactive
End

#org @flagisnotactive
Lock
Setflag 0x(flag)
(Make your script here)
Release
End

And then you use one var for all level/event scripts
That uses vars.

So what I think will happen:
the var is allways active,
So normally the script would play again and again,
But because of the flag that activates the first Time the script runs,
It Will do so that it will not play again.

Pls tell if this is possible and what side effects it will make.
Thx.
__________________
I’m working on a ROM hack called pokemon penny.
It is a hack of emerald.





Sry, im not very good at typing the english Language.
This is the best Pokemon. FIGHT ME!!!
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old January 22nd, 2019 (5:32 AM).
DrFuji's Avatar
DrFuji DrFuji is offline
Heiki Hecchara‌‌
 
Join Date: Sep 2009
Location: Aussie
Age: 30
Gender: Male
Nature: Jolly
Posts: 1,693
Its is certainly usable in the sense that that you wouldn't need to use any variables and the scripts will run correctly if you step on a green script tile, but I don't believe that the trade off is worth it.

You will have two bugs that will occur if you only use checkflags. Firstly, the player will lose all of their momentum when they step on the script tile, even if you've already set the flag. This is most easily seen when you ride over the tile on a bike. Secondly, if you step on the tile shortly after entering a map, the map name in the top left corner will suddenly disappear, rather than being shown for the correct amount of time.

If you're looking to save variables, you can merge a number of scripts to run off a single variable. For example, You put script A in the starting town, script B on Route 1 and script C in the second town. You've set the scripts up so that Its impossible for the player to avoid any of the script, making them activate in the succession of A > B > C. When you activate script A, you set the variable to 0x1 so that it won't run again. You then set up script B so that it only activates when the variable is equal to 0x1 and then change the variable to 0x2 when the player activates the script. You do the same with script C, making activate when the variable is equal to 0x2 and then change it to 0x3 during the script. You can continue this chain for as long as you like, so long as the scripts will be activated in a linear fashion. Now you're only using one variable, rather than using three flags, its neater and has no bugs attached.

While variables can be intimidating when you're just starting out (especially when compared to the simplicity of flags) they certainly aren't enemies.
__________________
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old January 22nd, 2019 (5:50 AM).
rubenturen's Avatar
rubenturen rubenturen is offline
Also Known as: Canned Brain
 
Join Date: Dec 2018
Location: —Denmark
Gender: Male
Nature: Jolly
Posts: 52
Quote:
Originally Posted by DrFuji View Post
Its is certainly usable in the sense that that you wouldn't need to use any variables and the scripts will run correctly if you step on a green script tile, but I don't believe that the trade off is worth it.

You will have two bugs that will occur if you only use checkflags. Firstly, the player will lose all of their momentum when they step on the script tile, even if you've already set the flag. This is most easily seen when you ride over the tile on a bike. Secondly, if you step on the tile shortly after entering a map, the map name in the top left corner will suddenly disappear, rather than being shown for the correct amount of time.

If you're looking to save variables, you can merge a number of scripts to run off a single variable. For example, You put script A in the starting town, script B on Route 1 and script C in the second town. You've set the scripts up so that Its impossible for the player to avoid any of the script, making them activate in the succession of A > B > C. When you activate script A, you set the variable to 0x1 so that it won't run again. You then set up script B so that it only activates when the variable is equal to 0x1 and then change the variable to 0x2 when the player activates the script. You do the same with script C, making activate when the variable is equal to 0x2 and then change it to 0x3 during the script. You can continue this chain for as long as you like, so long as the scripts will be activated in a linear fashion. Now you're only using one variable, rather than using three flags, its neater and has no bugs attached.

While variables can be intimidating when you're just starting out (especially when compared to the simplicity of flags) they certainly aren't enemies.
Thank you.
When I read the beginning I thought there was no way.
But I’m thankful that there was.
__________________
I’m working on a ROM hack called pokemon penny.
It is a hack of emerald.





Sry, im not very good at typing the english Language.
This is the best Pokemon. FIGHT ME!!!
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old January 22nd, 2019 (6:48 AM). Edited January 22nd, 2019 by rubenturen.
rubenturen's Avatar
rubenturen rubenturen is offline
Also Known as: Canned Brain
 
Join Date: Dec 2018
Location: —Denmark
Gender: Male
Nature: Jolly
Posts: 52
Quote:
Originally Posted by DrFuji View Post
Its is certainly usable in the sense that that you wouldn't need to use any variables and the scripts will run correctly if you step on a green script tile, but I don't believe that the trade off is worth it.

You will have two bugs that will occur if you only use checkflags. Firstly, the player will lose all of their momentum when they step on the script tile, even if you've already set the flag. This is most easily seen when you ride over the tile on a bike. Secondly, if you step on the tile shortly after entering a map, the map name in the top left corner will suddenly disappear, rather than being shown for the correct amount of time.

If you're looking to save variables, you can merge a number of scripts to run off a single variable. For example, You put script A in the starting town, script B on Route 1 and script C in the second town. You've set the scripts up so that Its impossible for the player to avoid any of the script, making them activate in the succession of A > B > C. When you activate script A, you set the variable to 0x1 so that it won't run again. You then set up script B so that it only activates when the variable is equal to 0x1 and then change the variable to 0x2 when the player activates the script. You do the same with script C, making activate when the variable is equal to 0x2 and then change it to 0x3 during the script. You can continue this chain for as long as you like, so long as the scripts will be activated in a linear fashion. Now you're only using one variable, rather than using three flags, its neater and has no bugs attached.

While variables can be intimidating when you're just starting out (especially when compared to the simplicity of flags) they certainly aren't enemies.
Oh I also want to know about some useable vars who will not corrupt my game.
For emerald
__________________
I’m working on a ROM hack called pokemon penny.
It is a hack of emerald.





Sry, im not very good at typing the english Language.
This is the best Pokemon. FIGHT ME!!!
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
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 GMT -8. The time now is 9:13 AM.