• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Development: Time Limits

Orinjmate

The Orinj of the Mate
120
Posts
13
Years
So, I was thinking how useful it would be for mini games and things like that, if it were possible to insert a time limit ASM routine into the engine of a ROM. I thought about whether any of the GBA games already had a time limit function in them because I thought it would be something they would use at one point in one of the games; the first thing that came to mind was the berry blender but I'm not sure. If it is possible to insert a routine like this then it would be so once the time limit finishes the player warps or something like that and also so that the time remaining until zero is shown at the top of the screen like a countdown? Does anyone have any thoughts on how it may be possible to create an ASM routine like this?
 

jakerman999

looking for spriters
52
Posts
16
Years
Depending on what you want the timer for, you could probably do this in scripts. Set a variable to the number of seconds you want to count down in, and have a loop that contains
Code:
pause 0x1
if variable = 0 return
subvar variable 0x1

And just not lock the script at the beginning. From there all thats needed is displaying how much time is left in a textbox. I leave this as an exercise to the reader.
 

Orinjmate

The Orinj of the Mate
120
Posts
13
Years
So you mean time limits do not require ASM? How about if you wanted to have a countdown clock at the top of the screen or something? Would you have to insert images onto free space then use ASM to choose the co-ordiantes on the screen for those images etc?
 
5,256
Posts
16
Years
Depending on what you want the timer for, you could probably do this in scripts. Set a variable to the number of seconds you want to count down in, and have a loop that contains
Code:
pause 0x1
if variable = 0 return
subvar variable 0x1

And just not lock the script at the beginning. From there all thats needed is displaying how much time is left in a textbox. I leave this as an exercise to the reader.

Although I'm pretty sure that it can be done with scripts, pauses will lock the player anyway, thus making it pointless. I'm currently trying to find a command that may help.
 

colcolstyles

Yours truly
1,588
Posts
15
Years
Yeah, I don't think it would be possible without ASM. As I see it, you could hack a routine that is run once per frame to increment a counter and then, when the counter reaches a certain value, branch to the script initializer to warp the player somewhere. However, if the player saved and quit, they could cause some bugs so you'd have to disable saving during this mini-game or whatever you're using the time limit for.

In short, it's possible but a number of precautions would have to be taken in order for it to be feasible. If you don't have a solid understanding of some of the game's core routines, it's probably out of your league for the time being.
 

jakerman999

looking for spriters
52
Posts
16
Years
Although I'm pretty sure that it can be done with scripts, pauses will lock the player anyway, thus making it pointless. I'm currently trying to find a command that may help.

ah. My apologies then. What about the nop commands in XSE? would any of them occupy enough space for this to work?
 

Orinjmate

The Orinj of the Mate
120
Posts
13
Years
r/s/e cycling road anyone?
Now that I think of it the guy at the bottom of the cycle road does tell you how long you took. So I checked the script and it would appear that it is a special command 'special 0xE4' that sets the buffers.
 

sab

Now too much of a life.
999
Posts
15
Years
Now that I think of it the guy at the bottom of the cycle road does tell you how long you took. So I checked the script and it would appear that it is a special command 'special 0xE4' that sets the buffers.
If I recall right, ser!go used that in the ice sled race for his second gym. I think he also edited (correct me if I'm wrong) the time it takes for certain text strings to ctivate. However, he also compiled his scripts in a way that makes them a pain (at least with xse) in the neck to read or decompile.
 
Back
Top