Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2012-08-26 06:08:42

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 6/98

Pokemon Gold Learning Scripting - Need some clarification

Back again. This time I'm trying to learn how scripts work in Pokemon Gold. Right now I'm using Johto Map, PKSV, and my trusty HEX Editor.

So I'm looking at Elm's script right now in PKSV.

#org 0x180033
'-----------------------------------
faceplayer
loadfont
checkbit1 0x24
if true 0x4041 ' 0x180041
checkbit1 0x44
if true 0x427B ' 0x18027B
checkbit1 0x7C
if true 0x404D ' 0x18004D
checkbit2 0x21
if true 0x4268 ' 0x180268
checkbit1 0x56
if true 0x4262 ' 0x180262
checkbit1 0x55
if true 0x424F ' 0x18024F
checkbit1 0x77
if false 0x4088 ' 0x180088
loadvar 0xAF
special 0x42
if true 0x423A ' 0x18023A
loadvar 0xB0
special 0x42
if true 0x423A ' 0x18023A
2writetext 0x4BF6 ' 0x180BF6
closetext
loadmovesprites
end

Now I want to be clear on what is actually happening here before I start my own scripting. Correct me if I'm wrong on any of this.

1.) The script data starts at offset 0x180033

2.) Faceplayer simply tells Elm to face you if you talk to him from a different position than his face.

3.) Loadfont "Loads the font into the ram and opens a text box." Does this tell the game to create a text box in the game's RAM, and continuously load the text into it based off of different commands in the script? If so is this beneficial in some way?

4.) checkbit1 0x24 "Checks whether a bit of BitTable1 has the value 0 or 1." Now here is when I'm getting confused. I think this means the game is going to bit table 1, and 0x24 is the pointer (in my HEX editor it reads 31 24 00) to which bit in that table it need to check. In this case is 24 00 the pointer to which bit is being checked?

If this bit is a 1 then the scripts moves to the next line of code "if true 0x427B ' 0x18027B" which is a pointer to offset 18027B and the script continues with what code is written there.

If that bit is a 0 then the script moves to this line of code "checkbit1 0x44" and continues from there.

Am I following this correctly? If not can you correct me and put me back in the right path?

Once I'm set straight on this part of the script I'm sure I'll have plenty more questions in this thread for the changes I plan on making, so please bear with me. :)

Offline

#2 2012-08-26 06:46:20

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

Re: Pokemon Gold Learning Scripting - Need some clarification

What this is doing is checking if different flags are on to determine which script he should run. So if none of them are on, he says his first thing. If you've got your pokemon he says another, if the egg has hatched, etc. So yes, you are correct that it checks the bit and either jumps or continues to the next line depending on whether that flag is set or not.

Offline

#3 2012-08-26 06:55:27

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

Re: Pokemon Gold Learning Scripting - Need some clarification

You've got most of the things right.

theoblivinator wrote:

3.) Loadfont "Loads the font into the ram and opens a text box." Does this tell the game to create a text box in the game's RAM, and continuously load the text into it based off of different commands in the script? If so is this beneficial in some way?

Yes, it creates a text box and continuously loads text into it until it's closed (and moving sprites are loaded). Not really, you won't have to know where all this is stored, I haven't taken a look at it either.

theoblivinator wrote:

4.) checkbit1 0x24 "Checks whether a bit of BitTable1 has the value 0 or 1." Now here is when I'm getting confused. I think this means the game is going to bit table 1, and 0x24 is the pointer (in my HEX editor it reads 31 24 00) to which bit in that table it need to check. In this case is 24 00 the pointer to which bit is being checked?

This is where you were wrong though. The command itself (something not that useful information as you're getting it right but whatever) checks the bit value of a certain bit (24 00) and writes the result in RAM ($D173). If bit was 0, RAM turned into 00 and if bit was 1, RAM turned into 01.
"if true" command checks if RAM is not equal to 00 and if so, continue interpreting at the pointed offset. If RAM = 00, continue interpreting without following the pointer.

Basically, the value of bit 24 00 is checked in a bittable in ram which is located at $D7B7. The bit values from 00 00 to 07 00 (8 bits) are stored in D7B7 while 08 00 to 0F 00 in D7B8. 10 00 to 17 00 in D7B9 and so on...
Then, 24 00 is one of the bits in D7BB.

Follow here (not the best tutorial around as I've written in 1,5 years ago but yeah...): http://hax.iimarck.us/topic/238/

Offline

#4 2012-08-26 22:00:45

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 7/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Sorry but I'm still having trouble grasping the "bit checking" concepts.

So in HEX, when the game sees "31 24 00" in Elm's script, it goes and looks for bit 24 00 in the bit table and then writes the value of bit 24 00 into ram at offset $D173, either 00 or 01.

The bit table starts at offset $D7B7 and looks something like this:

D7B7 =
00
01
02
03
04
05
06
07

D7B8 =
08
09
10
0A
0B
0C
0D
0E
0F

D7B9 =
10
11
12
13
14
15
16
17

D7BA =
18
19
1A
1B
1C
1D
1E
1F

D7BB =
20
21
22
23
24
25
26
27

.... and continues.

So if I'm understanding this correctly, when the game does a checkbit1 0x24, it goes into the bit table, finds 24 00, which is the 5th bit in the byte at offset D7BB, and writes it's value into RAM, either 00 or 01.

Then the "if true" function checks the value that was written into RAM. If the value was 01 the script then follows the pointer to the next offset and continues the script from there. If the value was a 00 the script continues to the next function.

Am I right?

So another question I have, how does the tutorial that Miksy91 linked dealing with flags and pointers come into play here. As of now I see no correlation, but that's probably because I don't understand the big picture. Can someone please explain this a little more in detail?

Offline

#5 2012-08-27 04:27:24

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

Re: Pokemon Gold Learning Scripting - Need some clarification

You've got it right.

"how does the tutorial that Miksy91 linked dealing with flags and pointers come into play here"
Is this supposed to be some other tutorial that I didn't even link to this thread?
Dealing with flags/bit numbers has nothing to do with pointers.

Offline

#6 2012-08-27 05:07:27

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 8/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Yeah that's why I was confused. You had linked this tutorial: http://hax.iimarck.us/topic/238/

I was wondering what you were trying to tell me with it. But it doesn't seem like we need it right now. Haha.

Anyways moving on to my next questions.

So does the byte at D7B7 (the one containing 24) have a dynamic value, that changes based off of which bits it consists of are set to 00 or 01.

Since the byte at D7B7 consists of 20, 21, 22, 23, 24, 25, 26, 27 and say hypothetically that bits 20, 22, 24, and 26 were all set to 01 while the others were 00 would the value of D7B7 in this case equal to 55 in hex, 85 in dec, or 01010101 in binary?

Then later in the game if bit 21 was then set to 01 would the value of D7B7 change to equal 57 in hex, 87 in dec, or 01010111?

What event would set bit 24 00 to a 01 then (obviously it has something to do with Prof. Elm)? Are these mapped somewhere for reference or are the normal figured out through trial and error?

Offline

#7 2012-08-27 07:03:40

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

Re: Pokemon Gold Learning Scripting - Need some clarification

You've got everything right here (properly said, bit values can't be 00 and 01 but whatever).

theoblivinator wrote:

What event would set bit 24 00 to a 01 then (obviously it has something to do with Prof. Elm)? Are these mapped somewhere for reference or are the normal figured out through trial and error?

If you follow Elm's script in situation when bit 24 00 is not set, you can easily find out in which situation it is set.

#org 0x180033
'-----------------------------------
faceplayer
loadfont
checkbit1 0x24
if true 0x4041 ' 0x180041
checkbit1 0x44
if true 0x427B ' 0x18027B
....

#org 0x18027B
'-----------------------------------
2writetext 0x4FA4 ' 0x180FA4
keeptextopen
verbosegiveitem RARECANDY 1
setbit1 0x24
2writetext 0x5020 ' 0x181020
closetext
loadmovesprites
end

#org 0x180FA4
= ELM: [PLAYER]!\nThere you are!\pI called because I\nhave something for\lyou.\pSee? It's an\nS.S.TICKET.\pNow you can catch\n[POKé]MON in KANTO.\e


#org 0x181020
= The ship departs\nfrom OLIVINE CITY.\pBut you knew that\nalready, [PLAYER].\pAfter all, you've\ntraveled all over\lwith your [POKé]MON.\pGive my regards to\nPROF.OAK in KANTO!\e

Also as you can see here, it's logical to make bit 24 00 to be set in the situation when bit 44 00 is set (which I would believe happens when you beat Lance). And the reason why it says "RARECANDY" instead of "S.S.TICKET" is the fact that PKSV is made to work better with FRLG/RSE and Rare Candy's item byte (or word) probably matches with S.S. Ticket of G/S/C.

Last edited by Miksy91 (2012-08-27 07:07:38)

Offline

#8 2012-08-27 07:25:41

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 9/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Miksy91 wrote:

You've got everything right here (properly said, bit values can't be 00 and 01 but whatever).

Okay cool, I think I'm starting to understand this more and more every time I look at it. What do you mean that bit values can't either be 00 or 01? With my knowledge of general programming and electronics a bit is either on or off, 0 or 1, true or false. When you say bit values are you referring to something different? Could you explain a little more in detail?

Miksy91 wrote:

Also as you can see here, it's logical to make bit 24 00 to be set in the situation when bit 44 00 is set (which I would believe happens when you beat Lance). And the reason why it says "RARECANDY" instead of "S.S.TICKET" is the fact that PKSV is made to work better with FRLG/RSE and Rare Candy's item byte (or word) probably matches with S.S. Ticket of G/S/C

Okay, so it is just a matter of going through the scripts manually and figuring out when bits are set and what not. There isn't a table that someone has created that shows them all in order?

I'm asking because if I start my own scripts and want to add flags and set bits, it would be handy to check a table and see if the bit I want to use if free or if it is used by something else.

Offline

#9 2012-08-27 09:46:30

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

Re: Pokemon Gold Learning Scripting - Need some clarification

If you're going to create a new game from scratch, you can check what the table starting at D7B7 looks like and use all the bit values that aren't set at the start (some values are set, for example the one that makes Guide Gent hidden in his house before letting him introduce Cherrygrove City to you).
Koolboyman has created a list of flags used in different situations of the game but I don't know how many of the used flags are included in it. This has been linked to the thread kkj1116 made just a while ago I believe (links thread).

theoblivinator wrote:

What do you mean that bit values can't either be 00 or 01? With my knowledge of general programming and electronics a bit is either on or off, 0 or 1, true or false. When you say bit values are you referring to something different? Could you explain a little more in detail?

You said it here yourself. Byte value of 00 states that the 8 bits forming that byte are all unset and 01 that the first one is set and rest unset. The values of a bit can only be 0 or 1.

Last edited by Miksy91 (2012-08-27 09:50:03)

Offline

#10 2012-08-27 16:38:55

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 10/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Miksy91 wrote:

You said it here yourself. Byte value of 00 states that the 8 bits forming that byte are all unset and 01 that the first one is set and rest unset. The values of a bit can only be 0 or 1.

So for instance (perhaps I was being to complicated in my earlier post) if the byte at $D7BB = 00 then that would mean that the eight bits that make it up (20 , 21 , 22 , 23 , 24 , 25 , 26 , 27) are all 0 too.

Now if bits 20 , 21 , 22 , 23 were set to 1, then wouldn't the byte at $D7BB = 0F in hex, 15 in decimal, and 00001111 in binary?

I'm asking because I'm thinking of adding a lot of events to my hack. For instance the first one I want to create is after you get your first Pokemon from Elm and leave the lab, Lance will approach you and talk to you.

If I'm understanding correctly, I'll need a new trigger event and a new people event for this. The trigger event can only occur after you've gotten your first Pokemon, so I'll need to use the checkbit1 function to check the bit to see if you've gotten your first Pokemon and make sure the event hasn't happened before, then use the setbit1 function to set a bit (the one checked in the first place) and prevent the entire script from happening every time you leave the lab.

Offline

#11 2012-08-27 18:22:09

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

Re: Pokemon Gold Learning Scripting - Need some clarification

theoblivinator wrote:

I'm asking because I'm thinking of adding a lot of events to my hack. For instance the first one I want to create is after you get your first Pokemon from Elm and leave the lab, Lance will approach you and talk to you.

If I'm understanding correctly, I'll need a new trigger event and a new people event for this. The trigger event can only occur after you've gotten your first Pokemon, so I'll need to use the checkbit1 function to check the bit to see if you've gotten your first Pokemon and make sure the event hasn't happened before, then use the setbit1 function to set a bit (the one checked in the first place) and prevent the entire script from happening every time you leave the lab.

You could always make it so that every event uses a new bit flag.

Anyway, you don't need to make it this way. Trigger events are activated according to the value (byte) in trigger table in $D6B7. The trigger flag for New Bark Town (outside) is set to 01 after getting your first pokemon so you just have to create a certain trigger event that will occur if the byte value in the table is 01. Then set it to 02 during the script when meeting Lance.

Last edited by Miksy91 (2012-08-27 18:23:07)

Offline

#12 2012-08-27 20:01:50

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 11/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Okay, I think I have a better idea of how I'm going to do it, but it will still take me some trial and error like always. Thanks for your help and being patient with me while I learn this stuff. :)

Just to clarify:

theoblivinator wrote:

So for instance (perhaps I was being to complicated in my earlier post) if the byte at $D7BB = 00 then that would mean that the eight bits that make it up (20 , 21 , 22 , 23 , 24 , 25 , 26 , 27) are all 0 too.

Now if bits 20 , 21 , 22 , 23 were set to 1, then wouldn't the byte at $D7BB = 0F in hex, 15 in decimal, and 00001111 in binary?

Am I right about this part?

Offline

#13 2012-08-28 06:22:01

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

Re: Pokemon Gold Learning Scripting - Need some clarification

Yeah, you're right about it. The first four bits (lower nybble? I think that's what they call them) form all the ones and the higher nybble (5th to 8th bit) all the tens.

Offline

#14 2012-08-28 20:24:59

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 13/98

Re: Pokemon Gold Learning Scripting - Need some clarification

So I'm starting to add my event to the map. I added another trigger event and another person to the map. Again what I want to happen is after you get your first Pokemon and leave Elm's lab, Lance will approach you and talk to your character. I placed Lance where I want him to appear, it's be the exit of the town, and he will walk to the right and then up to reach your character standing at the exit of the lab.

Now I'm getting overwhelmed here, and I'm confused as to what it looks like in PKSV or HEX.

How do you exactly set up a trigger event in Johto Map? I was looking at the trigger event in Cherrygrove city, when you exit the city your rival appears and fights you. I believe my trigger would work like that. But I can't seem to find any similarities to that and what Miksy91 said about trigger tables.

I guess I thought I knew what was going on but I got lost again. Are there any tutorials about adding trigger events to a map out there?

I don't want to have someone completely write my script for me but could someone maybe start it off and explain it a little bit how it would look like in PKSV?

I just don't know where to start really.

Offline

#15 2012-08-28 21:07:26

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

Re: Pokemon Gold Learning Scripting - Need some clarification

Well...
You've got two options:
1) Make the event run when the map is entered through a warp
2) Make the event run when you step on a certain tile on the map

If you place a trigger event in front of the door tile, I'm not quite sure whether the script will be run or not because the game is still executing code what happens when you arrive from a warp and are placed on a door tile (walk step down). If this doesn't work, you've to call the script from the script header or put a couple of trigger events in the map that you can't skip and call a different kind of movement for Lance through them.
I suggest doing it the first and a little bit more difficult way though.

#1 Info

First, you'd have to re-write a part of the map's script header.
In offset 0x120000 (Map's script), you can see the following.
I put that "/" there so you'll see where the border between script header's First and Second part is located.

02 0D 40 00 00 0E 40 00 00 / 01 05 0F 40

$12000D
end (90)

$12000E
end (90)

$12000F
setbit2 0x40 (36 40 00)
clearbit1 0x76 (32 76 00)
return (8F)

This is basically what the script header and additional scripts (that are executed when the map is loaded) look like. Tauwasser's scripting compendium explains what First and Second part are used for. Simply, when the trigger flag of this map is set to 00, the game looks for the additional script through pointer 0D 40 leading to script: "end". Same goes for value 01 (0E 40 leading to $12000E: "end").
Second part has a purpose related to flying data yet I didn't bother checking why bit 76 00 from table 1 is cleared during the map loading. Has probably something to do with Mom's script, Your own room or Elm's script.

Anyway, what you want to do is to call a different type of script when the value in the trigger table is 01 so repoint the script data (0E 40) to blank space and write your script there. In the end of the script, put in command (dotrigger 0x2 / 14 02) for changing the trigger flag to 02. You don't have to worry about not having an additional pointer pointing to "end" when the map is entered and the value in the table is 02 though.

The new script pointer (replaced with 0E 40) may have to lead to this kind of structure: http://hax.iimarck.us/files/scriptingco … tm#Marke8C

@Script
8C [2-byte pointer (leading to Subscript)] 90

@Subscript
...
14 02
90
theoblivinator wrote:

I don't want to have someone completely write my script for me but could someone maybe start it off and explain it a little bit how it would look like in PKSV?

Subscript could for example look like this.

(disappear 0x5 + moveperson 0x5 @x @y)
appear 0x5
applymovement 0x5 @walk to you
loadfont
2writetext @text
closetext
loadmovesprites
dotrigger 0x2
applymovement 0x5 @walk away
disappear 0x5
end

Hopefully I didn't write too much... That's how it would go if you're planning to keep it as simple as possible but try adding some additional music that's played during the script, changing music back to normal after Lance leaves etc. Pretty much, what ever you want to include in it.

Last edited by Miksy91 (2012-08-28 21:23:28)

Offline

#16 2012-09-02 05:25:18

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 14/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Miksy91 I would hug you if I had the chance. Thank you for your great help! Now I'm going to pester you again if you don't mind (or anyone else if they can help).

So my script event works great except for one thing. I need to know how to hide Lance until I want him to appear in the script. Here is what my map looks like currently.

whatdo.png

The problem is that Lance is always visible when playing the game, and I have no idea how to make him hidden until I need him for the script I created.

Can you help me at all?

Last edited by theoblivinator (2012-09-02 05:25:57)

Offline

#17 2012-09-02 05:32:26

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

Re: Pokemon Gold Learning Scripting - Need some clarification

There is a flag set the first time the player comes downstairs and gets the Pokegear. If you set his flag to match that, he will always be hidden. So you will just show him when you want him to be shown, and hide him again afterwards with the commands, and he will stay hidden the rest of the time.

Offline

#18 2012-09-02 07:06:16

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

Re: Pokemon Gold Learning Scripting - Need some clarification

Yeah, do it like Mateo said.
Here is an alternative way how to do it which doesn't check any flag numbers (I sometimes use it so save flags in Dark Future).

Call another script from Map's Script Header

@script
checktriggers (13)
if = 0x1 @hide (06 01 xx yy)
return (8F)

@hide
disappear 0x5 (6D 05)
return (8F)

But in your case as you only want to make that guy appear and disappear during the same script, you can use any flag number that is always set when you "hit that spot" in the game. As a sidenote, when a person is made to appear, its flag number is cleared and when made to disappear, that flag number is set again.


P.S
kkj1116, if you're reading this, I'd recommend adding it to the Global FAQ & Questions thread as scripting examples.

Last edited by Miksy91 (2012-09-02 07:10:44)

Offline

#19 2012-09-02 18:51:17

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 15/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Thanks again for the help everyone. Since I'm still confused about how to to use flags I ended up using Misky91's script again, but I had to make a few changes for it to work.

@script
checktriggers (13)
if = 0x0 @hide (06 01 xx yy)
end (90)

@hide
disappear 0x5 (6D 05)
end (90)

I had the script check for trigger 0x0 instead of 0x1 because that is what trigger is set when you are starting the game after leaving your house but before getting your first Pokemon from Elm. Also I changed the 8F's (Return) to 90's (End). Not sure why I had to do that but when I used 8F my game would crash. I think it is because 8F is used for scripts in the second part of the map's script header, and mine was in the first.

For the sake of learning and perhaps needing to use them in the future could someone give me a little more information on how Flags work?

Off the bat I think this is what we were discussing in the beginning of the thread. Flags are set using the setbit1 or setbit2 function right? And then is it a matter of linking up the "setbit" to the flag bit under the person in Johto map? What exactly is the Flag index used for then? A little help clearing up my confusion would be great.

Offline

#20 2012-09-02 19:46:16

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

Re: Pokemon Gold Learning Scripting - Need some clarification

The "Flag Index" of Johtomap presents the first 8-bits (or first byte) of the flag number and "Flag Bit" the last 8-bits.

It would be clearer if they would be fitted in one box just like is done with "Script" but it works fine right now too.
And yeah, 8F is a command used for ending scripts of the second part and 90 for the first part including "normal" scripts.

Offline

#21 2012-09-02 20:03:45

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 16/98

Re: Pokemon Gold Learning Scripting - Need some clarification

So is it just a matter of going through scripts to find which flags are set?

For instance in the script that gives your your Pokegear. (I think this is it)

org 0x18164F
'-----------------------------------
applymovement 0x0 0x570F ' 0x18170F
playmusic 0x4E
spriteface 0x2 0x1
showemote 0x0 0x2 0xF
applymovement 0x2 0x5711 ' 0x181711
loadfont
2writetext 0x5719 ' 0x181719
keeptextopen
stringtotext 0x56C1 0x1 ' 0x1816C1
2call 0x56C7 ' 0x1816C7
setbit2 0x4
setbit2 0x2
givephonenumber 0x1
dotrigger 0x1
setbit1 0x6C7
clearbit1 0x6C8
2writetext 0x57D2 ' 0x1817D2
keeptextopen
special 0x25
2writetext 0x5857 ' 0x181857
yesorno
if false 0x5695 ' 0x181695
special 0x6C
yesorno
if false 0x5684 ' 0x181684
2jump 0x569C ' 0x18169C

I think "setbit2 0x4" and "setbit2 0x2" are the flags that are set when you get your Pokegear.

In the Scripting Compendium and bit 4 = Pokegear and Bit 2 = Phone module. So these two bits in that bit table are set to 1 to tell the game you have received your Pokegear and it has the Phone on it.

So I know I'm dealing with bit 4 here, but how does bit 4 come into play with the flags, specifically the Flag Index and the Flag Bit?

Offline

#22 2012-09-02 20:06:38

509/701

Re: Pokemon Gold Learning Scripting - Need some clarification

theoblivinator wrote:

So is it just a matter of going through scripts to find which flags are set?

For the most part, yes. There are some bits that are set through ASM, though (mostly in table 2).

theoblivinator wrote:

I think "setbit2 0x4" and "setbit2 0x2" are the flags that are set when you get your Pokegear.

In the Scripting Compendium and bit 4 = Pokegear and Bit 2 = Phone module. So these two bits in that bit table are set to 1 to tell the game you have received your Pokegear and it has the Phone on it.

So I know I'm dealing with bit 4 here, but how does bit 4 come into play with the flags, specifically the Flag Index and the Flag Bit?

The bit number (4) is a 16‐bit value (0x0004). From what Miksy said before, Johtomap wrongly presents this as two 8‐bit values. The flag index would be 00 (the upper 8 bits) and the flag bit would be 04 (the lower 8 bits).

#23 2012-09-02 22:18:56

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 17/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Wow, it looks like I have a habit of over-complicating things. Thanks for clearing that up, I think I understand it now. And generally the bit tables are global in nature then correct?

Another question then, the bit table is a fixed length right? Looking on the compendium the max length of bit table 2 is 5C. Is it possible to change the length of that table if I wanted to make my own bits that didn't interfere with any others? Or would that be rather complicated?

Offline

#24 2012-09-02 22:43:58

510/701

Re: Pokemon Gold Learning Scripting - Need some clarification

theoblivinator wrote:

Another question then, the bit table is a fixed length right? Looking on the compendium the max length of bit table 2 is 5C. Is it possible to change the length of that table if I wanted to make my own bits that didn't interfere with any others? Or would that be rather complicated?

Possible, yes. Complicated, yes. Since RAM is allocated at compile time, you would need to essentially “repoint” the bit table, which is a lot more trouble than repointing regular ROM data. It’s much easier to just replace bits in the table.

Table 1’s bits are almost always used in scripts, so they’re easier to replace than the ones in table 2 in general (just modify or remove the scripts referencing those bits).

#25 2012-09-03 01:30:59

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 18/98

Re: Pokemon Gold Learning Scripting - Need some clarification

So I have another question.

How does Johto Map differentiate between Bit Table 1 and Bit Table 2 regarding flags?

For instance when you receive your Pokegear, bit 4 in Bit Table 2 is set to 1.

Now in Johto Map if I give the person I created a flag bit of 4, is that going to look at Bit Table 1 or Bit Table 2? I'm asking because I did that and my character wasn't hidden. Perhaps I need to do a little more work or I'm making a simple mistake here.

Offline

Board footer

Powered by FluxBB