summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Show-move-names-when-you-receive-a-TM-or-HM.md10
1 files changed, 7 insertions, 3 deletions
diff --git a/Show-move-names-when-you-receive-a-TM-or-HM.md b/Show-move-names-when-you-receive-a-TM-or-HM.md
index b2af1a0..d9bd167 100644
--- a/Show-move-names-when-you-receive-a-TM-or-HM.md
+++ b/Show-move-names-when-you-receive-a-TM-or-HM.md
@@ -40,6 +40,10 @@ Edit [engine/overworld/scripting.asm](../blob/master/engine/overworld/scripting.
+ jp CopyName2
```
+This routine assumes that you've loaded the item ID in `[wNamedObjectIndexBuffer]`, and the *end* of the item name buffer in `de`. Then it converts the item ID to the corresponding TM/HM number, then converts that to the corresponding move ID, gets the name of the move, and appends that to the item name buffer (which is why we started with the end of the buffer).
+
+(The move name is written to `wStringBuffer1`, so you can't also use that for the TM/HM name. You'd end up with issues like TM01 being called "DYNADYNAMICPUNCH".)
+
## 2. Use the new routine in all cases where you acquire an item
@@ -53,7 +57,7 @@ Edit [engine/overworld/scripting.asm](../blob/master/engine/overworld/scripting.
call Script_giveitem
call CurItemName
ld de, wStringBuffer1
- ld a, 1
+ ld a, MEM_BUFFER_0
call CopyConvertedText
+ ld de, wStringBuffer4 + STRLEN("TM##")
+ call AppendTMHMMoveName
@@ -68,7 +72,7 @@ Edit [engine/overworld/scripting.asm](../blob/master/engine/overworld/scripting.
; parameters: item, var
call GetScriptByte
- cp -1
+ cp ITEM_FROM_MEM
jr nz, .ok
ld a, [wScriptVar]
.ok
@@ -86,7 +90,7 @@ Edit [engine/overworld/scripting.asm](../blob/master/engine/overworld/scripting.
ld [wScriptVar], a
call CurItemName
ld de, wStringBuffer1
- ld a, 1
+ ld a, MEM_BUFFER_0
call CopyConvertedText
+ ld de, wStringBuffer4 + STRLEN("TM##")
+ call AppendTMHMMoveName