PDA

View Full Version : Time Limits


Orinjmate
August 4th, 2010, 09:54 AM
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
August 18th, 2010, 07:17 AM
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
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
October 3rd, 2010, 06:48 AM
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?

Spherical Ice
October 3rd, 2010, 10:44 AM
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
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.

Darthatron
October 3rd, 2010, 12:34 PM
It requires ASM, there is no scripting way to do it. You have to branch a hooked routine from the game-time routine.

colcolstyles
October 8th, 2010, 09:08 PM
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
October 10th, 2010, 08:35 AM
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?

Spherical Ice
October 10th, 2010, 09:46 AM
ah. My apologies then. What about the nop commands in XSE? would any of them occupy enough space for this to work?

They would do nothing, as the description said. So yeah, I'm sure it's an ASM-only "feature," for want of a better word.

Shiny Quagsire
October 15th, 2010, 02:39 PM
You could simply use the timers built in to the GBA and access them via ASM. Just activate the IO registers, and it'll start tickin' away ;)

sab
October 23rd, 2010, 03:58 AM
r/s/e cycling road anyone?

Orinjmate
October 31st, 2010, 06:01 AM
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
November 24th, 2010, 06:33 PM
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.