Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Arbitrary Code Execution Discussion

8F script request - Page 1

8F script request

Posted by: 0ErrorYT
Date: 2018-02-12 15:39:41
I am looking for an 8F script that will allow me to encounter a Pokemon after x amount of steps. I've just started 8F and don't know much about code in general so help would be appreciated. I figure you have to load something into D059 but i don't have a clue on how to do the rest. Also one that disables map connections would be nice. Thanks in advance

Re: 8F script request

Posted by: Torchickens
Date: 2018-02-12 16:21:09

I am looking for an 8F script that will allow me to encounter a Pokemon after x amount of steps. I've just started 8F and don't know much about code in general so help would be appreciated. I figure you have to load something into D059 but i don't have a clue on how to do the rest. Also one that disables map connections would be nice. Thanks in advance


You're in luck as D13B is already a step counter that counts down every step.

So putting this together could involve setting D13B to your desired value and using a condition (such as (not ASM language but logic-wise) if D31B - 1 <1 , set D059 to (Pokémon). Here you could use a D13B value of 6, so 5 steps are required before it reaches 0). If I have time tomorrow will check it out for you. :)

As for map connections I'm not sure how exactly to do that but you can lock your coordinates at the same value (D361, D362) to get a similar effect where map connections never load.

Re: 8F script request

Posted by: ISSOtm
Date: 2018-02-12 16:31:57
It's not possible to disable map connections.

A setup that triggers an encounter after N steps ? That's not possible with a 8F code, you would need heavier memory editing.

Re: 8F script request

Posted by: Torchickens
Date: 2018-02-12 17:36:01

A setup that triggers an encounter after N steps ? That's not possible with a 8F code, you would need heavier memory editing.


Could you use 8F to change the map script pointer to check D13B though (with something like conditional jumps)? D13B counts down every step and we can set it to whatever we like first.

Re: 8F script request

Posted by: Couldntthinkofaname
Date: 2018-02-12 19:05:04
I'm not sure what ISSO is talking about, ofc you can use wStepCounter to encounter a Pokemon

8f
Any xany
TM50 x59 (hex:3B)
TM09 x61 (hex:3D)
Leaf Stone x38 (hex:26)
TM08 x4 (hex:04)
X Accuracy x89 (hex:59)
Elixer x119 (hex:77)
TM01 x[Any qty]

To use:

1.Enter/exit a building or room
2. Take steps that are equivalent to the hex identifier of the desired Pokemon. (e.g Mew would be 21 steps)
3. Use 8f
4. Dance

Re: 8F script request

Posted by: 0ErrorYT
Date: 2018-02-12 20:13:54

I'm not sure what ISSO is talking about, ofc you can use wStepCounter to encounter a Pokemon

8f
Any xany
TM50 x59 (hex:3B)
TM09 x61 (hex:3D)
Leaf Stone x38 (hex:26)
TM08 x4 (hex:04)
X Accuracy x89 (hex:59)
Elixer x119 (hex:77)
TM01 x[Any qty]

To use:

1.Enter/exit a building or room
2. Take steps that are equivalent to the hex identifier of the desired Pokemon. (e.g Mew would be 21 steps)
3. Use 8f
4. Dance

It works, however I want to do an early April fools joke where I walk into the grass outside Pallet Town (hence the disabling map connections) then walk around in it and encounter legendary Pokemon and using 8F is too obvious. I should of said that before, but it's a cool script, so thanks.

Re: 8F script request

Posted by: Couldntthinkofaname
Date: 2018-02-12 20:47:00
After re-reading your first post, I now understand what you wanted out of this. Sorry!

What you want is a little bit more complicated, as we need to return control to the game. Thankfully, with OAM DMA hijacking, this problem can be resolved, granted with a few extra steps.

First, you'll need to setup you're store PC items like so:

TM50 x59 (hex:3B)
TM09 x61 (hex:3D)
Leaf Stone x13 (hex:0D)
Repel x(# of steps)
Elixer x187 (hex:BB)
Fire Stone x5 (hex:05)
Lemonade x(Pokemon Index)
TM34 x89 (hex:59)
TM08 x62 (hex:3E)
Thunderstone x4 (hex:04)
Awakening x70 (hex:46)
HM03 x162 (hex:A2)
TM01 x[Any qty]

Then, setup an 8f script like so

8f
Any xany
Thunderstone x57 (hex:37)
TM11 x4 (hex:04)
Awakening x255 (hex:FF)
Repel x128 (hex:80)
Max Ether x14 (hex:0E)
Poké Ball x42 (hex:2A)
Hyper Potion x19 (hex:13)
Ice Heal x32 (hex:20)
TM50 x201 (hex:C9)
TM05 x59 (hex:3B)
TM13 x226 (hex:E2)

Then, use 8f. After walking a certain amount of steps, you should encounter your Pokemon!

Re: 8F script request

Posted by: 0ErrorYT
Date: 2018-02-13 09:20:38
That code seems to just turn your Sprite invisible, but no matter how much I walked, I didn't encounter any Pokemon. I know I got the items right, can you help?

Re: 8F script request

Posted by: Couldntthinkofaname
Date: 2018-02-13 09:36:16
Oops, a couple things went wrong. I've edited the post, try it now.

I confirmed that the new version does work.

Re: 8F script request

Posted by: 0ErrorYT
Date: 2018-02-13 11:02:34
It's doing the same thing, can you send a save file with the code set up so I can see what I'm doing wrong? I am on Pokemon red and emulator is Bgb

Re: 8F script request

Posted by: Couldntthinkofaname
Date: 2018-02-13 11:47:17
In the attached save, just use 8f, walk 16 steps, and Mew will appear. You can use the PC in the room to check the item list.

On this particular save, the game will softlock if you attempt to open the party menu/when you encounter Mew. This is simply because I lazily edited the bootstrapper rather than set it up properly, setting this up correctly in game should have no issues.

Re: 8F script request

Posted by: 0ErrorYT
Date: 2018-02-13 12:29:10
I have no idea what I did wrong, but i think I will wait till April fools to upload the video and thanks for helping me

Re: 8F script request

Posted by: 0ErrorYT
Date: 2018-02-13 16:12:48
I figured out what went wrong, in the post you said 77 thunder stones in the bag, but in the save you gave me its 57.
I made the video (but won't upload it till April fools), however if you guys want to see it I can make it unlisted

Re: 8F script request

Posted by: Couldntthinkofaname
Date: 2018-02-13 16:24:14

I figured out what went wrong, in the post you said 77 thunder stones in the bag, but in the save you gave me its 57.
I made the video (but won't upload it till April fools), however if you guys want to see it I can make it unlisted


The program I used to develop these scripts, Gbz80 to items, currently suffers a bug in which it incorrectly calculates the code relative to Labels. I have reported this to the developer of Gbz80 to items, sorry for the confusion!

Re: 8F script request

Posted by: 0ErrorYT
Date: 2018-02-13 17:44:40
No problem! Thanks for helping me