shithub: pokecrystal

Download patch

ref: 6f3b2d6de8dd697ccb03fb5c4874f042879c9202
parent: e79f04e32d3588db76994299ffcadde992d5ffa0
author: IIMarckus <iimarckus@gmail.com>
date: Thu Jul 9 16:08:03 EDT 2015

Add constants for checkcodes.

From PikalaxALT.

--- a/constants/script_constants.asm
+++ b/constants/script_constants.asm
@@ -1,3 +1,31 @@
 ; script vars
-NUM_VARS EQU $1b
-VAR_MOVEMENT EQU $08
+
+	const_def
+	const VAR_STRINGBUFFER2
+	const VAR_PARTYCOUNT
+	const VAR_02
+	const VAR_BATTLETYPE
+	const VAR_TIMEOFDAY
+	const VAR_DEXCAUGHT
+	const VAR_DEXSEEN
+	const VAR_BADGES
+	const VAR_MOVEMENT
+	const VAR_FACING
+	const VAR_HOUR
+	const VAR_WEEKDAY
+	const VAR_MAPGROUP
+	const VAR_MAPNUMBER
+	const VAR_UNOWNCOUNT
+	const VAR_ROOFPALETTE
+	const VAR_BOXSPACE
+	const VAR_11
+	const VAR_XCOORD
+	const VAR_YCOORD
+	const VAR_POKERUS
+	const VAR_15
+	const VAR_16
+	const VAR_CALLERID
+	const VAR_BLUECARDBALANCE
+	const VAR_19
+	const VAR_1A
+NUM_VARS EQU const_value
\ No newline at end of file
--- a/engine/buena_phone_scripts.asm
+++ b/engine/buena_phone_scripts.asm
@@ -1,7 +1,7 @@
 UnknownScript_0xa0b14:
 	checkflag ENGINE_BIKE_SHOP_CALL_ENABLED
 	iftrue UnknownScript_0xa0b73
-	checkcode $a
+	checkcode VAR_HOUR
 	if_greater_than $11, UnknownScript_0xa0b4b
 	scall UnknownScript_0xa0b32
 	jump UnknownScript_0xa0c0e
@@ -36,7 +36,7 @@
 	end
 
 UnknownScript_0xa0b4f:
-	checkcode $a
+	checkcode VAR_HOUR
 	if_greater_than $11, UnknownScript_0xa0b6e
 	checkmorn
 	iftrue UnknownScript_0xa0b64
--- a/engine/more_phone_scripts.asm
+++ b/engine/more_phone_scripts.asm
@@ -55,7 +55,7 @@
 	farjump UnknownScript_0xa053a
 
 UnknownScript_0xa007c:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, UnknownScript_0xa00c2
 	if_equal $b, UnknownScript_0xa00c8
 	if_equal $d, UnknownScript_0xa00ce
@@ -160,7 +160,7 @@
 	end
 
 UnknownScript_0xa0128:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, UnknownScript_0xa014a
 	if_equal $c, UnknownScript_0xa0150
 	if_equal $e, UnknownScript_0xa0156
@@ -211,7 +211,7 @@
 	end
 
 UnknownScript_0xa017a:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, UnknownScript_0xa01c0
 	if_equal $b, UnknownScript_0xa01c6
 	if_equal $d, UnknownScript_0xa01cc
@@ -316,7 +316,7 @@
 	end
 
 UnknownScript_0xa0226:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, UnknownScript_0xa0248
 	if_equal $c, UnknownScript_0xa024e
 	if_equal $e, UnknownScript_0xa0254
@@ -367,7 +367,7 @@
 	end
 
 UnknownScript_0xa0278:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, UnknownScript_0xa02be
 	if_equal $b, UnknownScript_0xa02c4
 	if_equal $d, UnknownScript_0xa02ca
@@ -472,7 +472,7 @@
 	end
 
 UnknownScript_0xa0324:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, UnknownScript_0xa0346
 	if_equal $c, UnknownScript_0xa034c
 	if_equal $e, UnknownScript_0xa0352
@@ -531,7 +531,7 @@
 	farjump UnknownScript_0xa053a
 
 UnknownScript_0xa0386:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, UnknownScript_0xa03cc
 	if_equal $7, UnknownScript_0xa03d2
 	if_equal $b, UnknownScript_0xa03d8
@@ -636,7 +636,7 @@
 	end
 
 UnknownScript_0xa0432:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $c, UnknownScript_0xa0450
 	if_equal $e, UnknownScript_0xa0456
 	if_equal $12, UnknownScript_0xa045c
@@ -689,7 +689,7 @@
 	end
 
 UnknownScript_0xa0484:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, UnknownScript_0xa04d6
 	if_equal $7, UnknownScript_0xa04db
 	if_equal $b, UnknownScript_0xa04e0
@@ -792,7 +792,7 @@
 	end
 
 UnknownScript_0xa053a:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, UnknownScript_0xa055c
 	if_equal $c, UnknownScript_0xa0561
 	if_equal $e, UnknownScript_0xa0566
@@ -855,7 +855,7 @@
 	end
 
 UnknownScript_0xa05a4:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $10, UnknownScript_0xa05ae
 	if_equal $1c, UnknownScript_0xa05b6
 
@@ -895,7 +895,7 @@
 	jump UnknownScript_0xa0484
 
 UnknownScript_0xa05e6:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $d, UnknownScript_0xa0600
 	if_equal $10, UnknownScript_0xa0605
 	if_equal $18, UnknownScript_0xa060a
@@ -928,7 +928,7 @@
 	end
 
 UnknownScript_0xa061e:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, UnknownScript_0xa0630
 	if_equal $15, UnknownScript_0xa0635
 	if_equal $1a, UnknownScript_0xa063a
@@ -1459,7 +1459,7 @@
 	jump UnknownScript_0xa0484
 
 UnknownScript_0xa09ee:
-	checkcode $1a
+	checkcode VAR_1A
 	if_equal $2, UnknownScript_0xa0a00
 	if_equal $1, UnknownScript_0xa0a08
 	farwritetext UnknownText_0x66e17
--- a/engine/phone_scripts.asm
+++ b/engine/phone_scripts.asm
@@ -19,7 +19,7 @@
 	farwritetext MomPhoneGreetingText
 	keeptextopen
 	mapnametotext $0
-	checkcode $f
+	checkcode VAR_ROOFPALETTE
 	if_equal $1, UnknownScript_0xbcee7
 	if_equal $2, UnknownScript_0xbcf27
 	jump UnknownScript_0xbcf2f
@@ -30,7 +30,7 @@
 	jump UnknownScript_0xbcf37
 
 UnknownScript_0xbcee7: ; 0xbcee7
-	checkcode $c
+	checkcode VAR_MAPGROUP
 	if_equal GROUP_NEW_BARK_TOWN, .newbark
 	if_equal GROUP_CHERRYGROVE_CITY, .cherrygrove
 	if_equal GROUP_VIOLET_CITY, .violet
@@ -167,7 +167,7 @@
 .main ; 0xbcfe7
 	farwritetext BillPhoneGeneriText
 	keeptextopen
-	checkcode $10
+	checkcode VAR_BOXSPACE
 	RAM2MEM $0
 	if_equal $0, .full
 	if_less_than $6, .nearlyfull
@@ -188,7 +188,7 @@
 	end
 
 ElmPhoneScript1: ; 0xbd00d
-	checkcode $14
+	checkcode VAR_POKERUS
 	if_equal $1, .pokerus
 	checkevent EVENT_SHOWED_TOGEPI_TO_ELM
 	iftrue .discovery
@@ -251,7 +251,7 @@
 	end
 
 ElmPhoneScript2: ; 0xbd081
-	checkcode $14
+	checkcode VAR_POKERUS
 	if_equal $2, .disaster
 	if_equal $3, .assistant
 	if_equal $4, .rocket
@@ -298,7 +298,7 @@
 	farscall UnknownScript_0xbde4e
 	checkflag ENGINE_87
 	iftrue UnknownScript_0xbd0ef
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $1, UnknownScript_0xbd0ef
 	checkmorn
 	iftrue UnknownScript_0xbd12a
@@ -375,7 +375,7 @@
 	farscall UnknownScript_0xbde4e
 	checkflag ENGINE_88
 	iftrue UnknownScript_0xbd19b
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $3, UnknownScript_0xbd19b
 	checknite
 	iftrue UnknownScript_0xbd1cd
@@ -417,7 +417,7 @@
 	farscall UnknownScript_0xbde4e
 	checkflag ENGINE_89
 	iftrue UnknownScript_0xbd1f9
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $4, UnknownScript_0xbd1f9
 	checkmorn
 	iftrue UnknownScript_0xbd22c
@@ -462,7 +462,7 @@
 	farscall UnknownScript_0xbe0b6
 	checkflag ENGINE_8A
 	iftrue UnknownScript_0xbd25c
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $5, UnknownScript_0xbd25c
 	checkday
 	iftrue UnknownScript_0xbd287
@@ -504,7 +504,7 @@
 	iftrue UnknownScript_0xbd2b9
 	checkflag ENGINE_JOSE_HAS_STAR_PIECE
 	iftrue UnknownScript_0xbd2c4
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $6, UnknownScript_0xbd2b9
 	checknite
 	iftrue UnknownScript_0xbd301
@@ -562,7 +562,7 @@
 	farscall UnknownScript_0xbe0b6
 	checkflag ENGINE_8C
 	iftrue UnknownScript_0xbd33b
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $0, UnknownScript_0xbd33b
 	checkmorn
 	iftrue UnknownScript_0xbd366
@@ -602,7 +602,7 @@
 	farscall UnknownScript_0xbde4e
 	checkflag ENGINE_8D
 	iftrue UnknownScript_0xbd392
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $1, UnknownScript_0xbd392
 	checkday
 	iftrue UnknownScript_0xbd3c4
@@ -646,7 +646,7 @@
 	iftrue UnknownScript_0xbd3f6
 	checkflag ENGINE_WADE_HAS_ITEM
 	iftrue UnknownScript_0xbd421
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $2, UnknownScript_0xbd3f6
 	checknite
 	iftrue UnknownScript_0xbd484
@@ -656,7 +656,7 @@
 	if_equal $0, UnknownScript_0xbd412
 	checkflag ENGINE_51
 	iftrue UnknownScript_0xbd412
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal $2, UnknownScript_0xbd416
 	if_equal $4, UnknownScript_0xbd416
 	if_equal $6, UnknownScript_0xbd416
@@ -682,7 +682,7 @@
 	if_equal $0, UnknownScript_0xbd44c
 	checkflag ENGINE_51
 	iftrue UnknownScript_0xbd44c
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal $2, UnknownScript_0xbd480
 	if_equal $4, UnknownScript_0xbd480
 	if_equal $6, UnknownScript_0xbd480
@@ -758,7 +758,7 @@
 	farscall UnknownScript_0xbde4e
 	checkflag ENGINE_8F
 	iftrue UnknownScript_0xbd4f1
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $3, UnknownScript_0xbd4f1
 	checkmorn
 	iftrue UnknownScript_0xbd537
@@ -821,7 +821,7 @@
 	farscall UnknownScript_0xbe0b6
 	checkflag ENGINE_90
 	iftrue UnknownScript_0xbd57f
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $4, UnknownScript_0xbd57f
 	checkday
 	iftrue UnknownScript_0xbd5c3
@@ -924,7 +924,7 @@
 	farscall UnknownScript_0xbde4e
 	checkflag ENGINE_91
 	iftrue UnknownScript_0xbd653
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $5, UnknownScript_0xbd653
 	checknite
 	iftrue UnknownScript_0xbd699
@@ -986,7 +986,7 @@
 	farscall UnknownScript_0xbde4e
 	checkflag ENGINE_92
 	iftrue UnknownScript_0xbd6e0
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $6, UnknownScript_0xbd6e0
 	checkmorn
 	iftrue UnknownScript_0xbd72b
@@ -1048,7 +1048,7 @@
 	iftrue UnknownScript_0xbd768
 	checkflag ENGINE_GINA_HAS_LEAF_STONE
 	iftrue UnknownScript_0xbd77d
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $0, UnknownScript_0xbd768
 	checkday
 	iftrue UnknownScript_0xbd7cc
@@ -1139,7 +1139,7 @@
 	farscall UnknownScript_0xbde4e
 	checkflag ENGINE_94
 	iftrue UnknownScript_0xbd832
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $2, UnknownScript_0xbd832
 	checkmorn
 	iftrue UnknownScript_0xbd87a
@@ -1206,7 +1206,7 @@
 	iftrue UnknownScript_0xbd8cb
 	checkflag ENGINE_ALAN_HAS_FIRE_STONE
 	iftrue UnknownScript_0xbd8d6
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $3, UnknownScript_0xbd8cb
 	checkday
 	iftrue UnknownScript_0xbd919
@@ -1267,7 +1267,7 @@
 	iftrue UnknownScript_0xbd955
 	checkflag ENGINE_LIZ_HAS_THUNDERSTONE
 	iftrue UnknownScript_0xbd960
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $4, UnknownScript_0xbd955
 	checknite
 	iftrue UnknownScript_0xbd9ab
@@ -1331,7 +1331,7 @@
 	farscall UnknownScript_0xbde4e
 	checkflag ENGINE_97
 	iftrue UnknownScript_0xbd9e5
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $5, UnknownScript_0xbd9e5
 	checkmorn
 	iftrue UnknownScript_0xbda20
@@ -1383,7 +1383,7 @@
 	if_equal $0, UnknownScript_0xbda5f
 	checkflag ENGINE_51
 	iftrue UnknownScript_0xbda5f
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal $2, UnknownScript_0xbda63
 	if_equal $4, UnknownScript_0xbda63
 	if_equal $6, UnknownScript_0xbda63
@@ -1405,7 +1405,7 @@
 	if_equal $0, UnknownScript_0xbda92
 	checkflag ENGINE_51
 	iftrue UnknownScript_0xbda92
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal $2, UnknownScript_0xbda9e
 	if_equal $4, UnknownScript_0xbda9e
 	if_equal $6, UnknownScript_0xbda9e
@@ -1432,7 +1432,7 @@
 	iftrue UnknownScript_0xbdad1
 	checkflag ENGINE_TULLY_HAS_WATER_STONE
 	iftrue UnknownScript_0xbdadc
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $0, UnknownScript_0xbdad1
 	checknite
 	iftrue UnknownScript_0xbdb1f
@@ -1491,7 +1491,7 @@
 	farscall UnknownScript_0xbde4e
 	checkflag ENGINE_99
 	iftrue UnknownScript_0xbdb55
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $1, UnknownScript_0xbdb55
 	checkmorn
 	iftrue UnknownScript_0xbdb88
@@ -1538,7 +1538,7 @@
 	iftrue UnknownScript_0xbdbbe
 	checkflag ENGINE_TIFFANY_HAS_PINK_BOW
 	iftrue UnknownScript_0xbdbc9
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $2, UnknownScript_0xbdbbe
 	checkday
 	iftrue UnknownScript_0xbdc14
@@ -1635,7 +1635,7 @@
 	farscall UnknownScript_0xbde4e
 	checkflag ENGINE_9B
 	iftrue UnknownScript_0xbdc92
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $3, UnknownScript_0xbdc92
 	checknite
 	iftrue UnknownScript_0xbdcc1
@@ -1678,7 +1678,7 @@
 	iftrue UnknownScript_0xbdcf3
 	checkflag ENGINE_WILTON_HAS_ITEM
 	iftrue UnknownScript_0xbdcfe
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $4, UnknownScript_0xbdcf3
 	checkmorn
 	iftrue UnknownScript_0xbdd33
@@ -1762,7 +1762,7 @@
 	farscall UnknownScript_0xbde4e
 	checkflag ENGINE_9D
 	iftrue UnknownScript_0xbdda8
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $5, UnknownScript_0xbdda8
 	checkday
 	iftrue UnknownScript_0xbddd7
@@ -1803,7 +1803,7 @@
 	farscall UnknownScript_0xbe0b6
 	checkflag ENGINE_9E
 	iftrue UnknownScript_0xbde03
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal $6, UnknownScript_0xbde03
 	checknite
 	iftrue UnknownScript_0xbde32
@@ -1862,7 +1862,7 @@
 	iftrue UnknownScript_0xbdf22
 	checknite
 	iftrue UnknownScript_0xbdfec
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, UnknownScript_0xbdeaa
 	if_equal $7, UnknownScript_0xbdeb0
 	if_equal $b, UnknownScript_0xbdeb6
@@ -1985,7 +1985,7 @@
 	end
 
 UnknownScript_0xbdf22:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, UnknownScript_0xbdf74
 	if_equal $7, UnknownScript_0xbdf7a
 	if_equal $b, UnknownScript_0xbdf80
@@ -2108,7 +2108,7 @@
 	end
 
 UnknownScript_0xbdfec:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, UnknownScript_0xbe03e
 	if_equal $7, UnknownScript_0xbe044
 	if_equal $b, UnknownScript_0xbe04a
@@ -2235,7 +2235,7 @@
 	iftrue UnknownScript_0xbe112
 	checknite
 	iftrue UnknownScript_0xbe164
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, UnknownScript_0xbe0e2
 	if_equal $c, UnknownScript_0xbe0e8
 	if_equal $e, UnknownScript_0xbe0ee
@@ -2286,7 +2286,7 @@
 	end
 
 UnknownScript_0xbe112:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, UnknownScript_0xbe134
 	if_equal $c, UnknownScript_0xbe13a
 	if_equal $e, UnknownScript_0xbe140
@@ -2337,7 +2337,7 @@
 	end
 
 UnknownScript_0xbe164:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, UnknownScript_0xbe186
 	if_equal $c, UnknownScript_0xbe18c
 	if_equal $e, UnknownScript_0xbe192
@@ -2392,7 +2392,7 @@
 	iftrue UnknownScript_0xbe28a
 	checknite
 	iftrue UnknownScript_0xbe354
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, UnknownScript_0xbe212
 	if_equal $7, UnknownScript_0xbe218
 	if_equal $b, UnknownScript_0xbe21e
@@ -2515,7 +2515,7 @@
 	end
 
 UnknownScript_0xbe28a:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, UnknownScript_0xbe2dc
 	if_equal $7, UnknownScript_0xbe2e2
 	if_equal $b, UnknownScript_0xbe2e8
@@ -2638,7 +2638,7 @@
 	end
 
 UnknownScript_0xbe354:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, UnknownScript_0xbe3a6
 	if_equal $7, UnknownScript_0xbe3ac
 	if_equal $b, UnknownScript_0xbe3b2
@@ -2765,7 +2765,7 @@
 	iftrue UnknownScript_0xbe47a
 	checknite
 	iftrue UnknownScript_0xbe4cc
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, UnknownScript_0xbe44a
 	if_equal $c, UnknownScript_0xbe450
 	if_equal $e, UnknownScript_0xbe456
@@ -2816,7 +2816,7 @@
 	end
 
 UnknownScript_0xbe47a:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, UnknownScript_0xbe49c
 	if_equal $c, UnknownScript_0xbe4a2
 	if_equal $e, UnknownScript_0xbe4a8
@@ -2867,7 +2867,7 @@
 	end
 
 UnknownScript_0xbe4cc:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, UnknownScript_0xbe4ee
 	if_equal $c, UnknownScript_0xbe4f4
 	if_equal $e, UnknownScript_0xbe4fa
@@ -2918,7 +2918,7 @@
 	end
 
 UnknownScript_0xbe51e:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, UnknownScript_0xbe564
 	if_equal $b, UnknownScript_0xbe570
 	if_equal $d, UnknownScript_0xbe576
@@ -3028,7 +3028,7 @@
 	end
 
 UnknownScript_0xbe5d0:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, UnknownScript_0xbe5f2
 	if_equal $c, UnknownScript_0xbe5f8
 	if_equal $e, UnknownScript_0xbe5fe
--- a/engine/std_scripts.asm
+++ b/engine/std_scripts.asm
@@ -244,7 +244,7 @@
 	farjumptext MartSignText
 
 DayToTextScript:
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal MONDAY, .Monday
 	if_equal TUESDAY, .Tuesday
 	if_equal WEDNESDAY, .Wednesday
@@ -622,7 +622,7 @@
 
 AskNumber1MScript:
 	special RandomPhoneMon
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, .Jack
 	if_equal $7, .Huey
 	if_equal $b, .Gaven
@@ -707,7 +707,7 @@
 
 AskNumber2MScript:
 	special RandomPhoneMon
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, .Jack
 	if_equal $7, .Huey
 	if_equal $b, .Gaven
@@ -798,7 +798,7 @@
 	end
 
 NumberAcceptedMScript:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, .Jack
 	if_equal $7, .Huey
 	if_equal $b, .Gaven
@@ -922,7 +922,7 @@
 	end
 
 NumberDeclinedMScript:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, .Jack
 	if_equal $7, .Huey
 	if_equal $b, .Gaven
@@ -1046,7 +1046,7 @@
 	end
 
 PhoneFullMScript:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, .Jack
 	if_equal $7, .Huey
 	if_equal $b, .Gaven
@@ -1170,7 +1170,7 @@
 	end
 
 RematchMScript:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $5, .Jack
 	if_equal $7, .Huey
 	if_equal $b, .Gaven
@@ -1276,7 +1276,7 @@
 	end
 
 GiftMScript:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $d, .Jose
 	if_equal $10, .Wade
 	if_equal $18, .Alan
@@ -1315,7 +1315,7 @@
 	end
 
 PackFullMScript:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $7, .Huey
 	if_equal $d, .Jose
 	if_equal $f, .Joey
@@ -1386,7 +1386,7 @@
 
 RematchGiftMScript:
 	loadfont
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $7, .Huey
 	if_equal $f, .Joey
 	if_equal $20, .Vance
@@ -1410,7 +1410,7 @@
 	end
 
 AskNumber1FScript:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, .Beverly
 	if_equal $c, .Beth
 	if_equal $e, .Reena
@@ -1446,7 +1446,7 @@
 	end
 
 AskNumber2FScript:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, .Beverly
 	if_equal $c, .Beth
 	if_equal $e, .Reena
@@ -1489,7 +1489,7 @@
 	end
 
 NumberAcceptedFScript: ; 0xbcbd3
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, .Beverly
 	if_equal $c, .Beth
 	if_equal $e, .Reena
@@ -1541,7 +1541,7 @@
 	end
 
 NumberDeclinedFScript:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, .Beverly
 	if_equal $c, .Beth
 	if_equal $e, .Reena
@@ -1593,7 +1593,7 @@
 	end
 
 PhoneFullFScript:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, .Beverly
 	if_equal $c, .Beth
 	if_equal $e, .Reena
@@ -1645,7 +1645,7 @@
 	end
 
 RematchFScript:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $c, .Beth
 	if_equal $e, .Reena
 	if_equal $12, .Liz
@@ -1691,7 +1691,7 @@
 	end
 
 GiftFScript:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, .Beverly
 	if_equal $15, .Gina
 	if_equal $1a, .Dana
@@ -1715,7 +1715,7 @@
 	end
 
 PackFullFScript:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $6, .Beverly
 	if_equal $15, .Gina
 	if_equal $1a, .Dana
@@ -1749,7 +1749,7 @@
 	end
 
 RematchGiftFScript:
-	checkcode $17
+	checkcode VAR_CALLERID
 	if_equal $24, .Erin
 
 .Erin
--- a/main.asm
+++ b/main.asm
@@ -5320,7 +5320,7 @@
 	farscall UnknownScript_0x122c1
 	special Function97c28
 	callasm Function154f1
-	writecode $8, $0
+	writecode VAR_MOVEMENT, $0
 	newloadmap $fc
 	callasm Function8cb33
 	special WaitSFX
@@ -5588,7 +5588,7 @@
 	applymovement $0, MovementData_0xcc59
 	farscall UnknownScript_0x122c1
 	special Function97c28
-	writecode $8, $0
+	writecode VAR_MOVEMENT, $0
 	newloadmap $f5
 	playsound SFX_WARP_FROM
 	applymovement $0, MovementData_0xcc5d
@@ -5686,7 +5686,7 @@
 	applymovement $0, MovementData_0xcce1
 	farscall UnknownScript_0x122c1
 	special Function97c28
-	writecode $8, $0
+	writecode VAR_MOVEMENT, $0
 	newloadmap $f4
 	playsound SFX_WARP_FROM
 	applymovement $0, MovementData_0xcce3
@@ -6547,7 +6547,7 @@
 UnknownScript_0xd13e: ; 0xd13e
 	reloadmappart
 	special UpdateTimePals
-	writecode $8, $1
+	writecode VAR_MOVEMENT, $1
 	writetext UnknownText_0xd17c
 	closetext
 	loadmovesprites
@@ -6556,7 +6556,7 @@
 ; 0xd14e
 
 UnknownScript_0xd14e: ; 0xd14e
-	writecode $8, $1
+	writecode VAR_MOVEMENT, $1
 	loadmovesprites
 	special Functione4a
 	end
@@ -6569,7 +6569,7 @@
 UnknownScript_0xd158: ; 0xd158
 	reloadmappart
 	special UpdateTimePals
-	writecode $8, $0
+	writecode VAR_MOVEMENT, $0
 	writetext UnknownText_0xd181
 	closetext
 
@@ -6581,7 +6581,7 @@
 ; 0xd16b
 
 UnknownScript_0xd16b: ; 0xd16b
-	writecode $8, $0
+	writecode VAR_MOVEMENT, $0
 	jump UnknownScript_0xd163
 ; 0xd171
 
@@ -12792,7 +12792,7 @@
 ; 1253d
 
 UnknownScript_0x1253d:: ; 0x1253d
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $0, UnknownScript_0x12555
 	if_equal $1, UnknownScript_0x12550
 	if_equal $2, UnknownScript_0x1255f
@@ -15367,7 +15367,7 @@
 ; 135eb
 
 UnknownScript_0x135eb:: ; 0x135eb
-	writecode $3, BATTLETYPE_CONTEST
+	writecode VAR_BATTLETYPE, BATTLETYPE_CONTEST
 	battlecheck
 	startbattle
 	returnafterbattle
--- a/maps/AzaleaGym.asm
+++ b/maps/AzaleaGym.asm
@@ -24,7 +24,7 @@
 	playsound SFX_GET_BADGE
 	waitbutton
 	setflag $001c
-	checkcode $7
+	checkcode VAR_BADGES
 	scall UnknownScript_0x18ec73
 UnknownScript_0x18ec48: ; 0x18ec48
 	checkevent EVENT_GOT_TM49_FURY_CUTTER
--- a/maps/BlackthornCity.asm
+++ b/maps/BlackthornCity.asm
@@ -14,7 +14,7 @@
 	return
 
 .Santos
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal SATURDAY, .SantosAppears
 	disappear $9
 	return
@@ -83,7 +83,7 @@
 	loadfont
 	checkevent EVENT_GOT_SPELL_TAG_FROM_SANTOS
 	iftrue SantosSaturdayScript
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal SATURDAY, SantosNotSaturdayScript
 	checkevent EVENT_MET_SANTOS_OF_SATURDAY
 	iftrue .MetSantos
--- a/maps/BluesHouse.asm
+++ b/maps/BluesHouse.asm
@@ -9,7 +9,7 @@
 DaisyScript_0x19b0d0: ; 0x19b0d0
 	faceplayer
 	loadfont
-	checkcode $a
+	checkcode VAR_HOUR
 	if_equal $f, UnknownScript_0x19b0de
 	writetext UnknownText_0x19b130
 	closetext
--- a/maps/BurnedTowerB1F.asm
+++ b/maps/BurnedTowerB1F.asm
@@ -104,7 +104,7 @@
 	writetext UnknownText_0x18626a
 	closetext
 	loadmovesprites
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $1, UnknownScript_0x186226
 	applymovement $a, MovementData_0x186263
 	jump UnknownScript_0x18622a
--- a/maps/CeladonGameCornerPrizeRoom.asm
+++ b/maps/CeladonGameCornerPrizeRoom.asm
@@ -152,7 +152,7 @@
 UnknownScript_0x727ed: ; 0x727ed
 	checkcoins 2222
 	if_equal $2, UnknownScript_0x72778
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_equal $6, UnknownScript_0x7277e
 	pokenamemem PIKACHU, $0
 	scall UnknownScript_0x72768
@@ -171,7 +171,7 @@
 UnknownScript_0x7281b: ; 0x7281b
 	checkcoins 5555
 	if_equal $2, UnknownScript_0x72778
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_equal $6, UnknownScript_0x7277e
 	pokenamemem PORYGON, $0
 	scall UnknownScript_0x72768
@@ -190,7 +190,7 @@
 UnknownScript_0x72849: ; 0x72849
 	checkcoins 8888
 	if_equal $2, UnknownScript_0x72778
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_equal $6, UnknownScript_0x7277e
 	pokenamemem LARVITAR, $0
 	scall UnknownScript_0x72768
--- a/maps/CeladonMansion3F.asm
+++ b/maps/CeladonMansion3F.asm
@@ -10,7 +10,7 @@
 	faceplayer
 	loadfont
 	writetext UnknownText_0x716ce
-	checkcode $5
+	checkcode VAR_DEXCAUGHT
 	if_greater_than $f8, UnknownScript_0x7167e
 	closetext
 	loadmovesprites
--- a/maps/CeladonPokeCenter1F.asm
+++ b/maps/CeladonPokeCenter1F.asm
@@ -43,7 +43,7 @@
 	writetext UnknownText_0x71f65
 	closetext
 	loadmovesprites
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $1, UnknownScript_0x71e5a
 	applymovement $6, MovementData_0x71e6b
 	jump UnknownScript_0x71e5e
--- a/maps/CherrygroveCity.asm
+++ b/maps/CherrygroveCity.asm
@@ -120,7 +120,7 @@
 	winlosstext UnknownText_0x19c57f, UnknownText_0x19c5e6
 	setlasttalked $3
 	loadtrainer RIVAL1, RIVAL1_3
-	writecode $3, BATTLETYPE_CANLOSE
+	writecode VAR_BATTLETYPE, BATTLETYPE_CANLOSE
 	startbattle
 	reloadmapmusic
 	reloadmap
@@ -131,7 +131,7 @@
 	winlosstext UnknownText_0x19c57f, UnknownText_0x19c5e6
 	setlasttalked $3
 	loadtrainer RIVAL1, RIVAL1_1
-	writecode $3, BATTLETYPE_CANLOSE
+	writecode VAR_BATTLETYPE, BATTLETYPE_CANLOSE
 	startbattle
 	reloadmapmusic
 	reloadmap
@@ -142,7 +142,7 @@
 	winlosstext UnknownText_0x19c57f, UnknownText_0x19c5e6
 	setlasttalked $3
 	loadtrainer RIVAL1, RIVAL1_2
-	writecode $3, BATTLETYPE_CANLOSE
+	writecode VAR_BATTLETYPE, BATTLETYPE_CANLOSE
 	startbattle
 	reloadmapmusic
 	reloadmap
--- a/maps/CianwoodGym.asm
+++ b/maps/CianwoodGym.asm
@@ -39,7 +39,7 @@
 	playsound SFX_GET_BADGE
 	waitbutton
 	setflag $0020
-	checkcode $7
+	checkcode VAR_BADGES
 	scall UnknownScript_0x9d681
 UnknownScript_0x9d656: ; 0x9d656
 	checkevent EVENT_GOT_TM01_DYNAMICPUNCH
--- a/maps/DayCare.asm
+++ b/maps/DayCare.asm
@@ -32,7 +32,7 @@
 	writetext UnknownText_0x630ce
 	keeptextopen
 	loadmovesprites
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_equal $6, UnknownScript_0x62fb6
 	special Function117656
 	loadfont
--- a/maps/DragonShrine.asm
+++ b/maps/DragonShrine.asm
@@ -212,7 +212,7 @@
 UnknownScript_0x18d1c5: ; 0x18d1c5
 	writetext UnknownText_0x18d604
 	closetext
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_equal $6, UnknownScript_0x18d1ed
 	writetext UnknownText_0x18d697
 	playsound SFX_CAUGHT_MON
--- a/maps/DragonsDenB1F.asm
+++ b/maps/DragonsDenB1F.asm
@@ -30,7 +30,7 @@
 ; 0x18c8a8
 
 UnknownScript_0x18c8a8: ; 0x18c8a8
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal TUESDAY, UnknownScript_0x18c8b5
 	if_equal THURSDAY, UnknownScript_0x18c8b5
 	disappear $4
--- a/maps/EcruteakGym.asm
+++ b/maps/EcruteakGym.asm
@@ -37,7 +37,7 @@
 	playsound SFX_GET_BADGE
 	waitbutton
 	setflag $001e
-	checkcode $7
+	checkcode VAR_BADGES
 	scall UnknownScript_0x99db7
 	domaptrigger GROUP_ECRUTEAK_HOUSE, MAP_ECRUTEAK_HOUSE, $1
 	setevent $0766
--- a/maps/ElmsLab.asm
+++ b/maps/ElmsLab.asm
@@ -193,7 +193,7 @@
 	keeptextopen
 	givepoke CYNDAQUIL, 5, BERRY, 0
 	loadmovesprites
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $3, ElmDirectionsScript
 	applymovement $0, AfterCyndaquilMovement
 	jump ElmDirectionsScript
@@ -450,7 +450,7 @@
 
 ElmJumpBackScript1: ; 0x78e3f
 	loadmovesprites
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $0, UnknownScript_0x78e6d
 	if_equal $1, UnknownScript_0x78e67
 	if_equal $2, UnknownScript_0x78e73
@@ -460,7 +460,7 @@
 
 ElmJumpBackScript2: ; 0x78e53
 	loadmovesprites
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $0, UnknownScript_0x78e67
 	if_equal $1, UnknownScript_0x78e6d
 	if_equal $2, UnknownScript_0x78e79
--- a/maps/FastShip1F.asm
+++ b/maps/FastShip1F.asm
@@ -95,7 +95,7 @@
 ; 0x751b8
 
 UnknownScript_0x751b8: ; 0x751b8
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $3, UnknownScript_0x751c7
 	applymovement $2, MovementData_0x7520e
 	applymovement $0, MovementData_0x75235
--- a/maps/FastShipCabins_NNW_NNE_NE.asm
+++ b/maps/FastShipCabins_NNW_NNE_NE.asm
@@ -199,7 +199,7 @@
 	loadmovesprites
 	setevent $0033
 	domaptrigger GROUP_FAST_SHIP_B1F, MAP_FAST_SHIP_B1F, $1
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $3, UnknownScript_0x75629
 	applymovement $6, MovementData_0x75637
 	playsound SFX_EXIT_BUILDING
--- a/maps/GoldenrodBillsHouse.asm
+++ b/maps/GoldenrodBillsHouse.asm
@@ -17,7 +17,7 @@
 	writetext UnknownText_0x54d3f
 	keeptextopen
 	waitbutton
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_equal $6, UnknownScript_0x54c13
 	writetext UnknownText_0x54dae
 	playsound SFX_CAUGHT_MON
--- a/maps/GoldenrodCity.asm
+++ b/maps/GoldenrodCity.asm
@@ -23,7 +23,7 @@
 	iffalse .MoveTutorDone
 	checkitem COIN_CASE
 	iffalse .MoveTutorDisappear
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal WEDNESDAY, .MoveTutorAppear
 	if_equal SATURDAY, .MoveTutorAppear
 .MoveTutorDisappear
@@ -118,7 +118,7 @@
 	writetext UnknownText_0x19918b
 	closetext
 	loadmovesprites
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $2, UnknownScript_0x1989c6
 	applymovement $10, MovementData_0x198a5f
 	jump UnknownScript_0x1989ca
--- a/maps/GoldenrodDeptStore5F.asm
+++ b/maps/GoldenrodDeptStore5F.asm
@@ -10,7 +10,7 @@
 	dbw 2, UnknownScript_0x56090
 
 UnknownScript_0x56090:
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal SUNDAY, UnknownScript_0x56099
 	disappear $7
 	return
@@ -56,7 +56,7 @@
 ReceptionistScript_0x560ce:
 	faceplayer
 	loadfont
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal SUNDAY, UnknownScript_0x56112
 	checkflag $005b
 	iftrue UnknownScript_0x56112
--- a/maps/GoldenrodGameCorner.asm
+++ b/maps/GoldenrodGameCorner.asm
@@ -15,7 +15,7 @@
 	iffalse UnknownScript_0x56c19
 	checkitem COIN_CASE
 	iffalse UnknownScript_0x56c0e
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal WEDNESDAY, UnknownScript_0x56c11
 	if_equal SATURDAY, UnknownScript_0x56c11
 UnknownScript_0x56c0e: ; 0x56c0e
@@ -183,7 +183,7 @@
 UnknownScript_0x56d26: ; 0x56d26
 	checkcoins 100
 	if_equal $2, UnknownScript_0x56cb1
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_equal $6, UnknownScript_0x56cb7
 	pokenamemem ABRA, $0
 	scall UnknownScript_0x56ca1
@@ -202,7 +202,7 @@
 UnknownScript_0x56d54: ; 0x56d54
 	checkcoins 800
 	if_equal $2, UnknownScript_0x56cb1
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_equal $6, UnknownScript_0x56cb7
 	pokenamemem CUBONE, $0
 	scall UnknownScript_0x56ca1
@@ -221,7 +221,7 @@
 UnknownScript_0x56d82: ; 0x56d82
 	checkcoins 1500
 	if_equal $2, UnknownScript_0x56cb1
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_equal $6, UnknownScript_0x56cb7
 	pokenamemem WOBBUFFET, $0
 	scall UnknownScript_0x56ca1
--- a/maps/IlexForest.asm
+++ b/maps/IlexForest.asm
@@ -366,7 +366,7 @@
 	cry FARFETCH_D
 	closetext
 	loadmovesprites
-	checkcode $9
+	checkcode VAR_FACING
 	end
 ; 0x6edae
 
--- a/maps/IndigoPlateauPokeCenter1F.asm
+++ b/maps/IndigoPlateauPokeCenter1F.asm
@@ -48,7 +48,7 @@
 	iffalse UnknownScript_0x18012b
 	checkflag $005d
 	iftrue UnknownScript_0x18012b
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal SUNDAY, UnknownScript_0x18012b
 	if_equal TUESDAY, UnknownScript_0x18012b
 	if_equal THURSDAY, UnknownScript_0x18012b
@@ -71,7 +71,7 @@
 	iffalse UnknownScript_0x18012b
 	checkflag $005d
 	iftrue UnknownScript_0x18012b
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal SUNDAY, UnknownScript_0x18012b
 	if_equal TUESDAY, UnknownScript_0x18012b
 	if_equal THURSDAY, UnknownScript_0x18012b
--- a/maps/KurtsHouse.asm
+++ b/maps/KurtsHouse.asm
@@ -45,7 +45,7 @@
 	loadmovesprites
 	special Functionc48f
 	setevent $06fa
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $1, UnknownScript_0x18e1ab
 	spriteface $0, DOWN
 	playsound SFX_FLY
@@ -322,7 +322,7 @@
 	special Functionc48f
 	pause 20
 	showemote $0, $2, 30
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $1, UnknownScript_0x18e3a2
 	spriteface $0, DOWN
 	playsound SFX_FLY
--- a/maps/LakeofRage.asm
+++ b/maps/LakeofRage.asm
@@ -25,7 +25,7 @@
 	return
 
 .Wesley
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal WEDNESDAY, .WesleyAppears
 	disappear $b
 	return
@@ -78,7 +78,7 @@
 	cry GYARADOS
 	loadmovesprites
 	loadpokedata GYARADOS, 30
-	writecode $3, BATTLETYPE_SHINY
+	writecode VAR_BATTLETYPE, BATTLETYPE_SHINY
 	startbattle
 	if_equal $1, UnknownScript_0x7007a
 	disappear $a
@@ -249,7 +249,7 @@
 	loadfont
 	checkevent EVENT_GOT_BLACKBELT_FROM_WESLEY
 	iftrue WesleyWednesdayScript
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal WEDNESDAY, WesleyNotWednesdayScript
 	checkevent EVENT_MET_WESLEY_OF_WEDNESDAY
 	iftrue .MetWesley
--- a/maps/MahoganyGym.asm
+++ b/maps/MahoganyGym.asm
@@ -24,7 +24,7 @@
 	playsound SFX_GET_BADGE
 	waitbutton
 	setflag $0021
-	checkcode $7
+	checkcode VAR_BADGES
 	scall UnknownScript_0x199af6
 UnknownScript_0x199ac8: ; 0x199ac8
 	checkevent EVENT_GOT_TM16_ICY_WIND
--- a/maps/MountMoonSquare.asm
+++ b/maps/MountMoonSquare.asm
@@ -32,7 +32,7 @@
 UnknownScript_0x7709a: ; 0x7709a
 	checkflag $0058
 	iftrue UnknownScript_0x77117
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal MONDAY, UnknownScript_0x77117
 	checknite
 	iffalse UnknownScript_0x77117
--- a/maps/MountMortarB1F.asm
+++ b/maps/MountMortarB1F.asm
@@ -26,7 +26,7 @@
 	writetext UnknownText_0x7e2c0
 	keeptextopen
 	waitbutton
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_equal $6, UnknownScript_0x7e237
 	writetext UnknownText_0x7e355
 	playsound SFX_CAUGHT_MON
--- a/maps/NationalPark.asm
+++ b/maps/NationalPark.asm
@@ -85,7 +85,7 @@
 ; 0x5c04e
 
 SchoolboyJack1Script: ; 0x5c04e
-	writecode $17, $5
+	writecode VAR_CALLERID, $5
 	talkaftercancel
 	loadfont
 	checkflag $0065
@@ -262,7 +262,7 @@
 ; 0x5c138
 
 PokefanfBeverly1Script: ; 0x5c138
-	writecode $17, $6
+	writecode VAR_CALLERID, $6
 	talkaftercancel
 	loadfont
 	checkflag $007d
--- a/maps/OaksLab.asm
+++ b/maps/OaksLab.asm
@@ -21,7 +21,7 @@
 	keeptextopen
 	setevent EVENT_TALKED_TO_OAK_IN_KANTO
 .CheckBadges
-	checkcode $7
+	checkcode VAR_BADGES
 	if_equal 16, .OpenMtSilver
 	if_equal 8, .Complain
 	jump .AhGood
--- a/maps/OlivineLighthouse2F.asm
+++ b/maps/OlivineLighthouse2F.asm
@@ -56,7 +56,7 @@
 ; 0x5af91
 
 SailorHuey1Script: ; 0x5af91
-	writecode $17, $7
+	writecode VAR_CALLERID, $7
 	talkaftercancel
 	loadfont
 	checkflag $0066
--- a/maps/OlivineLighthouse6F.asm
+++ b/maps/OlivineLighthouse6F.asm
@@ -66,7 +66,7 @@
 	loadmovesprites
 	setevent EVENT_JASMINE_RETURNED_TO_GYM
 	clearevent $06d3
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $0, UnknownScript_0x60c17
 	if_equal $3, UnknownScript_0x60c1e
 	applymovement $2, MovementData_0x60c68
--- a/maps/OlivinePort.asm
+++ b/maps/OlivinePort.asm
@@ -83,7 +83,7 @@
 	loadfont
 	checkevent $0030
 	iffalse UnknownScript_0x7494e
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal SUNDAY, UnknownScript_0x74977
 	if_equal SATURDAY, UnknownScript_0x74977
 	if_equal TUESDAY, UnknownScript_0x74981
@@ -155,7 +155,7 @@
 	iftrue UnknownScript_0x74919
 	checkevent $0030
 	iffalse UnknownScript_0x749c0
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal SUNDAY, UnknownScript_0x749f2
 	if_equal SATURDAY, UnknownScript_0x749f2
 	if_equal TUESDAY, UnknownScript_0x749f8
@@ -173,7 +173,7 @@
 	closetext
 	loadmovesprites
 	setevent $0001
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $3, UnknownScript_0x749e5
 	applymovement $0, MovementData_0x74a3f
 	jump SailorScript_0x748c0
--- a/maps/PokeCenter2F.asm
+++ b/maps/PokeCenter2F.asm
@@ -547,7 +547,7 @@
 UnknownScript_0x192bc4: ; 0x192bc4
 	checkflag $0063
 	iftrue UnknownScript_0x192bec
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $2, UnknownScript_0x192bdc
 	if_equal $3, UnknownScript_0x192be4
 	applymovement2 MovementData_0x192cd2
@@ -568,7 +568,7 @@
 ; 0x192bec
 
 UnknownScript_0x192bec: ; 0x192bec
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $3, UnknownScript_0x192c00
 	if_equal $2, UnknownScript_0x192c0a
 	applymovement2 MovementData_0x192d33
@@ -590,7 +590,7 @@
 	writetext UnknownText_0x193266
 	closetext
 	loadmovesprites
-	checkcode $9
+	checkcode VAR_FACING
 	if_not_equal $1, UnknownScript_0x192c20
 	spriteface $0, LEFT
 UnknownScript_0x192c20: ; 0x192c20
--- a/maps/RadioTower2F.asm
+++ b/maps/RadioTower2F.asm
@@ -174,13 +174,13 @@
 	iffalse UnknownScript_0x5d800
 	checkflag $0060
 	iftrue UnknownScript_0x5d82f
-	checkcode $a
+	checkcode VAR_HOUR
 	if_less_than $12, UnknownScript_0x5d893
 	checkflag $005f
 	iffalse UnknownScript_0x5d80a
 	checkitem BLUE_CARD
 	iffalse UnknownScript_0x5d86b
-	checkcode $18
+	checkcode VAR_BLUECARDBALANCE
 	if_equal $1e, UnknownScript_0x5d87f
 	playmusic MUSIC_BUENAS_PASSWORD
 	writetext UnknownText_0x5de35
@@ -190,7 +190,7 @@
 	closetext
 	loadmovesprites
 	spriteface $b, RIGHT
-	checkcode $9
+	checkcode VAR_FACING
 	if_not_equal $3, UnknownScript_0x5d7be
 	applymovement $0, MovementData_0x5d921
 UnknownScript_0x5d7be: ; 0x5d7be
@@ -208,9 +208,9 @@
 	writetext UnknownText_0x5dfc1
 	closetext
 	loadmovesprites
-	checkcode $18
+	checkcode VAR_BLUECARDBALANCE
 	addvar $1
-	writevarcode $18
+	writevarcode VAR_BLUECARDBALANCE
 	waitbutton
 	playsound SFX_TRANSACTION
 	setflag $0060
@@ -223,7 +223,7 @@
 	special Functionc48f
 	pause 20
 	special RestartMapMusic
-	checkcode $18
+	checkcode VAR_BLUECARDBALANCE
 	if_equal $1e, UnknownScript_0x5d8a4
 	end
 ; 0x5d800
--- a/maps/Route16.asm
+++ b/maps/Route16.asm
@@ -11,9 +11,9 @@
 ; 0x1ad318
 
 UnknownScript_0x1ad318: ; 0x1ad318
-	checkcode $13
+	checkcode VAR_YCOORD
 	if_less_than $5, UnknownScript_0x1ad328
-	checkcode $12
+	checkcode VAR_XCOORD
 	if_greater_than $d, UnknownScript_0x1ad328
 	setflag $0019
 	return
--- a/maps/Route26.asm
+++ b/maps/Route26.asm
@@ -56,7 +56,7 @@
 ; 0x1a4d3f
 
 CooltrainermGaven3Script: ; 0x1a4d3f
-	writecode $17, $b
+	writecode VAR_CALLERID, $b
 	talkaftercancel
 	loadfont
 	checkflag $0067
@@ -207,7 +207,7 @@
 ; 0x1a4dfb
 
 CooltrainerfBeth1Script: ; 0x1a4dfb
-	writecode $17, $c
+	writecode VAR_CALLERID, $c
 	talkaftercancel
 	loadfont
 	checkflag $0068
--- a/maps/Route27.asm
+++ b/maps/Route27.asm
@@ -95,7 +95,7 @@
 ; 0x1a08bf
 
 Bird_keeperJose2Script: ; 0x1a08bf
-	writecode $17, $d
+	writecode VAR_CALLERID, $d
 	talkaftercancel
 	loadfont
 	checkflag $0069
@@ -299,7 +299,7 @@
 ; 0x1a09af
 
 CooltrainerfReena1Script: ; 0x1a09af
-	writecode $17, $e
+	writecode VAR_CALLERID, $e
 	talkaftercancel
 	loadfont
 	checkflag $006a
--- a/maps/Route29.asm
+++ b/maps/Route29.asm
@@ -30,7 +30,7 @@
 	return
 
 .DoesTuscanyAppear
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal TUESDAY, .TuscanyDisappears
 	appear $8
 	return
@@ -108,7 +108,7 @@
 CooltrainerMScript_0x1a0ff1: ; 0x1a0ff1
 	faceplayer
 	loadfont
-	checkcode $10
+	checkcode VAR_BOXSPACE
 	if_equal $0, UnknownScript_0x1a101c
 	checkevent EVENT_LEARNED_TO_CATCH_POKEMON
 	iftrue UnknownScript_0x1a101c
@@ -180,7 +180,7 @@
 	loadfont
 	checkevent EVENT_GOT_PINK_BOW_FROM_TUSCANY
 	iftrue TuscanyTuesdayScript
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal TUESDAY, TuscanyNotTuesdayScript
 	checkevent EVENT_MET_TUSCANY_OF_TUESDAY
 	iftrue .MetTuscany
--- a/maps/Route30.asm
+++ b/maps/Route30.asm
@@ -48,7 +48,7 @@
 ; 0x1a16a6
 
 YoungsterJoey1Script: ; 0x1a16a6
-	writecode $17, $f
+	writecode VAR_CALLERID, $f
 	talkaftercancel
 	loadfont
 	checkflag $006b
--- a/maps/Route31.asm
+++ b/maps/Route31.asm
@@ -42,7 +42,7 @@
 ; 0x1a5453
 
 Bug_catcherWade1Script: ; 0x1a5453
-	writecode $17, $10
+	writecode VAR_CALLERID, $10
 	talkaftercancel
 	loadfont
 	checkflag $006c
--- a/maps/Route32.asm
+++ b/maps/Route32.asm
@@ -24,7 +24,7 @@
 	end
 
 FriedaCallback:
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal FRIDAY, .FriedaAppears
 	disappear $e
 	return
@@ -206,7 +206,7 @@
 	dw FisherRalph1Script
 
 FisherRalph1Script:
-	writecode $17, $11
+	writecode VAR_CALLERID, $11
 	talkaftercancel
 	loadfont
 	checkflag $006d
@@ -374,7 +374,7 @@
 	dw PicnickerLiz1Script
 
 PicnickerLiz1Script:
-	writecode $17, $12
+	writecode VAR_CALLERID, $12
 	talkaftercancel
 	loadfont
 	checkflag $006e
@@ -573,7 +573,7 @@
 	loadfont
 	checkevent EVENT_GOT_POISON_BARB_FROM_FRIEDA
 	iftrue FriedaFridayScript
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal FRIDAY, FriedaNotFridayScript
 	checkevent EVENT_MET_FRIEDA_OF_FRIDAY
 	iftrue .MetFrieda
--- a/maps/Route33.asm
+++ b/maps/Route33.asm
@@ -31,7 +31,7 @@
 ; 0x1ac011
 
 HikerAnthony2Script: ; 0x1ac011
-	writecode $17, $13
+	writecode VAR_CALLERID, $13
 	talkaftercancel
 	loadfont
 	checkflag $006f
--- a/maps/Route34.asm
+++ b/maps/Route34.asm
@@ -56,7 +56,7 @@
 	loadmovesprites
 	if_equal $1, UnknownScript_0x7805a
 	clearflag $0005
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $3, UnknownScript_0x7805b
 	applymovement $8, MovementData_0x78333
 	playsound SFX_ENTER_DOOR
@@ -107,7 +107,7 @@
 ; 0x7807d
 
 CamperTodd1Script: ; 0x7807d
-	writecode $17, $14
+	writecode VAR_CALLERID, $14
 	talkaftercancel
 	loadfont
 	checkflag $0070
@@ -264,7 +264,7 @@
 ; 0x7815f
 
 PicnickerGina1Script: ; 0x7815f
-	writecode $17, $15
+	writecode VAR_CALLERID, $15
 	talkaftercancel
 	loadfont
 	checkflag $0071
--- a/maps/Route35.asm
+++ b/maps/Route35.asm
@@ -56,7 +56,7 @@
 ; 0x19c8cf
 
 JugglerIrwin1Script: ; 0x19c8cf
-	writecode $17, $16
+	writecode VAR_CALLERID, $16
 	talkaftercancel
 	loadfont
 	checkcellnum $16
@@ -253,7 +253,7 @@
 ; 0x19c97b
 
 Bug_catcherArnie1Script: ; 0x19c97b
-	writecode $17, $17
+	writecode VAR_CALLERID, $17
 	talkaftercancel
 	loadfont
 	checkflag $0072
--- a/maps/Route35Goldenrodgate.asm
+++ b/maps/Route35Goldenrodgate.asm
@@ -21,7 +21,7 @@
 	writetext UnknownText_0x69e48
 	keeptextopen
 	waitbutton
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_equal $6, UnknownScript_0x69d79
 	writetext UnknownText_0x69eb8
 	playsound SFX_KEY_ITEM
--- a/maps/Route35NationalParkgate.asm
+++ b/maps/Route35NationalParkgate.asm
@@ -43,7 +43,7 @@
 ; 0x6a1af
 
 UnknownScript_0x6a1af: ; 0x6a1af
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal TUESDAY, UnknownScript_0x6a1ca
 	if_equal THURSDAY, UnknownScript_0x6a1ca
 	if_equal SATURDAY, UnknownScript_0x6a1ca
@@ -66,7 +66,7 @@
 	applymovement $0, MovementData_0x6a2e2
 	spriteface $2, RIGHT
 	loadfont
-	checkcode $11
+	checkcode VAR_11
 	addvar $1
 	RAM2MEM $0
 	writetext UnknownText_0x6a79a
@@ -91,7 +91,7 @@
 ; 0x6a204
 
 OfficerScript_0x6a204: ; 0x6a204
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal SUNDAY, UnknownScript_0x6a2c7
 	if_equal MONDAY, UnknownScript_0x6a2c7
 	if_equal WEDNESDAY, UnknownScript_0x6a2c7
@@ -104,7 +104,7 @@
 	writetext UnknownText_0x6a2eb
 	yesorno
 	iffalse UnknownScript_0x6a2a3
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_greater_than $1, UnknownScript_0x6a271
 	special Function13a12
 	clearevent $0308
@@ -130,7 +130,7 @@
 ; 0x6a261
 
 UnknownScript_0x6a261: ; 0x6a261
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $2, UnknownScript_0x6a26c
 	applymovement $0, MovementData_0x6a2e5
 	end
@@ -142,9 +142,9 @@
 ; 0x6a271
 
 UnknownScript_0x6a271: ; 0x6a271
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_less_than $6, UnknownScript_0x6a27d
-	checkcode $10
+	checkcode VAR_BOXSPACE
 	if_equal $0, UnknownScript_0x6a2b5
 
 UnknownScript_0x6a27d: ; 6a27d
--- a/maps/Route36.asm
+++ b/maps/Route36.asm
@@ -22,7 +22,7 @@
 ; 0x19400f
 
 ArthurCallback:
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal THURSDAY, .ArthurAppears
 	disappear $8
 	return
@@ -111,7 +111,7 @@
 	closetext
 	loadmovesprites
 	clearevent $0768
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $1, UnknownScript_0x1940ac
 	applymovement $9, MovementData_0x19424e
 	disappear $9
@@ -197,7 +197,7 @@
 ; 0x194100
 
 SchoolboyAlan1Script: ; 0x194100
-	writecode $17, $18
+	writecode VAR_CALLERID, $18
 	talkaftercancel
 	loadfont
 	checkflag $0073
@@ -383,7 +383,7 @@
 	loadfont
 	checkevent EVENT_GOT_HARD_STONE_FROM_ARTHUR
 	iftrue ArthurThursdayScript
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal THURSDAY, ArthurNotThursdayScript
 	checkevent EVENT_MET_ARTHUR_OF_THURSDAY
 	iftrue .MetArthur
--- a/maps/Route36NationalParkgate.asm
+++ b/maps/Route36NationalParkgate.asm
@@ -45,7 +45,7 @@
 UnknownScript_0x6ab23: ; 0x6ab23
 	checkevent $02d2
 	iftrue UnknownScript_0x6ab46
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal TUESDAY, UnknownScript_0x6ab42
 	if_equal THURSDAY, UnknownScript_0x6ab42
 	if_equal SATURDAY, UnknownScript_0x6ab42
@@ -66,7 +66,7 @@
 UnknownScript_0x6ab47: ; 0x6ab47
 	spriteface $0, UP
 	loadfont
-	checkcode $11
+	checkcode VAR_11
 	addvar $1
 	RAM2MEM $0
 	writetext UnknownText_0x6b284
@@ -144,7 +144,7 @@
 ; 0x6abe0
 
 OfficerScript_0x6abe0: ; 0x6abe0
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal SUNDAY, UnknownScript_0x6acf1
 	if_equal MONDAY, UnknownScript_0x6acf1
 	if_equal WEDNESDAY, UnknownScript_0x6acf1
@@ -157,7 +157,7 @@
 	writetext UnknownText_0x6add5
 	yesorno
 	iffalse UnknownScript_0x6ac73
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_greater_than $1, UnknownScript_0x6ac41
 	special Function13a12
 	clearevent $0308
@@ -185,9 +185,9 @@
 ; 0x6ac41
 
 UnknownScript_0x6ac41: ; 0x6ac41
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_less_than $6, UnknownScript_0x6ac4d
-	checkcode $10
+	checkcode VAR_BOXSPACE
 	if_equal $0, UnknownScript_0x6ac85
 UnknownScript_0x6ac4d: ; 0x6ac4d
 	special Function71ac
--- a/maps/Route37.asm
+++ b/maps/Route37.asm
@@ -10,7 +10,7 @@
 	dbw 2, SunnyCallback
 
 SunnyCallback:
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal SUNDAY, .SunnyAppears
 	disappear $6
 	return
@@ -111,7 +111,7 @@
 	loadfont
 	checkevent EVENT_GOT_MAGNET_FROM_SUNNY
 	iftrue SunnySundayScript
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal SUNDAY, SunnyNotSundayScript
 	checkevent EVENT_MET_SUNNY_OF_SUNDAY
 	iftrue .MetSunny
--- a/maps/Route38.asm
+++ b/maps/Route38.asm
@@ -85,7 +85,7 @@
 ; 0x1a1d42
 
 LassDana1Script: ; 0x1a1d42
-	writecode $17, $1a
+	writecode VAR_CALLERID, $1a
 	talkaftercancel
 	loadfont
 	checkflag $0074
@@ -258,7 +258,7 @@
 ; 0x1a1e3b
 
 SchoolboyChad1Script: ; 0x1a1e3b
-	writecode $17, $1b
+	writecode VAR_CALLERID, $1b
 	talkaftercancel
 	loadfont
 	checkflag $0075
--- a/maps/Route39.asm
+++ b/maps/Route39.asm
@@ -36,7 +36,7 @@
 ; 0x1a5b0b
 
 PokefanmDerek1Script: ; 0x1a5b0b
-	writecode $17, $1c
+	writecode VAR_CALLERID, $1c
 	talkaftercancel
 	loadfont
 	checkflag $0083
--- a/maps/Route40.asm
+++ b/maps/Route40.asm
@@ -11,7 +11,7 @@
 
 MonicaCallback:
 	clearevent $07cf
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal MONDAY, .MonicaAppears
 	disappear $a
 	return
@@ -163,7 +163,7 @@
 	loadfont
 	checkevent EVENT_GOT_SHARP_BEAK_FROM_MONICA
 	iftrue MonicaMondayScript
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_not_equal MONDAY, MonicaNotMondayScript
 	checkevent EVENT_MET_MONICA_OF_MONDAY
 	iftrue .MetMonica
--- a/maps/Route42.asm
+++ b/maps/Route42.asm
@@ -52,7 +52,7 @@
 ; 0x1a923f
 
 FisherTully1Script: ; 0x1a923f
-	writecode $17, $1d
+	writecode VAR_CALLERID, $1d
 	talkaftercancel
 	loadfont
 	checkflag $0076
--- a/maps/Route43.asm
+++ b/maps/Route43.asm
@@ -101,7 +101,7 @@
 ; 0x19d095
 
 PokemaniacBrent1Script: ; 0x19d095
-	writecode $17, $1e
+	writecode VAR_CALLERID, $1e
 	talkaftercancel
 	loadfont
 	checkflag $0077
@@ -294,7 +294,7 @@
 ; 0x19d17c
 
 PicnickerTiffany3Script: ; 0x19d17c
-	writecode $17, $1f
+	writecode VAR_CALLERID, $1f
 	talkaftercancel
 	loadfont
 	checkflag $0078
--- a/maps/Route43Gate.asm
+++ b/maps/Route43Gate.asm
@@ -37,7 +37,7 @@
 
 UnknownScript_0x19abda: ; 0x19abda
 	playmusic MUSIC_ROCKET_ENCOUNTER
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $0, UnknownScript_0x19abea
 	if_equal $1, UnknownScript_0x19ac38
 	dotrigger $1
--- a/maps/Route44.asm
+++ b/maps/Route44.asm
@@ -27,7 +27,7 @@
 ; 0x19d830
 
 Bird_keeperVance1Script: ; 0x19d830
-	writecode $17, $20
+	writecode VAR_CALLERID, $20
 	talkaftercancel
 	loadfont
 	checkflag $0079
@@ -222,7 +222,7 @@
 ; 0x19d92e
 
 FisherWilton1Script: ; 0x19d92e
-	writecode $17, $21
+	writecode VAR_CALLERID, $21
 	talkaftercancel
 	loadfont
 	checkflag $007a
--- a/maps/Route45.asm
+++ b/maps/Route45.asm
@@ -27,7 +27,7 @@
 ; 0x19e0ad
 
 BlackbeltKenji3Script: ; 0x19e0ad
-	writecode $17, $22
+	writecode VAR_CALLERID, $22
 	talkaftercancel
 	loadfont
 	checkcellnum $22
@@ -54,7 +54,7 @@
 ; 0x19e0e4
 
 UnknownScript_0x19e0e4: ; 0x19e0e4
-	checkcode $1a
+	checkcode VAR_1A
 	if_not_equal $1, UnknownScript_0x19e127
 	checkmorn
 	iftrue UnknownScript_0x19e10c
@@ -223,7 +223,7 @@
 ; 0x19e17e
 
 HikerParry3Script: ; 0x19e17e
-	writecode $17, $23
+	writecode VAR_CALLERID, $23
 	talkaftercancel
 	loadfont
 	checkflag $007b
--- a/maps/Route46.asm
+++ b/maps/Route46.asm
@@ -56,7 +56,7 @@
 ; 0x1a96a0
 
 PicnickerErin1Script: ; 0x1a96a0
-	writecode $17, $24
+	writecode VAR_CALLERID, $24
 	talkaftercancel
 	loadfont
 	checkflag $007c
--- a/maps/RuinsofAlphKabutoChamber.asm
+++ b/maps/RuinsofAlphKabutoChamber.asm
@@ -99,7 +99,7 @@
 ScientistScript_0x587a8: ; 0x587a8
 	faceplayer
 	loadfont
-	checkcode $e
+	checkcode VAR_UNOWNCOUNT
 	if_equal 26, UnknownScript_0x587cf
 	checkevent EVENT_WALL_OPENED_IN_KABUTO_CHAMBER
 	iftrue UnknownScript_0x587c9
--- a/maps/RuinsofAlphOutside.asm
+++ b/maps/RuinsofAlphOutside.asm
@@ -31,7 +31,7 @@
 ; 0x5801e
 
 UnknownScript_0x5801e: ; 0x5801e
-	checkcode $e
+	checkcode VAR_UNOWNCOUNT
 	if_greater_than $2, UnknownScript_0x58027
 	jump UnknownScript_0x5802c
 ; 0x58027
--- a/maps/RuinsofAlphResearchCenter.asm
+++ b/maps/RuinsofAlphResearchCenter.asm
@@ -68,7 +68,7 @@
 ScientistScript_0x591d1: ; 0x591d1
 	faceplayer
 	loadfont
-	checkcode $e
+	checkcode VAR_UNOWNCOUNT
 	if_equal 26, UnknownScript_0x591df
 	writetext UnknownText_0x59311
 	closetext
@@ -86,7 +86,7 @@
 ScientistScript_0x591e5: ; 0x591e5
 	faceplayer
 	loadfont
-	checkcode $e
+	checkcode VAR_UNOWNCOUNT
 	if_equal 26, UnknownScript_0x5920b
 	checkflag $000c
 	iftrue UnknownScript_0x59205
@@ -123,7 +123,7 @@
 ScientistScript_0x59214: ; 0x59214
 	faceplayer
 	loadfont
-	checkcode $e
+	checkcode VAR_UNOWNCOUNT
 	if_equal 26, UnknownScript_0x5922e
 	checkevent EVENT_MADE_UNOWN_APPEAR_IN_RUINS
 	iftrue UnknownScript_0x59228
@@ -151,7 +151,7 @@
 	loadfont
 	checkevent $0704
 	iftrue UnknownScript_0x59241
-	checkcode $e
+	checkcode VAR_UNOWNCOUNT
 	if_equal 26, UnknownScript_0x59247
 UnknownScript_0x59241: ; 0x59241
 	writetext UnknownText_0x597b6
@@ -171,7 +171,7 @@
 	loadfont
 	checkevent $0704
 	iftrue UnknownScript_0x5925a
-	checkcode $e
+	checkcode VAR_UNOWNCOUNT
 	if_equal 26, UnknownScript_0x59260
 UnknownScript_0x5925a: ; 0x5925a
 	writetext UnknownText_0x5980e
--- a/maps/TeamRocketBaseB1F.asm
+++ b/maps/TeamRocketBaseB1F.asm
@@ -464,7 +464,7 @@
 	cry VOLTORB
 	special Function8c079
 	setlasttalked $ff
-	writecode $3, BATTLETYPE_TRAP
+	writecode VAR_BATTLETYPE, BATTLETYPE_TRAP
 	loadpokedata VOLTORB, 23
 	startbattle
 	end
@@ -474,7 +474,7 @@
 	cry GEODUDE
 	special Function8c079
 	setlasttalked $ff
-	writecode $3, BATTLETYPE_TRAP
+	writecode VAR_BATTLETYPE, BATTLETYPE_TRAP
 	loadpokedata GEODUDE, 21
 	startbattle
 	end
@@ -484,7 +484,7 @@
 	cry KOFFING
 	special Function8c079
 	setlasttalked $ff
-	writecode $3, BATTLETYPE_TRAP
+	writecode VAR_BATTLETYPE, BATTLETYPE_TRAP
 	loadpokedata KOFFING, 21
 	startbattle
 	end
--- a/maps/TeamRocketBaseB2F.asm
+++ b/maps/TeamRocketBaseB2F.asm
@@ -178,7 +178,7 @@
 	loadmovesprites
 	dotrigger $1
 	setevent $004c
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $3, UnknownScript_0x6d0be
 	applymovement $4, MovementData_0x6d212
 	disappear $4
--- a/maps/TinTower1F.asm
+++ b/maps/TinTower1F.asm
@@ -122,7 +122,7 @@
 	cry SUICUNE
 	pause 20
 	loadpokedata SUICUNE, 40
-	writecode $3, BATTLETYPE_SUICUNE
+	writecode VAR_BATTLETYPE, BATTLETYPE_SUICUNE
 	startbattle
 	reloadmapmusic
 	disappear $2
--- a/maps/TinTowerRoof.asm
+++ b/maps/TinTowerRoof.asm
@@ -36,7 +36,7 @@
 	pause 15
 	loadmovesprites
 	setevent EVENT_FOUGHT_HO_OH
-	writecode $3, BATTLETYPE_FORCEITEM
+	writecode VAR_BATTLETYPE, BATTLETYPE_FORCEITEM
 	loadpokedata HO_OH, 60
 	startbattle
 	disappear $2
--- a/maps/UnionCaveB2F.asm
+++ b/maps/UnionCaveB2F.asm
@@ -13,7 +13,7 @@
 UnknownScript_0x5a30d: ; 0x5a30d
 	checkflag $0059
 	iftrue UnknownScript_0x5a319
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal FRIDAY, UnknownScript_0x5a31c
 UnknownScript_0x5a319: ; 0x5a319
 	disappear $7
--- a/maps/VermilionCity.asm
+++ b/maps/VermilionCity.asm
@@ -48,7 +48,7 @@
 	pause 15
 	cry SNORLAX
 	loadmovesprites
-	writecode $3, BATTLETYPE_FORCEITEM
+	writecode VAR_BATTLETYPE, BATTLETYPE_FORCEITEM
 	loadpokedata SNORLAX, 50
 	startbattle
 	disappear $6
@@ -61,7 +61,7 @@
 	loadfont
 	checkevent EVENT_GOT_HP_UP_FROM_VERMILION_GUY
 	iftrue .AlreadyGotItem
-	checkcode $7
+	checkcode VAR_BADGES
 	if_equal 16, .AllBadges
 	if_greater_than 13, .MostBadges
 	if_greater_than 9, .SomeBadges
--- a/maps/VermilionPort.asm
+++ b/maps/VermilionPort.asm
@@ -85,7 +85,7 @@
 	iftrue UnknownScript_0x74e86
 	spriteface $0, LEFT
 	loadfont
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal MONDAY, UnknownScript_0x74e72
 	if_equal TUESDAY, UnknownScript_0x74e72
 	if_equal THURSDAY, UnknownScript_0x74e7c
@@ -147,7 +147,7 @@
 	loadfont
 	checkevent $0000
 	iftrue UnknownScript_0x74e1a
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal MONDAY, UnknownScript_0x74eda
 	if_equal TUESDAY, UnknownScript_0x74eda
 	if_equal THURSDAY, UnknownScript_0x74ee0
--- a/maps/VictoryRoadGate.asm
+++ b/maps/VictoryRoadGate.asm
@@ -29,7 +29,7 @@
 	loadfont
 	writetext UnknownText_0x9ba29
 	keeptextopen
-	checkcode $7
+	checkcode VAR_BADGES
 	if_greater_than 7, UnknownScript_0x9ba19
 	writetext UnknownText_0x9ba5f
 	closetext
--- a/maps/VioletGym.asm
+++ b/maps/VioletGym.asm
@@ -24,7 +24,7 @@
 	playsound SFX_GET_BADGE
 	waitbutton
 	setflag $001b
-	checkcode $7
+	checkcode VAR_BADGES
 	scall UnknownScript_0x68418
 UnknownScript_0x683ec: ; 0x683ec
 	checkevent EVENT_GOT_TM31_MUD_SLAP
--- a/maps/VioletPokeCenter1F.asm
+++ b/maps/VioletPokeCenter1F.asm
@@ -19,7 +19,7 @@
 UnknownScript_0x694d7: ; 0x694d7
 	yesorno
 	iffalse UnknownScript_0x69531
-	checkcode $1
+	checkcode VAR_PARTYCOUNT
 	if_equal $6, UnknownScript_0x6952b
 	giveegg TOGEPI, 5
 	stringtotext .eggname, $1
@@ -31,7 +31,7 @@
 	writetext UnknownText_0x695c5
 	closetext
 	loadmovesprites
-	checkcode $9
+	checkcode VAR_FACING
 	if_equal $1, .UnknownScript_0x69511
 	spriteface $0, DOWN
 	applymovement $6, MovementData_0x69549
--- a/maps/WarehouseEntrance.asm
+++ b/maps/WarehouseEntrance.asm
@@ -47,7 +47,7 @@
 ; 0x7c082
 
 UnknownScript_0x7c082: ; 0x7c082
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal MONDAY, UnknownScript_0x7c0a5
 	if_equal TUESDAY, UnknownScript_0x7c0b5
 	if_equal WEDNESDAY, UnknownScript_0x7c0be
@@ -231,7 +231,7 @@
 
 GrannyScript_0x7c132: ; 0x7c132
 	loadfont
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal SUNDAY, UnknownScript_0x7c140
 	if_equal SATURDAY, UnknownScript_0x7c140
 	jump UnknownScript_0x7c300
@@ -247,7 +247,7 @@
 	loadfont
 	checkflag $0056
 	iftrue UnknownScript_0x7c300
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal MONDAY, UnknownScript_0x7c156
 	jump UnknownScript_0x7c300
 ; 0x7c156
@@ -262,7 +262,7 @@
 
 SuperNerdScript_0x7c161: ; 0x7c161
 	loadfont
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal TUESDAY, UnknownScript_0x7c173
 	if_equal THURSDAY, UnknownScript_0x7c173
 	if_equal SATURDAY, UnknownScript_0x7c173
@@ -354,7 +354,7 @@
 
 SuperNerdScript_0x7c20e: ; 0x7c20e
 	loadfont
-	checkcode $b
+	checkcode VAR_WEEKDAY
 	if_equal SUNDAY, UnknownScript_0x7c220
 	if_equal WEDNESDAY, UnknownScript_0x7c220
 	if_equal FRIDAY, UnknownScript_0x7c220
--- a/maps/WhirlIslandLugiaChamber.asm
+++ b/maps/WhirlIslandLugiaChamber.asm
@@ -36,7 +36,7 @@
 	pause 15
 	loadmovesprites
 	setevent EVENT_FOUGHT_LUGIA
-	writecode $3, BATTLETYPE_FORCEITEM
+	writecode VAR_BATTLETYPE, BATTLETYPE_FORCEITEM
 	loadpokedata LUGIA, 60
 	startbattle
 	disappear $2