Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 1970-01-01 00:33:30

Miksy91
Member
Registered: 2010-10-16
Post 119/2,311

Scripting problems

I understand the most of the basics but can't still make this work.
I'm trying to make a new script for Hiro's mom.

Here is the event data for Hiro's room (downstairs):
$181B89 (60:5B89)

I made a new (not-working) script to offset 182667.
It's supposed to make Hiro's mom give lv7 Eevee with a Berry for him.
It's here:
6A 47 4C 1A 17 54 2D 85 07 AD 00 53 49 90

I'm pretty sure pointer 1A 17 is wrong but I'm not sure.
The text she says is located in 18171A.

So, I've got two problems here.
I don't know if 1A 17 is pointed wrong or not but the next problem is to change the pointer for the script itself.

As I said in the other thread, I can't use pointer calculator because I've 64 bit Vista which pretty much sucks when making hacks.

I checked Mateo's tutorial about adding new events to maps and understand how to change where event data points to.
I just have to know the pointer for 182667, that's all (also, sometime before I saw how to calculate to the pointer without any pointer calculators but didn't really understand it).

Offline

#2 1970-01-01 00:33:30

Tauwasser
Member
Registered: 2010-10-16
Post 33/448

Re: Scripting problems

Pointers can be easily calculated in your head. Also, there is obviously Windows Calculator, which you could use.
You already have the proper address 60:5B89. You will notice that the pointer part is between 0x4000 and 0x7FFF (inclusive). Your pointer 0x171A points to Rom bank 0x00. If you modify it to be 0x571A (0x4000 + 0x171A), you will actually point to your text in the current bank 0x60.

The rest of your script looks correct.

cYa,

Tauwasser

Offline

#3 1970-01-01 00:33:30

Miksy91
Member
Registered: 2010-10-16
Post 120/2,311

Re: Scripting problems

Okay, so now I changed 1A 17 part to 57 1A.
Also, what should I have done if for example 80B9 was in 5B89's place ?

But I still don't know how to calculate the pointers myself as you never explained how to, furthermore Google didn't really help me out.

Offline

#4 1970-01-01 00:33:30

Tauwasser
Member
Registered: 2010-10-16
Post 35/448

Re: Scripting problems

60:80B9 technically points to VRAM bank 0, address 0x80B9.

In all but a few very early gameboy games (that use a different memory controller), rom banks are mapped as follows:

Rom bank 0x00 is mapped to 0x00 thru 0x3FFF (inclusive).
All other rombanks are switched in from 0x4000 thru 0x7FFF (inclusive). After that is VRAM, WRAM, OAM and some control registers.

This is why all pointers that point inside of the ROM have to be between 0x4000 and 0x7FFF (inclusive).

Now, your question is probably, if you were in the next bank, what would your pointers look like?

Bank 0x61 is from 0x61 * 0x4000 = 0x184000 thru 0x62*4000 = 0x188000 (exclusive).

So offset 0x185678 for instance is 61:5678, while offset 18ABCD is 62:6BCD. Notice this address notation contains rombank + DELIMITER + pointer, where delimiter is ":".

So basically, for any offset:

Pointer = (Offset Mod 0x4000) + 0x4000
Bank = Offset  0x4000

If bank == 0x00 after that, pointer -= 0x4000 (subtract 0x4000 from the pointer).
While technically you would expect the gb to map rom bank 0x00 when requested, some docs say it actually maps rom bank 0x01 regardless.

cYa,

Tauwasser

Offline

#5 1970-01-01 00:33:30

Miksy91
Member
Registered: 2010-10-16
Post 121/2,311

Re: Scripting problems

I got the rom completely messed up by changing 895B to 6766 and realized what was the problem. So, I don't want to change either the event data or the pointer for it.

Anyway, is the script for mom walking towards you and giving you Pokegear located in the event data ?
I couldn't find any moving script there (68 xx + 2b) (what's 2b anyway).
Or, is there a pointer there too which tells the game where her script is located ?
If so, does event data only tell the rom how many warps, triggers, signposts and people are in the map ?

Sorry if I bother you with so many questions but it's just that I need help learning this.

Offline

#6 1970-01-01 00:33:30

Tauwasser
Member
Registered: 2010-10-16
Post 36/448

Re: Scripting problems

I got the rom completely messed up by changing 895B to 6766 and realized what was the problem. So, I don't want to change either the event data or the pointer for it.

You can't be afraid of everything. Make mistakes and learn from them. Touch and change pointers until they become natural to you and tinker with the data.


Anyway, is the script for mom walking towards you and giving you Pokegear located in the event data ?

No, why would it? It's not an event like a signpost or a person or warp! It's a script and as such not an event!


I couldn't find any moving script there (68 xx + 2b) (what's 2b anyway).

2b means 2-byte pointer. So this is 68 xx ll hh where hl is the pointer and xx is some value (for 68 it's the person number).


Or, is there a pointer there too which tells the game where her script is located ?

Usually, there is a pointer for every people event (person), every signpost and every trigger event that all point to a script.

However, the script you're looking at is not activated by

  • stepping on a trigger

  • talking to a person/signpost

  • coming in the range of a trainer people event

The logical conclusion from that is, that the script you're looking for is not referenced in the event data, because no event is activating it, as we just saw in the list.
Where else could it be? Take my scripting doc and read up on script headers. Script headers can be used for events that perform once you enter a map, e.g. for the first time, after a certain event has happened etc.

Basically, there are two different parts of the script header that both perform different things, which you will both find explained in much more detail in my doc.
Basically, the script you're referring to is referenced in there. It's a one-time event and will happen once you enter the map.
This is the same as the professor giving you your Pokémon or the Cop asking you the red-haired kid's name. They're both one-time events that are activated through a trigger number (the same that trigger events use).
You can pretty much go from there, I think and figure out which script it is. All trigger numbers are set to 0x00 at the game's start with a few exceptions I documented somewhere...


If so, does event data only tell the rom how many warps, triggers, signposts and people are in the map ?

Exactly. Just as described in my scripting doc, this is what event data is! However, it doesn't only tell how many of each there are, but also what properties each has (location, picture, script pointer etc.)

Offline

#7 1970-01-01 00:33:30

Miksy91
Member
Registered: 2010-10-16
Post 122/2,311

Re: Scripting problems

I'm going to skip that for now but I'll come back to it later when I'm more used to this (I read it but didn't really understand even how to find the script header...)

Still one thing though:
Here is the secondary map header address: $09649D (25:649D)

$09649D: 00 04 05 2A 9B 76 60 40 56 89 5B 00

So banks (2A & 60) with their pointers (9B 76 & 89 5B) determine where Map & Event data are located in the rom.
What's the use of "40 56" ?

So I guess that bank 25 along with 9D 64 point where the Secondary Map Header is.
Are the scripts for all the events of that map located where the pointer 9D 64 (and bank 25) is (expect the one in script header) ?

Offline

#8 1970-01-01 00:33:30

Tauwasser
Member
Registered: 2010-10-16
Post 37/448

Re: Scripting problems


So banks (2A & 60) with their pointers (9B 76 & 89 5B) determine where Map & Event data are located in the rom.
What's the use of "40 56" ?

That's the pointer to the script header. 0x60 is the rom bank for both, events and script header.


So I guess that bank 25 along with 9D 64 point where the Secondary Map Header is.

Correct, as you gave this offset above.


Are the scripts for all the events of that map located where the pointer 9D 64 (and bank 25) is (expect the one in script header) ?

No, they are usually located as follows:

Script header pointer points to the script header. And event pointer points to events.
Events and script header have 2byte pointers to their scripts. From there on, technically, you could call a script from a different rom bank. However, most scripts do not do this and simply are in the script header/event bank.
Their location is determined by the fact that at least some bits of the script have to be located in that bank, because events cannot directly point to scripts outside of their banks ― except by calling another script in another bank out of their own script that is definitely located in the same bank as events/script header are.

cYa,

Tauwasser

Offline

#9 1970-01-01 00:33:30

Miksy91
Member
Registered: 2010-10-16
Post 123/2,311

Re: Scripting problems

So, in the Event Data I can find the properties of the events along 2 byte pointers to their scripts. Am I right with this one now ?

Actually, is that 2 byte pointer the "Text Block" & "Text Bank" which GoldMap shows in the properties of the event ? So, as text block & text bank for Mom are: 203 86 is the 2 byte pointer for her talking script CB 56 ?

Offline

#10 1970-01-01 00:33:30

34/701

Re: Scripting problems


So, in the Event Data I can find the properties of the events along 2 byte pointers to their scripts. Am I right with this one now ?

Actually, is that 2 byte pointer the "Text Block" & "Text Bank" which GoldMap shows in the properties of the event ? So, as text block & text bank for Mom are: 203 86 is the 2 byte pointer for her talking script CB 56 ?

Yes, GoldMap labels that incorrectly.

#11 1970-01-01 00:33:30

Miksy91
Member
Registered: 2010-10-16
Post 124/2,311

Re: Scripting problems

Ok, I didn't really get it where does CB 56 point to...
Anyway, I'll take a break for a couple of days from hacking and will be back in the next week (going to visit some relatives & friends).

Offline

#12 1970-01-01 00:33:30

Miksy91
Member
Registered: 2010-10-16
Post 128/2,311

Re: Scripting problems

I'm trying to do this again and I made another script but this one doesn't work either.

It's like this:
6A 47 4C D7 42 54 56 F0 84 F0 00 47 4C B0 42 53 49 90

It works fine until it starts to load the picture of the pokemon that should be shown.
Am I missing something between 42 and 54 ?

Also, I'm not really sure if it should "Close text box" before it shows the pokemon picture or not.

Offline

#13 1970-01-01 00:33:30

Tauwasser
Member
Registered: 2010-10-16
Post 39/448

Re: Scripting problems

Look at my doc. What you're doing doesn't add up.

Command 0x56 doesn't take another byte. Instead, it is used to close the box that command 0x55 creates.

So your script will try to interpret the first occurrence of 0xF0 as a script code and do something undefined.

cYa,

Tauwasser

Offline

#14 1970-01-01 00:33:30

Miksy91
Member
Registered: 2010-10-16
Post 130/2,311

Re: Scripting problems

Thanks for the help, I'm going to give you some credit too  :D

Also, I'm going to edit the Pokegear script soon...

EDIT:
I tried to edit the script in script header in which you get Pokegear and successed to do so but the problem is that it can't load movesprites and the script won't end like it usually would.
Instead, NPC keeps talking the same things over and over again...

Offline

#15 1970-01-01 00:33:30

Tauwasser
Member
Registered: 2010-10-16
Post 40/448

Re: Scripting problems

You will need to deactivate it by activating another trigger that does nothing (usually 0x14 0x01 will suffice for a script executed on first entering the map). Also, make sure the map id is in the table at 25:4000 (GS) and assigned a proper ram slot. If not, the asm is actually buggy and will return the wrong entry in that list.

Also, make sure you choose the proper stage to implement this script. Usually, scripts will use 0x05 or 0x07 IIRC.

cYa,

Tauwasser

Offline

#16 1970-01-01 00:33:30

Miksy91
Member
Registered: 2010-10-16
Post 131/2,311

Re: Scripting problems

There was nothing wrong with the script but supposedly I removed necessary data from it and that's why it got messed up, and it's fixed now.

But now I'd like to make it so that a person would give the hero an item but the code doesn't seem to work.

I tried both 1FXXYY & 55861FXXYY but neither of them worked.
The first (1F2E03) didn't do anything (it should have given hero 3 Fresh Waters) and the other one (55861F2E03) showed Vaporeon's picture...

Offline

#17 1970-01-01 00:33:30

tekcoR
Member
From: Celadon City
Registered: 2010-10-16
Post 19/165

Re: Scripting problems

Actually, 1F2E03 should work, the only thing still to be needed is a pointer for a "X received Y"-Message. Maybe you forgot to control your pack? The fresh water should be there.

55861FXXYY works correct too, 0x55 = Show Pokemon and 0x86 = 134, Vaporeons byte. I don't know what your purpose with 5586 was.


Cya

Offline

#18 1970-01-01 00:33:30

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 275/3,492

Re: Scripting problems

also you can use x9D instead of x1F for it to automatically say what pocket you put it in

Offline

#19 1970-01-01 00:33:30

Miksy91
Member
Registered: 2010-10-16
Post 132/2,311

Re: Scripting problems

I'll try it again (and edit this post if I fail).
Oh, they did appear in my bag.
I'll just try to input the Hiro Received -message.

Also, 5568XXYY:
http://interdpth.arc-nova.org/M3IEX/ind … gsc-script

Offline

#20 1970-01-01 00:33:30

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 276/3,492

Re: Scripting problems

Wow, that is one inaccurate list of scripting commands (or should I say "commandos"). I'd wager that they were all found by guessing what things did, and several are either off or completely wrong. For example, the yes no code description is wrong. You would do much better to just use the application examples in the compendium without letting that stuff distract you.

Offline

#21 1970-01-01 00:33:30

Miksy91
Member
Registered: 2010-10-16
Post 137/2,311

Re: Scripting problems

I found out that the rom loads elsewhere than from the actual script of the person the data that the person who challenges you is a trainer. I made one person point to an offset which is filled with 00 but still a battle started with a lv0 Tileset number 0.

So does anyone know where do the people load that script ?

The point of changing the script is to make one person a mini-boss who would only challenge you if you answer Yes to a certain question. I also tried to make the actual script to point to another script but it didn't work for some reason, it did actually nothing.

Offline

#22 1970-01-01 00:33:30

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 281/3,492

Re: Scripting problems

Okay, the person data has a byte that determines the colour AND whether it is a normal person, an item ball, or a trainer. If it is a trainer, it points to a different format than a normal script. It's all in the compendium, closer to the bottom where it lists event structures.

Offline

#23 1970-01-01 00:33:30

Miksy91
Member
Registered: 2010-10-16
Post 139/2,311

Re: Scripting problems

Okay, that really helped me a lot but now I'm stuck with another problem (if you dare, you could try to check this offset for me too).

I found the person data but what I found in there didn't make any sense.
It lacks the Function data, it's just nowhere to be found :S
Also, does this happen to have something do with it if I said the person gives you his phone number after he beats you ?

Here is his offset:
1354f6

*Also, that 02 after colour is just his "Range of sight" -byte.

Offline

#24 1970-01-01 00:33:30

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 282/3,492

Re: Scripting problems

colour and function are determined by the same byte.

Offline

#25 1970-01-01 00:33:30

Miksy91
Member
Registered: 2010-10-16
Post 140/2,311

Re: Scripting problems

Okay, now it makes more sense.
Anyway, that byte was originally B2 so does it mean that colour is like B0 and it also tells the person is a trainer (02) ?

So, if I change it to 80 instead (80 + 00), does it point to a regular script then ?

Offline

Board footer

Powered by FluxBB