Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2012-12-02 00:55:41

delpo
Member
Registered: 2012-11-26
Post 9/40

Quick script question

If I'm editing an existing conversation script in PKSV, then let's say the conversation has 19 characters.  If I edit it so it still has 19 characters or fewer, will it not take up any more data in the ROM?  If I edited it to have 20 characters, for instance, would that cause the length of the conversation in the ROM to expand and overwrite other subsequent bytes?

Offline

#2 2012-12-02 02:06:53

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 1,991/3,460

Re: Quick script question

Yes, that would make it overwrite other data. Change it to use a dynamic location instead of a specific offset, and pksv will repoint it for you.

For example, change the code to look like this:

2writetext :text

By putting :text (or whatever other word you want to use for that label) PKSV knows we are dealing with a dynamic offset. Then, you will go down to the text itself and change it to look like this:

:text
= Looks like I can't\nget to BRICK TOWN\pbecause of all the\nboulders.\e

By changing the "#org 0x2CC00" or whatever the location was on the text to ":text" PKSV knows that this is the label you were referring to earlier in the script, and it will find a free location in that bank to insert it for you automatically when you compile the script.

Last edited by Mateo (2012-12-02 02:14:19)

Offline

#3 2012-12-02 07:46:44

delpo
Member
Registered: 2012-11-26
Post 11/40

Re: Quick script question

Wow, thanks for the great tip!  So I can always just replace the #org offset with :text everytime?  What if the bank in which it needs to be placed does not have an area of free space large enough to hold the text?

Offline

#4 2012-12-02 07:57:22

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 1,997/3,460

Re: Quick script question

I've never encountered that problem, but a label that uses :word format won't cross a bank, so I'm assuming it would just say that there is insufficient space or some other error when it goes to compile.

Offline

#5 2012-12-02 09:00:59

comet
Member
Registered: 2012-04-09
Post 44/672

Re: Quick script question

if you need text from a different bank, just use 3writetext

Offline

#6 2012-12-02 22:47:34

delpo
Member
Registered: 2012-11-26
Post 12/40

Re: Quick script question

Alright so I'm not understanding why this repointing of text is not working.  I am editing the beginning dialogue of your rival when you first fight him in cherrygrove city.  I used the ":text" thing in place of the specified offset and the new text works until it reaches a certain point.   Then it just gets completely messed up and forces the battle.  Not only that, when I go to talk to a different person the game completely messes up.  Why is this happening?

Here's some pics of what I'm talking about

bgb00003.png

Original script
Original.png

Edited script (just changed the offset on 2writetext to :text)
Edited_1.png

The script part looks like this:
:text
= [.]\pYou got a [POKé]MON\nat the LAB?\pWhat a waste.\nA wimp like you\lcould never become\la [POKé]MON master.\pWhat? You think you\ncould wipe the\lfloor with me?\lFine, I'll show you.\e

Offline

#7 2012-12-02 23:06:22

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 2,002/3,460

Re: Quick script question

That looks like it should work, umm instead of posting it as a screenshot, could you copy/paste it as text (inside of code tags, to make it handy). That would make it easier to see errors by letting me copy what you put in and see what happens when I try to compile it. Also, remember that there are two triggers for this rival battle and they each run similar scripts (with parts overlapping I think). But yeah, if you could paste the script like I did below it would make it easier to check everything out and see where your error is coming in.

Also, an example of a full script I compiled using these labels is this:

#org 0x11D780
'-----------------------------------
faceplayer
loadfont
2writetext :TalkFirst
closetext
loadmovesprites
winlosstext :TalkWin :TalkLose
loadtrainer 0x0A 0x1
startbattle
returnafterbattle
loadfont
2writetext :TalkAfter
closetext
loadmovesprites
special 0x2F
special 0x32
disappear 0x2
setbit1 0x691
pause 0xF
special 0x31
pause 0x1E
special 0x1B
refreshscreen 0x0
credits
end

:TalkFirst
= Looks like I can't\nget to BRICK TOWN\pbecause of all the\nboulders.\e

:TalkWin
= If I had a MIST\nSTONE to use, I\pprobably would\nhave won!\e

:TalkLose
= Well, that's how\nit goes sometimes.\e

:TalkAfter
= The journey is\nnever really over.\pAlways new places\nto explore!\e

That is the code used in Pokemon Christmas for the battle with Leaf, if you were wondering.

Offline

#8 2012-12-02 23:24:53

delpo
Member
Registered: 2012-11-26
Post 13/40

Re: Quick script question

Here's what I did for the upper trigger

#org 0x120479
'-----------------------------------
spriteface 0x0 0x3
showemote 0x0 0x0 0xF
special 0x69
pause 0xF
appear 0x3
applymovement 0x3 0x4599 ' 0x120599
spriteface 0x0 0x3
playmusic 0x1F
loadfont
2writetext :text
closetext
loadmovesprites
checkbit1 0x1C
if true 0x44B9 ' 0x1204B9
checkbit1 0x1D
if true 0x44CF ' 0x1204CF
winlosstext 0x4942 0x49A5 ' 0x120942,0x1209A5
setlasttalked 0x3
loadtrainer 0x9 0x3
writecode 0x3 0x1 ' Normal fight
startbattle
reloadmapmusic
reloadmap
if true 0x44E5 ' 0x1204E5
2jump 0x44F1 ' 0x1204F1

#org 0x1204B9
'-----------------------------------
winlosstext 0x4942 0x49A5 ' 0x120942,0x1209A5
setlasttalked 0x3
loadtrainer 0x9 0x1
writecode 0x3 0x1 ' Normal fight
startbattle
reloadmapmusic
reloadmap
if true 0x44E5 ' 0x1204E5
2jump 0x44F1 ' 0x1204F1

#org 0x1204E5
'-----------------------------------
playmusic 0x20
loadfont
2writetext 0x49C7 ' 0x1209C7
closetext
loadmovesprites
2jump 0x44FA ' 0x1204FA

#org 0x1204FA
'-----------------------------------
playsound 0x41
applymovement 0x0 0x459F ' 0x12059F
spriteface 0x0 0x2
applymovement 0x3 0x45A5 ' 0x1205A5
disappear 0x3
dotrigger 0x0
special 0x1B
playmapmusic
end

#org 0x1204CF
'-----------------------------------
winlosstext 0x4942 0x49A5 ' 0x120942,0x1209A5
setlasttalked 0x3
loadtrainer 0x9 0x2
writecode 0x3 0x1 ' Normal fight
startbattle
reloadmapmusic
reloadmap
if true 0x44E5 ' 0x1204E5
2jump 0x44F1 ' 0x1204F1

#org 0x1204F1
'-----------------------------------
playmusic 0x20
loadfont
2writetext 0x4961 ' 0x120961
closetext
loadmovesprites
playsound 0x41
applymovement 0x0 0x459F ' 0x12059F
spriteface 0x0 0x2
applymovement 0x3 0x45A5 ' 0x1205A5
disappear 0x3
dotrigger 0x0
special 0x1B
playmapmusic
end


:text
= [.]\pYou got a [POKé]MON\nat the LAB?\pWhat a waste.\nA wimp like you\lcould never become\la [POKé]MON master.\pWhat? You think you\ncould wipe the\lfloor with me?\lFine, I'll show you.\e

#org 0x120942
= Humph. Are you\nhappy you won?\e


#org 0x1209A5
= Humph. That was a\nwaste of time.\e


#org 0x1209C7
= [.]\pMy name's ???.\pI'm going to be\nthe world's great-\lest [POKé]MON\ltrainer.\e


#org 0x120961
= [.]\pMy name's ???.\pI'm going to be\nthe world's great-\lest [POKé]MON\ltrainer.\e


#org 0x120599
M step_left step_left step_left step_left step_left end

#org 0x12059F
M halfstep2_down look_up end

#org 0x1205A5
M halfstep2_left halfstep2_left halfstep2_left halfstep2_left halfstep2_up halfstep2_up halfstep2_left halfstep2_left end

Here's also the lower trigger that I made the same change to

#org 0x120479
'-----------------------------------
spriteface 0x0 0x3
showemote 0x0 0x0 0xF
special 0x69
pause 0xF
appear 0x3
applymovement 0x3 0x4599 ' 0x120599
spriteface 0x0 0x3
playmusic 0x1F
loadfont
2writetext :text
closetext
loadmovesprites
checkbit1 0x1C
if true 0x44B9 ' 0x1204B9
checkbit1 0x1D
if true 0x44CF ' 0x1204CF
winlosstext 0x4942 0x49A5 ' 0x120942,0x1209A5
setlasttalked 0x3
loadtrainer 0x9 0x3
writecode 0x3 0x1 ' Normal fight
startbattle
reloadmapmusic
reloadmap
if true 0x44E5 ' 0x1204E5
2jump 0x44F1 ' 0x1204F1

#org 0x1204B9
'-----------------------------------
winlosstext 0x4942 0x49A5 ' 0x120942,0x1209A5
setlasttalked 0x3
loadtrainer 0x9 0x1
writecode 0x3 0x1 ' Normal fight
startbattle
reloadmapmusic
reloadmap
if true 0x44E5 ' 0x1204E5
2jump 0x44F1 ' 0x1204F1

#org 0x1204E5
'-----------------------------------
playmusic 0x20
loadfont
2writetext 0x49C7 ' 0x1209C7
closetext
loadmovesprites
2jump 0x44FA ' 0x1204FA

#org 0x1204FA
'-----------------------------------
playsound 0x41
applymovement 0x0 0x459F ' 0x12059F
spriteface 0x0 0x2
applymovement 0x3 0x45A5 ' 0x1205A5
disappear 0x3
dotrigger 0x0
special 0x1B
playmapmusic
end

#org 0x1204CF
'-----------------------------------
winlosstext 0x4942 0x49A5 ' 0x120942,0x1209A5
setlasttalked 0x3
loadtrainer 0x9 0x2
writecode 0x3 0x1 ' Normal fight
startbattle
reloadmapmusic
reloadmap
if true 0x44E5 ' 0x1204E5
2jump 0x44F1 ' 0x1204F1

#org 0x1204F1
'-----------------------------------
playmusic 0x20
loadfont
2writetext 0x4961 ' 0x120961
closetext
loadmovesprites
playsound 0x41
applymovement 0x0 0x459F ' 0x12059F
spriteface 0x0 0x2
applymovement 0x3 0x45A5 ' 0x1205A5
disappear 0x3
dotrigger 0x0
special 0x1B
playmapmusic
end


:text
= [.]\pYou got a [POKé]MON\nat the LAB?\pWhat a waste.\nA wimp like you\lcould never become\la [POKé]MON master.\pWhat? You think you\ncould wipe the\lfloor with me?\lFine, I'll show you.\e

#org 0x120942
= Humph. Are you\nhappy you won?\e


#org 0x1209A5
= Humph. That was a\nwaste of time.\e


#org 0x1209C7
= [.]\pMy name's ???.\pI'm going to be\nthe world's great-\lest [POKé]MON\ltrainer.\e


#org 0x120961
= [.]\pMy name's ???.\pI'm going to be\nthe world's great-\lest [POKé]MON\ltrainer.\e


#org 0x120599
M step_left step_left step_left step_left step_left end

#org 0x12059F
M halfstep2_down look_up end

#org 0x1205A5
M halfstep2_left halfstep2_left halfstep2_left halfstep2_left halfstep2_up halfstep2_up halfstep2_left halfstep2_left end

Offline

#9 2012-12-04 06:31:36

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 2,006/3,460

Re: Quick script question

OK, it seems as though PKSV's compiler is having issues finding free space that is actually free.

When I entered your first code, it entered the text in an area that didn't have enough room, and the movement data was entered in the middle of the text that had already been written. Bugs like this are the reason it took me a long time to ever even want to use PKSV.

Since that doesn't seem to be working, I went ahead and found some free space for you. If you change the first ":text" to "0x65B0" and the second one to "#org 0x1225B0" it should work then (And by should, I mean I did a test compile and it worked for me). And you can use that same location for the top and bottom scripts, since the original script had both triggers call the same text anyway.

pokemongoldu.png
You should move that word to the next line so it doesn't overlap the border.

pokemongold1.png
No garbage showing up in the text this way.

Last edited by Mateo (2012-12-04 06:40:55)

Offline

#10 2012-12-04 18:47:50

delpo
Member
Registered: 2012-11-26
Post 15/40

Re: Quick script question

Thanks for clarifying that!  So should I generally not use dynamic offsets with PKSV then?

Offline

#11 2012-12-04 19:35:11

Miksy91
Member
Registered: 2010-10-16
Post 1,294/2,306

Re: Quick script question

delpo wrote:

Thanks for clarifying that!  So should I generally not use dynamic offsets with PKSV then?

Personally, I don't recommend using dynamic offsets because by doing everything yourself, you can keep track of what's happening inside the rom and know that no glitches come up (and even while doing this, you should create lots of backups).

It's easy to repoint data that way as well and what's more, that way you won't end up leaving unused text/script/... data in other sections in the rom.
By repointing text data with dynamic pointers, the same text data (with your additions to it) is copied elsewhere but the original text data stays in its original location as well which is not such a good thing.

Last edited by Miksy91 (2012-12-04 19:37:57)

Offline

Board footer

Powered by FluxBB