Is it possible to read the time played in a game,specifically fire red, and create scripts around taht,for example.Checks the time and if its been played for at least an hour a cript will be able to happen?
Try reading HackMew's first ASM tutorial in the Documents and Tutorials section. If you adapt his code, you should be able to obtain the current playing time down to the millisecond.Is it possible to read the time played in a game,specifically fire red, and create scripts around taht,for example.Checks the time and if its been played for at least an hour a cript will be able to happen?
Try reading HackMew's first ASM tutorial in the Documents and Tutorials section. If you adapt his code, you should be able to obtain the current playing time down to the millisecond.
For future reference, this question would be better asked in the Simple Questions Thread.
Thanks,and ill remember to ask in the simple questions if it doenst directly involve a script,i was just hoping this could be done by scripting.
Yep, I believe the command comparefarbytetobyte is what you would need. :P
'---------------
#org 0x298D2A
checkflag 0x202
if 0x1 goto 0x8298D6F
lock
faceplayer
showsprite 0x4
msgbox 0x8298D90 MSG_NORMAL '"Hold on kiddo!"
applymovement MOVE_PLAYER 0x8298D72
waitmovement 0x0
applymovement 0x4 0x8298D75
waitmovement 0x0
msgbox 0x8298DA1 MSG_NORMAL '"Where the hell did you come from?\..."
applymovement 0x4 0x8298D83
waitmovement 0x0
hidesprite 0x4
setflag 0x202
release
end
'---------------
#org 0x298D6F
release
end
'---------
' Strings
'---------
#org 0x298D90
= Hold on kiddo!
#org 0x298DA1
= Where the hell did you come from?\nI saw that statue glow,\pthen you just pop out of nowhere!\nHmph... Ill figure it out.
'-----------
' Movements
'-----------
#org 0x298D72
#raw 0x2 'Face Left
#raw 0xFE 'End of Movements
#org 0x298D75
#raw 0x20 'Step Right (Fast)
#raw 0x20 'Step Right (Fast)
#raw 0x20 'Step Right (Fast)
#raw 0x20 'Step Right (Fast)
#raw 0x20 'Step Right (Fast)
#raw 0x20 'Step Right (Fast)
#raw 0x20 'Step Right (Fast)
#raw 0x20 'Step Right (Fast)
#raw 0x20 'Step Right (Fast)
#raw 0x20 'Step Right (Fast)
#raw 0x20 'Step Right (Fast)
#raw 0x55 'Jump in Place (Facing Right)
#raw 0xFE 'End of Movements
#org 0x298D83
#raw 0x1F 'Step Left (Fast)
#raw 0x1F 'Step Left (Fast)
#raw 0x1F 'Step Left (Fast)
#raw 0x1F 'Step Left (Fast)
#raw 0x1F 'Step Left (Fast)
#raw 0x1F 'Step Left (Fast)
#raw 0x1F 'Step Left (Fast)
#raw 0x1F 'Step Left (Fast)
#raw 0x1F 'Step Left (Fast)
#raw 0x1F 'Step Left (Fast)
#raw 0x1F 'Step Left (Fast)
#raw 0xFE 'End of Movements
That actually sounds quite interesting. How would you go about using that?
comparefarbytetobyte 0x20245C6 0x1
if 0x4 goto @script
Actually, this is not the case. The play time data, along with most of the other player data, actually moves around due to DMA (Direct Memory Access). The offset of the data is determined by a pointer at 0x300500C (which is in the IRAM, in case you're wondering.In FR, the location for the playtime is at 0x20245C6 in the RAM. The first two bytes you'll find there are the hours of playtime, second byte minutes, then seconds and last, but not least, the milliseconds.
In R/S, the offset is 0x2024EB2, and in Emerald 0x2024A96. And indeed, you can check them with comparefarbytetobyte. To check for at least an hour of playtime, you would use:
(Obviously, that's for FR/LG. In R/S/E, only the offset changes. The rest remains the same.)Code:comparefarbytetobyte 0x20245C6 0x1 if 0x4 goto @script
I edited the map for Cinnabar Island (img21.imageshack.us/img21/1884/cinnabarisland.png), and now the script to keep you out of the Gym until you have the Secret Key doesn't work. How do I fix this?
You'll need to move the script tile to in front of Cinnibar Island's gym.
I did. It still doesn't work.
Game: Pokémon Rose Version (Fire Red Hack)
Type: A Trigger Script (you walk over a green script tile)
Editor: I'm using PokeScript to put the script into the game, and I'm using XSE to view the script.
Script:
What I wrote and compiled with PokeScript:
Spoiler:#org $mom1
lock
setvar 0x4001 0x0
goto $mom
#org $mom2
lock
setvar 0x4001 0x1
goto $mom
#org $mom
playsong 0x110 0x0
message $mom3
$mom3 1 = Good morning, dear!
boxset 6
compare 0x4001 0x0
if 1 goto $move1
goto $move2
#org $move1
applymovement 0xFF $move3
$move3 1 ; #binary 0x10 0x12 0x12 0x10 0xFE
pausemove 0x0
goto $mom4
#org $move2
applymovement 0xFF $move4
$move4 1 ; #binary 0x10 0x12 0x12 0x12 0x10 0xFE
pausemove 0x0
goto $mom4
#org $mom4
message $mom5
$mom5 1 = You should read the morning\nnewspaper, \v\h01.\pIt says Professor Larch has\nreturned from his trip abroad\lwhere he met Professor...\pOh! The page is torn.\nI wonder what that Professor's\lname was...
boxset 6
goto $mom6
#org $mom6
message $mom7
$mom7 1 = Hmm... Let's see...
boxset 6
goto $oak
#org $oak
message $oak1
$oak1 1 = Was it Professor Oak?
boxset 5
compare LASTRESULT 1
if 1 goto $oak2
goto $elm
#org $elm
message $elm1
$elm1 1 = Was it Professor Elm?
boxset 5
compare LASTRESULT 1
if 1 goto $elm2
goto $birch
#org $birch
message $birch1
$birch1 1 = Was it Professor Birch?
boxset 5
compare LASTRESULT 1
if 1 goto $birch2
goto $mom6
#org $oak2
message $oak3
$oak3 1 = That's right, now I remember!\pIt was Professor Oak from the\nKanto region!
boxset 6
setvar 0x6000 0x0
goto $mom8
#org $elm2
message $elm3
$elm3 1 = That's right, now I remember!\pIt was Professor Elm from the\nJohto region!
boxset 6
setvar 0x6000 0x1
goto $mom8
#org $birch2
message $birch3
$birch3 1 = That's right, now I remember!\pIt was Professor Birch from the\nHoenn region!
boxset 6
setvar 0x6000 0x2
goto $mom8
#org $mom8
message $mom9
$mom9 1 = Professor Larch should be\noutside.\pI'm sure his long trip has\nmade him miss being home!
setvar 0x6001 0x1
boxset 6
fadedefault
release
end
The script, as seen in XSE:
Spoiler:'---------------
#org 0x801131
lock
setvar 0x4001 0x0
goto 0x8801147
'---------------
#org 0x801147
multichoice2 0x6C 0x61 0x79 0x73 0x6F
yesnobox 0x67 0x20
special2 0x3168 0x3031
comparefarbytes 0x20306826 0x1238000F
bufferitem 0x8 0x609
compare 0x4001 0x0
if 0x1 goto 0x8801172
goto 0x8801181
'---------------
#org 0x801172
applymovement MOVE_PLAYER 0x880124C
waitmovement 0x0
goto 0x8801190
'---------------
#org 0x801181
applymovement MOVE_PLAYER 0x8801251
waitmovement 0x0
goto 0x8801190
'---------------
#org 0x801190
msgbox 0x8801257 MSG_NORMAL '"You should read the morning\nnewsp..."
goto 0x880119D
'---------------
#org 0x80119D
msgbox 0x8801317 MSG_NORMAL '"Hmm... Let's see..."
goto 0x88011AA
'---------------
#org 0x8011AA
msgbox 0x880132B MSG_YESNO '"Was it Professor Oak?"
compare LASTRESULT 0x1
if 0x1 goto 0x88011F2
goto 0x88011C2
'---------------
#org 0x8011F2
msgbox 0x880136F MSG_NORMAL '"That's right, now I remember!\pIt ..."
setvar 0x6000 0x0
goto 0x8801228
'---------------
#org 0x8011C2
msgbox 0x8801341 MSG_YESNO '"Was it Professor Elm?"
compare LASTRESULT 0x1
if 0x1 goto 0x8801204
goto 0x88011DA
'---------------
#org 0x801228
loadpointer 0x0 0x880144F '"Professor Larch should be\noutside..."
setvar 0x6001 0x1
callstd 0x6
playsong2 0x26C
hidecoins 0xE3 0xE3
'---------------
#org 0x801204
msgbox 0x88013B9 MSG_NORMAL '"That's right, now I remember!\pIt ..."
setvar 0x6000 0x1
goto 0x8801228
'---------------
#org 0x8011DA
msgbox 0x8801357 MSG_YESNO '"Was it Professor Birch?"
compare LASTRESULT 0x1
if 0x1 goto 0x8801216
goto 0x880119D
'---------------
#org 0x801216
msgbox 0x8801403 MSG_NORMAL '"That's right, now I remember!\pIt ..."
setvar 0x6000 0x2
goto 0x8801228
'---------
' Strings
'---------
#org 0x801257
= You should read the morning\nnewspaper, [player].\pIt says Professor Larch has\nreturned from his trip abroad\lwhere he met Professor...\pOh! The page is torn.\nI wonder what that Professor's\lname was...
#org 0x801317
= Hmm... Let's see...
#org 0x80132B
= Was it Professor Oak?
#org 0x80136F
= That's right, now I remember!\pIt was Professor Oak from the\nKanto region!
#org 0x801341
= Was it Professor Elm?
#org 0x80144F
= Professor Larch should be\noutside.\pI'm sure his long trip has\nmade him miss being home!
#org 0x8013B9
= That's right, now I remember!\pIt was Professor Elm from the\nJohto region!
#org 0x801357
= Was it Professor Birch?
#org 0x801403
= That's right, now I remember!\pIt was Professor Birch from the\nHoenn region!
'-----------
' Movements
'-----------
#org 0x80124C
#raw 0x10 'Step Down (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0xFE 'End of Movements
#org 0x801251
#raw 0x10 'Step Down (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0xFE 'End of Movements
Here's what happens:
Spoiler:![]()
Nothing happens. The game freezes.
I previously edited the script and had this in XSE:
Spoiler:'---------------
#org 0x800A4F
lock
setvar 0x4001 0x0
goto 0x8800A65
'---------------
#org 0x800A65
multichoice2 0x6C 0x61 0x79 0x73 0x6F
yesnobox 0x67 0x20
special2 0x3168 0x3031
comparefarbytes 0x20306826 0xB4C000F
bufferitem 0x8 0x609
compare 0x4001 0x0
if 0x1 goto 0x8800AB3
compare 0x4001 0x1
if 0x1 goto 0x8800ABE
msgbox 0x8800B60 MSG_NORMAL '"You should read the morning\nnewsp..."
goto 0x8800AC9
'---------------
#org 0x800AB3
applymovement MOVE_PLAYER 0x8800C78
waitmovement 0x0
return
'---------------
#org 0x800ABE
applymovement MOVE_PLAYER 0x8800C7D
waitmovement 0x0
return
'---------------
#org 0x800AC9
msgbox 0x8800C83 MSG_NORMAL '"Hmm... Let's see..."
goto 0x8800AD7
'---------------
#org 0x800AD7
msgbox 0x8800C97 MSG_YESNO '"Was it Professor Oak?"
compare LASTRESULT 0x1
if 0x1 goto 0x8800B22
goto 0x8800AF0
'---------------
#org 0x800B22
msgbox 0x8800CDB MSG_NORMAL '"That's right, now I remember!\pIt ..."
setvar 0x6000 0x0
return
'---------------
#org 0x800AF0
msgbox 0x8800CAD MSG_YESNO '"Was it Professor Elm?"
compare LASTRESULT 0x1
if 0x1 goto 0x8800B30
goto 0x8800B09
'---------------
#org 0x800B30
msgbox 0x8800D25 MSG_NORMAL '"That's right, now I remember!\pIt ..."
setvar 0x6000 0x1
return
'---------------
#org 0x800B09
msgbox 0x8800CC3 MSG_YESNO '"Was it Professor Birch?"
compare LASTRESULT 0x1
if 0x1 goto 0x8800B3E
goto 0x8800AC9
'---------------
#org 0x800B3E
msgbox 0x8800D6F MSG_NORMAL '"That's right, now I remember!\pIt ..."
setvar 0x6000 0x2
return
'---------
' Strings
'---------
#org 0x800B60
= You should read the morning\nnewspaper, [player].\pIt says Professor Larch has\nreturned from his trip abroad\lwhere he met Professor...\pOh! The page is torn.\nI wonder what that Professor's\lname was...
#org 0x800C83
= Hmm... Let's see...
#org 0x800C97
= Was it Professor Oak?
#org 0x800CDB
= That's right, now I remember!\pIt was Professor Oak from the\nKanto region!
#org 0x800CAD
= Was it Professor Elm?
#org 0x800D25
= That's right, now I remember!\pIt was Professor Elm from the\nJohto region!
#org 0x800CC3
= Was it Professor Birch?
#org 0x800D6F
= That's right, now I remember!\pIt was Professor Birch from the\nHoenn region!
'-----------
' Movements
'-----------
#org 0x800C78
#raw 0x10 'Step Down (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0xFE 'End of Movements
#org 0x800C7D
#raw 0x10 'Step Down (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x12 'Step Left (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0xFE 'End of Movements
With this result in-game:
Spoiler:![]()
Some strange box. I assume this is what that "multichoice" refers to. Within this box I can select two options, with the second making the arrow disappear. Pressing A on the second option does nothing; pressing A on the first makes the following happen:
![]()
A Yes/No box. Selecting either "Yes" or "No" will...
![]()
...make the game crash.
So, in short, XSE shows that the messages I want to have in this dialogue do in fact appear, and the movements for the player do, in fact, appear--it's the part right after setting variable 0x4001 that is messing up.
What this script is SUPPOSED to do is:
1. Stop the player and set the appropriate variable for the movement part of the script.
2. First message from the mother
3. Movement towards the mother
4. Another message
5. Followed by another message
6. Oak question (Yes: go to 9, No: go to 7)
7. Elm question (Yes: go to 10, No: go to 8)
8. Birch question (Yes: go to 11, No: go to 5)
9: Another message from the mom, and a variable is set (go to 12)
10: Another message from the mom, and a variable is set (go to 12)
11: Another message from the mom, and a variable is set (go to 12)
12: A final message by the mom, a variable is set to prevent this script from occurring again, and the script ends.
I have a script problem(duh)
the player is in a tight hallway and professor oke is one tile above you. I want him to follow you left and right so I wrote a script.
My first attempt used flags, and it worked on paper but no in game.
I then tried a referent way of doing things. I tried comparing the players facing so if he is facing left oke will move left, and if he faces right oke will move right. But When I play the game no matter what I do oke only moves left
'---------------
#org 0x71BBE4
lock
getplayerpos 0x6000 0x6001
compare PLAYERFACING 0x3
if 0x1 goto 0x871BC3E
compare PLAYERFACING 0x4
if 0x1 goto 0x871BC63
end
'---------------
#org 0x71BC3E
applymovement 0x17 0x871BC70
waitmovement 0x0
release
end
'---------------
#org 0x71BC63
applymovement 0x17 0x871BC73
waitmovement 0x0
release
end
'-----------
' Movements
'-----------
#org 0x71BC70
#raw 0x12 'Step Left (Normal)
#raw 0xFE 'End of Movements
#org 0x71BC73
#raw 0x13 'Step Right (Normal)
#raw 0xFE 'End of Movements