The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary ROM Hacking (https://www.pokecommunity.com/forumdisplay.php?f=284)
-   -   Script I want to know if this is safe (https://www.pokecommunity.com/showthread.php?t=417417)

rubenturen January 22nd, 2019 5:17 AM

I want to know if this is safe
 
(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.

DrFuji January 22nd, 2019 5:32 AM

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.

rubenturen January 22nd, 2019 5:50 AM

Quote:

Originally Posted by DrFuji (Post 9970750)
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.

rubenturen January 22nd, 2019 6:48 AM

Quote:

Originally Posted by DrFuji (Post 9970750)
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


All times are GMT -8. The time now is 9:13 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.