Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#26 2011-08-21 03:09:07

zhengwei
Member
Registered: 2011-08-18
Post 16/140

Re: pokemon GSC problem

Tauwasser wrote:

If you execute "==0x01", the scripting tool (which one?) will actually translate into "!=0x00", I think. So basically, it should be false at least for "ld [hl],$00". Try that first, and make sure. If it is still true, your mistake is somewhere else.
So this code should still work for no shiny Pokemon in your party. However, you would always execute the jump for any shiny Pokemon right now. You should make a comparison for [D173]==0x06.

cYa,

Tauwasser

My scripting tool is PKSV..........The problem still exsits.....I don't know what happened?

Offline

#27 2011-08-21 03:22:58

zhengwei
Member
Registered: 2011-08-18
Post 17/140

Re: pokemon GSC problem

My scripting code "==0x01",any value in "ld [hl],$xx"(0x00 is also including). the scripting code is true.
but changing that....the ASM code is "ld [hl],$01",only scripting code "==0x01" is true.

Last edited by zhengwei (2011-08-21 03:25:33)

Offline

#28 2011-08-21 07:23:36

zhengwei
Member
Registered: 2011-08-18
Post 18/140

Re: pokemon GSC problem

I know the problem....My scripting code is wrong.
06: When [RAM]=byte ...

07: When [RAM]<>byte ...

08: When [RAM]=0 ...

09: When [RAM]<>0 ...

0A: When [RAM]<byte ...

0B: When [RAM]>byte ...

... then go to pointed script, else resume interpreting after the pointer
Structure :
[no][2byte pointer]
When I check the value if it is 0....I use 0x08 xxyy or 0x09 xxyy(xxyy is a 2-byte pointer).But I check the value if is a specific value...How can I edit this code?
bucause the structure is the same...

Offline

#29 2011-08-21 10:57:59

zhengwei
Member
Registered: 2011-08-18
Post 19/140

Re: pokemon GSC problem

Tauwasser wrote:

What's at D3AF? I just looked in Gold and Crystal and both use other addresses for their data.

IMHO, you should go to DA2A and start looking there.

; count the number of shiny Pokémon in party

xor a,a
ld e, a  ; number of shiny Pokémon found
ld [$D005], a ; party pokemon index
ld a,$15
call $3B3A ; This will load DA2A + a (offset to DVs/EVs) to hl. So if you ever repoint the data, your code still works.

; number of times to loop = number of Pokémon in party
ld a,[$DA22]
ld d,a

or a,a ; make sure there is at least one PKMN in there, else results will be wrong.
jr z, .done

.loop\@
    push hl
    pop bc  ; pointer to Attack/Defense DV in party
    ; bankswitch
    ld a,2
    ld hl,$5052
    rst $08
    ld a, e
    adc a, $00
    ld e, a
    ld hl,$0030 ; move to the next Pokémon
    add hl,bc
    dec d
    jr nz,.loop\@

. done
    ; store to script-accessible RAM
    ld hl,$D173
    ld [hl],e
    ret

Tested it, works.

cYa,

Tauwasser


Could you paste your complete code? ASM code and scripting code...I can't find the error....I am the first touch the ASM code, so many errors can't find....

Offline

#30 2011-08-21 11:30:30

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

Re: pokemon GSC problem

You should use code 0x06 if you want to check for a certain number of shiny pokemon. You should use 09 if you want to check for any shiny pokemon.

Example:

0E .asm
06 06 .poke6
52 .msgNeed6ShinyPoke
.poke6:
52 .msgCoolYouHave6ShinyPoke

Where .asm is the 3 byte pointer to the ASM routine, .msg* point to messages.

cYa,

Tauwasser

Offline

#31 2011-08-21 11:45:45

zhengwei
Member
Registered: 2011-08-18
Post 20/140

Re: pokemon GSC problem

Tauwasser wrote:

You should use code 0x06 if you want to check for a certain number of shiny pokemon. You should use 09 if you want to check for any shiny pokemon.

Example:

0E .asm
06 06 .poke6
52 .msgNeed6ShinyPoke
.poke6:
52 .msgCoolYouHave6ShinyPoke

Where .asm is the 3 byte pointer to the ASM routine, .msg* point to messages.

cYa,

Tauwasser

My simple code can't be successful.....ASM code is simply, and scripting code is simply

Offline

#32 2011-08-21 16:21:34

zhengwei
Member
Registered: 2011-08-18
Post 21/140

Re: pokemon GSC problem

Tauwasser wrote:

You should use code 0x06 if you want to check for a certain number of shiny pokemon. You should use 09 if you want to check for any shiny pokemon.

Example:

0E .asm
06 06 .poke6
52 .msgNeed6ShinyPoke
.poke6:
52 .msgCoolYouHave6ShinyPoke

Where .asm is the 3 byte pointer to the ASM routine, .msg* point to messages.

cYa,

Tauwasser

I tests my wrong code.....The ASM code not exeucutes for unknow reasons,so that [D173] is always is 1...

Last edited by zhengwei (2011-08-21 16:25:13)

Offline

#33 2011-08-21 17:03:28

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

Re: pokemon GSC problem

So how did you call it? Are you sure your script pointer points to the right script?

cYa,

Tauwasser

Offline

#34 2011-08-21 17:22:33

zhengwei
Member
Registered: 2011-08-18
Post 22/140

Re: pokemon GSC problem

Tauwasser wrote:

You should use code 0x06 if you want to check for a certain number of shiny pokemon. You should use 09 if you want to check for any shiny pokemon.

Example:

0E .asm
06 06 .poke6
52 .msgNeed6ShinyPoke
.poke6:
52 .msgCoolYouHave6ShinyPoke

Where .asm is the 3 byte pointer to the ASM routine, .msg* point to messages.

cYa,

Tauwasser


I found the problem......I use the 3-byte pointer in wrong way because that PKSV explain the 3-byte pointer in wrong way.....

Last edited by zhengwei (2011-08-21 17:28:07)

Offline

#35 2011-08-21 18:36:46

zhengwei
Member
Registered: 2011-08-18
Post 23/140

Re: pokemon GSC problem

Tauwasser wrote:

So how did you call it? Are you sure your script pointer points to the right script?

cYa,

Tauwasser

I tests your code,that's right. It's so cool code,and useful.Thanks a lot.
And there are some statements I can't understand.could you explain them?
What's pokemon index?Why do you call "call $xxyy",what's detail?

Offline

#36 2011-08-21 19:21:29

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

Re: pokemon GSC problem

xor a,a
ld [$D005], a ; party pokemon index
ld a,$15
call $3B3A ; This will load DA2A + a (offset to DVs/EVs) to hl. So if you ever repoint the data, your code still works.

The sub-routine at 0x3B3A computes the offset of the pokemon data of the current pokemon in the party whose index is stored in 0xD005. It will also add an offset onto the start address of the data, which is read from register a in the routine.
You could compute it by hand, yes, and save some cycles. But from a programming view point, you would only have one call to a static routine which then gets translated to an actual address in the compilation process, so using this method is a little safer when you edit more aspects of the game, because it would allow you to repoint your pokemon data without the need to find each and every instance of 0xDA2A used to refer to the data, because most routines would just call 0x3B3A anyway, thus making it only one change. I only included it to show howto avoid errors such as the one made above, where the address calculated by hand was wrong because of a typo.

cYa,

Tauwasser

Offline

Board footer

Powered by FluxBB