Author Topic: Is there a way to run custom ASM from an event?  (Read 1582 times)

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1764
  • Nu-chan
    • View Profile
    • Maurtopia
Is there a way to run custom ASM from an event?
« on: January 26, 2009, 04:56:28 pm »
For example, running my code after talking to an NPC.

Ozzie

  • Porrean (+50)
  • *
  • Posts: 53
    • View Profile
Re: Is there a way to run custom ASM from an event?
« Reply #1 on: January 26, 2009, 05:47:15 pm »
Edit the routine of an unused event command (or one of the variants that you never will use). Though TF won't know what your routine does, it will still insert it into the event as the old command.


Use the Event Commands document in Geiger's offsets archive and find an  unused command, and then find it's location in the NA Offsets document to edit it. Then use that command in TF to trigger your code.
Example: Command 7A is unused. You find Event Command 7A in the NA Offsets document, insert your code over the unused 7A's routines. In TF, use Command 7A to trigger your code.

7A probably isn't unused, but this method would be my best guess on how to go about it. The Overworld Events has a command that jumps to custom routines, if we could hook into that somehow, that would be neat.


Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1764
  • Nu-chan
    • View Profile
    • Maurtopia
Re: Is there a way to run custom ASM from an event?
« Reply #2 on: January 26, 2009, 06:26:15 pm »
I'd rather not rely on a variant, in case it's used already (or is there an easy way to check this?).

5D is unused, but when I checked the offsets guide for its location, it wasn't listed. How does the game determine where an event command starts?

Vehek

  • Errare Explorer (+1500)
  • *
  • Posts: 1756
    • View Profile
Re: Is there a way to run custom ASM from an event?
« Reply #3 on: January 26, 2009, 06:33:14 pm »
Quote
005D6E   005F6D   PTR   N   Pointers to Event Command routines (local)

So, command 5D's routines should be at 006A45 (labeled as "unknown routines" in the offset guide)

Geiger

  • Guru of Life Emeritus
  • Chronopolitan (+300)
  • *
  • Posts: 315
    • View Profile
    • Geiger's Crypt
Re: Is there a way to run custom ASM from an event?
« Reply #4 on: January 27, 2009, 09:22:06 am »
The Event Commands file should have the local address of the each command in the second column.  I quickly looked over a disassembly of that chunk of code and didn't see any jumps, so the code should run out to 006A73.