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 [Emerald] Back wih more problems (https://www.pokecommunity.com/showthread.php?t=419827)

McPaul April 6th, 2019 8:02 AM

[Emerald] Back wih more problems
 
1 Attachment(s)
Hey yo!
I created a script the same way I usually do, but when I compile it doen't get the way I want. Just watch:

What I wrote and compiled:

Spoiler:
'---------------
#dynamic 0xDE4030

#org @main
lockall
checkflag 0x86A
if 0x0 goto 0x8290915
checkflag 0x889
if 0x1 goto 0x829091F
checkitem 0x16A 0x1
compare LASTRESULT 0x1
if 0x1 goto 0x8290915
setanimation 0x0 LASTRESULT
bufferitem 0x0 0x16A
msgbox 0x829092C MSG_YESNO '"It's a big boulder, but an item\nm..."
compare LASTRESULT 0x0
if 0x1 goto 0x8290929
closeonkeypress
doanimation 0x28
waitstate
goto 0x8290908

'---------------
#org 0x290915
msgbox 0x82909D6 MSG_KEEPOPEN '"It's a big boulder, but an item\..."
releaseall
end

'---------------
#org 0x29091F
msgbox 0x8290A16 MSG_KEEPOPEN '"[buffer1] made it possible to move..."
releaseall
end

'---------------
#org 0x290929
closeonkeypress
releaseall
end

'---------------
#org 0x290908
setflag 0x889
msgbox 0x829098C MSG_KEEPOPEN '"[player] used [buffer1]!\p[buffer1..."
releaseall
end


'---------
' Strings
'---------
#org 0x29092C
= It's a big boulder, but an item\nmay be able to push it aside.\pWould you like to use [buffer1]?

#org 0x2909D6
= und!

#org 0x290A16
= [buffer1] made it possible to move\nboulders around.

#org 0x29098C
= [player] used [buffer1]!\p[buffer1] made it\npossible to move boulders around!


And what I get when I reopen my script:

Spoiler:
'---------------
#org 0xE3D184
lockall
checkflag 0x86A
if 0x0 goto 0x8290915
checkflag 0x889
if 0x1 goto 0x829091F
checkitem 0x16A 0x1
compare LASTRESULT 0x1
if 0x1 goto 0x8290915
setanimation 0x0 LASTRESULT
bufferitem 0x0 0x16A
msgbox 0x829092C MSG_YESNO '"It's a big boulder, but an item\nm..."
compare LASTRESULT 0x0
if 0x1 goto 0x8290929
closeonkeypress
doanimation 0x28
waitstate
goto 0x8290908

'---------------
#org 0x290915
msgbox 0x82909D6 MSG_KEEPOPEN '"und!"
releaseall
end

'---------------
#org 0x29091F
msgbox 0x8290A16 MSG_KEEPOPEN '"[buffer1] made it possible to move..."
releaseall
end

'---------------
#org 0x290929
closeonkeypress
releaseall
end

'---------------
#org 0x290908
setflag 0x889
msgbox 0x829098C MSG_KEEPOPEN '"[player] used [buffer1]!\p[buffer1..."
releaseall
end


'---------
' Strings
'---------
#org 0x29092C
= It's a big boulder, but an item\nmay be able to push it aside.\pWould you like to use [buffer1]?

#org 0x2909D6
= und!

#org 0x290A16
= [buffer1] made it possible to move\nboulders around.

#org 0x29098C
= [player] used [buffer1]!\p[buffer1] made it\npossible to move boulders around!


And I get this:

Attachment 87830


Why's that happening? All those difficulties every time I want to do a single little thing is getting on my nerves.

Thanks for your answer.

kalarie April 6th, 2019 9:32 AM

You mean the text?

Well, you as far as I can see that is the exact text you wanted to import at #org 0x2909D6?
Otherwise, you'll have to change the text at the string.

Off topic: Binary romhacking is not going to be very easy, you'll encounter lots of stuff that will work on your nerves...

Avara April 6th, 2019 9:47 AM

From what I can see it's pretty much doing what you told it to, it just looks like you've either accidentally overwritten or deleted part of the text of that string. Don't worry, just make a new pointer to correct text and you'll be fine x

DrFuji April 6th, 2019 10:19 PM

Whenever you're editing a compiled script (one that's already in the ROM), its best to repoint everything that makes it up. You've used a dynamic pointer for the @main segment of your script, but all of the branches and text are still using static pointers. Static pointers don't care what's already there in the ROM, they just overwrite it, causing errors if your script isn't spaced out properly.

Here's a version of your script with fully dynamic pointers. You will need to do this in the future as well.

Spoiler:
#dynamic 0xDE4030

#org @main
lockall
checkflag 0x86A
if 0x0 goto @CantPush
bufferitem 0x0 0x16A
checkflag 0x889
if 0x1 goto @AlreadyUsed
compare 0x800D 0x1
if 0x1 goto @CantPush
setanimation 0x0 0x800D
bufferitem 0x0 0x16A
msgbox @UseItem 0x5
compare 0x800D 0x0
if 0x1 goto @AnswerNo
closeonkeypress
doanimation 0x28
waitstate
goto @Ending

#org @CantPush
msgbox @CantPushText 0x6
releaseall
end

#org @AlreadyUsed
msgbox @AlreadyUsedText 0x6
releaseall
end

#org @AnswerNo
closeonkeypress
releaseall
end

#org @Ending
setflag 0x889
bufferitem 0x0 0x16A
msgbox @EndingText 0x6
releaseall
end

#org @UseItem
= It's a big boulder, but an item\nmay be able to push it aside.\pWould you like to use [buffer1]?

#org @CantPushText
= It's a big boulder, but an item\nmay be able to push it aside.

#org @AlreadyUsedText
= [buffer1] made it possible to move\nboulders around.

#org @EndingText
= [player] used [buffer1]!\p[buffer1] made it\npossible to move boulders around!


Just keep using dynamic pointers rather than static ones and you should be fine. For some reason, the script kept losing the contents of [buffer1] whenever I tried testing this so I moved the bufferitem command around and added a new one towards the end. I also repaired what I thought the @CantPushText string would be, because it was broken in both of your scripts.

And yes, there is a lot of frustration in hacking, but that also goes for making a game in any medium :P

McPaul April 6th, 2019 10:33 PM

Thank you guys I'll try to do as you said!

So DrFuji, I did that for every script I made until then. That means a lot of thigs are now broken in my game and I'll get bad surprises in the future?

DrFuji April 6th, 2019 10:40 PM

Possibly, it depends on whether the scripts you edited became longer/ stayed the size or smaller. Hopefully there isn't too much that is overwritten, but I wouldn't be surprised if there are some errors. Any errors would probably only be confined to scripts rather than more complicated things like battles so at least they will be easy to fix.

McPaul April 6th, 2019 11:07 PM

Thanks a lot!


All times are GMT -8. The time now is 9:14 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.