v0.2-BETA

enabled over 95% of functions back, such as:
pokemon, index, indexof, exp, movePP, moveID, bridge, etc
This commit is contained in:
bouletmarc 2015-05-25 18:52:34 -04:00
parent 1df131ce79
commit a4eedba1f5
17 changed files with 241 additions and 615 deletions

View File

@ -68,17 +68,13 @@ local function recover()
end end
local function openBattleMenu() local function openBattleMenu()
--if Memory.value("battle", "text") == 1 then
if Memory.value("battle", "text") == 3 then if Memory.value("battle", "text") == 3 then
Input.cancel() Input.cancel()
return false return false
end end
local battleMenu = Memory.value("battle", "menu") local battleMenu = Memory.value("battle", "menu")
--local col = Menu.getCol()
--if battleMenu == 106 or (battleMenu == 94 and col == 5) then
if battleMenu == 106 then if battleMenu == 106 then
return true return true
--elseif battleMenu == 94 then
elseif battleMenu == 186 then elseif battleMenu == 186 then
local rowSelected = Memory.value("battle", "menuY") local rowSelected = Memory.value("battle", "menuY")
local columnSelected = Memory.value("battle", "menuX") local columnSelected = Memory.value("battle", "menuX")
@ -100,7 +96,6 @@ local function attack(attackIndex)
if Memory.double("battle", "opponent_hp") < 1 then if Memory.double("battle", "opponent_hp") < 1 then
Input.cancel() Input.cancel()
elseif openBattleMenu() then elseif openBattleMenu() then
--Menu.select(attackIndex, true, false, false, false, 3)
Menu.select(attackIndex, true, false, false, 3) Menu.select(attackIndex, true, false, false, 3)
end end
end end
@ -110,7 +105,6 @@ function movePP(name)
if not midx then if not midx then
return 0 return 0
end end
--return Memory.raw(0x102C + midx)
return Memory.raw(0x0634 + midx) return Memory.raw(0x0634 + midx)
end end
Battle.pp = movePP Battle.pp = movePP
@ -157,7 +151,6 @@ end
function Battle.run() function Battle.run()
if Memory.double("battle", "opponent_hp") < 1 then if Memory.double("battle", "opponent_hp") < 1 then
Input.cancel() Input.cancel()
--elseif Memory.value("battle", "menu") ~= 94 then
elseif Memory.value("battle", "menu") ~= 186 then elseif Memory.value("battle", "menu") ~= 186 then
--if Memory.value("menu", "text_length") == 127 then --if Memory.value("menu", "text_length") == 127 then
-- Input.press("B") -- Input.press("B")
@ -166,27 +159,18 @@ function Battle.run()
--Input.cancel() --Input.cancel()
--end --end
elseif Memory.value("battle", "menu") == 186 then elseif Memory.value("battle", "menu") == 186 then
--elseif Textbox.handle() then Input.escape()
--local rowSelected = Memory.value("battle", "menuY")
--local columnSelected = Memory.value("battle", "menuX")
--local selected = Memory.value("menu", "selection")
--if selected == 239 then
--if rowSelected == 2 and columnSelected == 2 then
-- Input.press("A", 2)
--else
Input.escape()
--end
end end
end end
function Battle.handle() function Battle.handle()
--if not Control.shouldCatch() then if not Control.shouldCatch() then
--if Control.shouldFight() then if Control.shouldFight() then
-- Battle.fight() Battle.fight()
--else else
Battle.run() Battle.run()
--end end
--end end
end end
function Battle.handleWild() function Battle.handleWild()
@ -238,7 +222,7 @@ end
end]] end]]
function Battle.automate(moveName, skipBuffs) function Battle.automate(moveName, skipBuffs)
--if not recover() then if not recover() then
local state = Memory.value("game", "battle") local state = Memory.value("game", "battle")
if state == 0 then if state == 0 then
Input.cancel() Input.cancel()
@ -247,21 +231,21 @@ function Battle.automate(moveName, skipBuffs)
moveName = nil moveName = nil
end end
if state == 1 then if state == 1 then
--if Control.shouldFight() then if Control.shouldFight() then
-- Battle.fight(moveName, skipBuffs) Battle.fight(moveName, skipBuffs)
--else else
Battle.run() Battle.run()
--end end
elseif state == 2 then elseif state == 2 then
Battle.fight(moveName, skipBuffs) Battle.fight(moveName, skipBuffs)
end end
end end
--end end
end end
-- SACRIFICE -- SACRIFICE
--[[function Battle.sacrifice(...) function Battle.sacrifice(...)
local sacrifice = Pokemon.getSacrifice(...) local sacrifice = Pokemon.getSacrifice(...)
if sacrifice then if sacrifice then
Battle.swap(sacrifice) Battle.swap(sacrifice)
@ -270,7 +254,7 @@ end
return false return false
end end
function Battle.redeployNidoking() --[[function Battle.redeployNidoking()
if Pokemon.isDeployed("nidoking") then if Pokemon.isDeployed("nidoking") then
return false return false
end end

View File

@ -4,7 +4,6 @@ local Input = require "util.input"
local Memory = require "util.memory" local Memory = require "util.memory"
local Menu = require "util.menu" local Menu = require "util.menu"
--local alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ *():;[]ab-?!mf/.,"
local alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ -?1/., " local alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ -?1/., "
local alphabet_lower = "abcdefghijklmnopqrstuvw<yz x():;[]{}" local alphabet_lower = "abcdefghijklmnopqrstuvw<yz x():;[]{}"
-- < = special X -- < = special X
@ -30,8 +29,7 @@ end
function Textbox.name(letter, randomize) function Textbox.name(letter, randomize)
local inputting = false local inputting = false
--if letter ~= TOTODILE_NAME and Memory.value("menu", "current") == 231 then --french if letter ~= TOTODILE_NAME and Memory.value("menu", "current") == 232 then
if letter ~= TOTODILE_NAME and Memory.value("menu", "current") == 232 then --english
inputting = true inputting = true
elseif letter == TOTODILE_NAME and Memory.value("menu", "option_current") == 17 then elseif letter == TOTODILE_NAME and Memory.value("menu", "option_current") == 17 then
inputting = true inputting = true
@ -44,7 +42,6 @@ function Textbox.name(letter, randomize)
local ccol local ccol
local dcol local dcol
local NameTable = {} local NameTable = {}
local Waiting
--if letter then --if letter then
--RUNNING4NEWGAME = false --make sure it's not running if we begin a game --RUNNING4NEWGAME = false --make sure it's not running if we begin a game
@ -83,7 +80,6 @@ function Textbox.name(letter, randomize)
end end
end end
lidx = getIndexForLetter(NameTable[TableNumber], GetUpper) lidx = getIndexForLetter(NameTable[TableNumber], GetUpper)
--lidx = getIndexForLetter(string.upper(NameTable[TableNumber]))
--end --end
--Check For Waiting --Check For Waiting
local Waiting = Input.isWaiting() local Waiting = Input.isWaiting()
@ -109,7 +105,6 @@ function Textbox.name(letter, randomize)
end end
--Get/Set Letter --Get/Set Letter
else else
--local LineIndex = math.ceil(lidx/9)
crow = Memory.value("text_inputing", "row") crow = Memory.value("text_inputing", "row")
drow = math.ceil(lidx/9)-1 drow = math.ceil(lidx/9)-1
if crow < drow then if crow < drow then
@ -124,7 +119,6 @@ function Textbox.name(letter, randomize)
elseif ccol > dcol then elseif ccol > dcol then
Input.press("Left", 2) Input.press("Left", 2)
elseif ccol == dcol then elseif ccol == dcol then
--if Menu.sidle(ccol, dcol, 8, true) then
Input.press("A", 2) Input.press("A", 2)
if Memory.value("menu", "text_length") == TableNumber then if Memory.value("menu", "text_length") == TableNumber then
TableNumber = TableNumber + 1 TableNumber = TableNumber + 1

View File

@ -75,7 +75,11 @@ function step(dx, dy, hold)
if px == dx and py == dy then if px == dx and py == dy then
return true return true
end end
Input.press(dir(px, py, dx, dy), 0, hold) --get waiting before inputing
local Waiting = Input.isWaiting()
if not Waiting then
Input.press(dir(px, py, dx, dy), 0, hold)
end
end end
Walk.step = step Walk.step = step

View File

@ -256,7 +256,6 @@ local function activePokemon(preset)
hp = Memory.double("battle", "our_hp"), hp = Memory.double("battle", "our_hp"),
att = Memory.double("battle", "our_attack"), att = Memory.double("battle", "our_attack"),
def = Memory.double("battle", "our_defense"), def = Memory.double("battle", "our_defense"),
--spec = Memory.double("battle", "our_special"),
spec_att = Memory.double("battle", "our_special_attack"), spec_att = Memory.double("battle", "our_special_attack"),
spec_def = Memory.double("battle", "our_special_defense"), spec_def = Memory.double("battle", "our_special_defense"),
speed = Memory.double("battle", "our_speed"), speed = Memory.double("battle", "our_speed"),
@ -285,7 +284,6 @@ local function activePokemon(preset)
hp = Memory.double("battle", "opponent_hp"), hp = Memory.double("battle", "opponent_hp"),
att = Memory.double("battle", "opponent_attack"), att = Memory.double("battle", "opponent_attack"),
def = Memory.double("battle", "opponent_defense"), def = Memory.double("battle", "opponent_defense"),
--spec = Memory.double("battle", "our_special"),
spec_att = Memory.double("battle", "our_special_attack"), spec_att = Memory.double("battle", "our_special_attack"),
spec_def = Memory.double("battle", "our_special_defense"), spec_def = Memory.double("battle", "our_special_defense"),
speed = Memory.double("battle", "opponent_speed"), speed = Memory.double("battle", "opponent_speed"),

View File

@ -23,9 +23,9 @@ Control.moonEncounters = nil
Control.getMoonExp = true Control.getMoonExp = true
Control.yolo = false Control.yolo = false
--[[local function withinOneKill(forExp) local function withinOneKill(forExp)
return Pokemon.getExp() + 80 > forExp return Pokemon.getExp() + 80 > forExp
end]] end
local controlFunctions = { local controlFunctions = {
@ -52,10 +52,6 @@ local controlFunctions = {
Combat.factorPP(data.on) Combat.factorPP(data.on)
end, end,
setThrash = function(data)
Combat.disableThrash = data.disable
end,
disableCatch = function() disableCatch = function()
shouldCatch = nil shouldCatch = nil
shouldFight = nil shouldFight = nil
@ -109,7 +105,7 @@ local function isNewFight()
end end
end end
--[[function Control.shouldFight() function Control.shouldFight()
if not shouldFight then if not shouldFight then
return false return false
end end
@ -129,7 +125,7 @@ end
end end
end end
end end
end`]] end
function Control.canCatch(partySize) function Control.canCatch(partySize)
if not partySize then if not partySize then
@ -145,7 +141,7 @@ function Control.canCatch(partySize)
return true return true
end end
--[[function Control.shouldCatch(partySize) function Control.shouldCatch(partySize)
if maxEncounters and encounters > maxEncounters then if maxEncounters and encounters > maxEncounters then
local extraCount = extraEncounter and Pokemon.inParty(extraEncounter) local extraCount = extraEncounter and Pokemon.inParty(extraEncounter)
if not extraCount or encounters > maxEncounters + 1 then if not extraCount or encounters > maxEncounters + 1 then
@ -183,7 +179,7 @@ end
end end
end end
end end
end]] end
-- Items -- Items
@ -252,20 +248,19 @@ function Control.encounter(battleState)
--end --end
end end
else else
--if opponentHP == 0 and shouldCatch and not Control.killedCatch then if opponentHP == 0 and shouldCatch and not Control.killedCatch then
--if opponentHP == 0 and shouldCatch then local gottaCatchEm = {"pidgey", "spearow", "paras", "oddish"}
--local gottaCatchEm = {"pidgey", "spearow", "paras", "oddish"} local opponent = Battle.opponent()
--local opponent = Battle.opponent() for i,catch in ipairs(gottaCatchEm) do
--for i,catch in ipairs(gottaCatchEm) do if opponent == catch then
-- if opponent == catch then if not Pokemon.inParty(catch) then
-- if not Pokemon.inParty(catch) then Bridge.chat("accidentally killed "..Utils.capitalize(catch).." with a "..(isCritical and "critical" or "high damage range").." :(")
-- Bridge.chat("accidentally killed "..Utils.capitalize(catch).." with a "..(isCritical and "critical" or "high damage range").." :(") Control.killedCatch = true
-- Control.killedCatch = true end
-- end break
-- break end
-- end end
--end end
--end
end end
end end
elseif Control.inBattle then elseif Control.inBattle then
@ -279,8 +274,8 @@ end
function Control.reset() function Control.reset()
canDie = false canDie = false
oneHits = false oneHits = false
--shouldCatch = nil shouldCatch = nil
--shouldFight = nil shouldFight = nil
extraEncounter = nil extraEncounter = nil
potionInBattle = true potionInBattle = true
encounters = 0 encounters = 0

View File

@ -122,18 +122,6 @@ end]]
local strategyFunctions = Strategies.functions local strategyFunctions = Strategies.functions
--[[strategyFunctions.grabPCPotion = function()
if Inventory.contains("potion") then
return true
end
Player.interact("Up")
end
strategyFunctions.checkStrats = function()
UsingSTRATS = STRATS
return true
end]]
strategyFunctions.talk_mom = function() strategyFunctions.talk_mom = function()
if Strategies.initialize() then if Strategies.initialize() then
status.tempDir = false status.tempDir = false

View File

@ -48,176 +48,6 @@ local Opponents = {
move_type = "normal", move_type = "normal",
} }
} }
},
HypnoConfusion = {
type1 = "psychic",
type2 = "psychic",
def = 58,
id = 129,
spec = 88,
hp = 107,
speed = 56,
level = 34,
att = 60,
moves = {
{
name = "Confusion",
accuracy = 100,
power = 50,
id = 93,
special = true,
max_pp = 25,
move_type = "psychic",
}
}
},
KogaWeezing = {
type1 = "poison",
type2 = "poison",
def = 115,
id = 143,
spec = 84,
hp = 115,
speed = 63,
level = 43,
att = 90,
moves = {
{
name = "Self-Destruct",
accuracy = 100,
power = 260,
id = 120,
special = false,
max_pp = 5,
move_type = "normal",
}
}
},
GiovanniRhyhorn = {
type1 = "ground",
type2 = "rock",
def = 97,
id = 18,
spec = 39,
hp = 134,
speed = 34,
level = 45,
att = 89,
moves = {
{
name = "Stomp",
move_type = "normal",
accuracy = 100,
power = 65,
id = 23,
special = false,
max_pp = 20,
damage = 21,
}
}
},
LoreleiDewgong = {
type1 = "water",
type2 = "ice",
def = 100,
id = 120,
spec = 116,
hp = 169,
speed = 89,
level = 54,
att = 90,
moves = {
{
name = "Aurora-Beam",
accuracy = 100,
power = 65,
id = 62,
special = true,
max_pp = 20,
move_type = "ice",
}
},
boost = {
stat = "spec",
mp = 2 / 3
}
},
LanceGyarados = {
type1 = "water",
type2 = "flying",
def = 105,
id = 22,
spec = 130,
hp = 187,
speed = 108,
level = 58,
att = 160,
moves = {
{
name = "Hydro-Pump",
accuracy = 80,
power = 120,
id = 56,
special = true,
max_pp = 5,
move_type = "water",
}
},
boost = {
stat = "spec",
mp = 1.5
}
},
BluePidgeot = {
type1 = "normal",
type2 = "flying",
def = 106,
id = 151,
spec = 100,
hp = 182,
speed = 125,
level = 61,
att = 113,
moves = {
{
name = "Wing-Attack",
accuracy = 100,
power = 35,
id = 17,
special = false,
max_pp = 35,
move_type = "flying",
}
}
},
BlueSky = {
type1 = "normal",
type2 = "flying",
def = 106,
id = 151,
spec = 100,
hp = 182,
speed = 125,
level = 61,
att = 113,
moves = {
{
name = "Sky-Attack",
accuracy = 90,
power = 140,
id = 143,
special = false,
max_pp = 5,
move_type = "flying",
}
}
},]] },]]
} }

126
main.lua
View File

@ -9,7 +9,7 @@ RESET_FOR_TIME = false -- Set to false if you just want to see the bot finish
RESET_FOR_ENCOUNTERS = false -- Set to false if you just want to see the bot finish a run without reset for encounters RESET_FOR_ENCOUNTERS = false -- Set to false if you just want to see the bot finish a run without reset for encounters
--Game Settings --Game Settings
GAME_NAME = "Crystal" -- Set to Gold/Silver or Crystal GAME_NAME = "Crystal" -- Set to Gold/Silver(not done) or Crystal
GAME_RUN = "" -- Set to "" or "" for the run you want GAME_RUN = "" -- Set to "" or "" for the run you want
GAME_HOURS = 17 -- Set the internal game hour (0-23h) GAME_HOURS = 17 -- Set the internal game hour (0-23h)
GAME_MINUTES = 35 -- Set the internal game minutes (0-59min) GAME_MINUTES = 35 -- Set the internal game minutes (0-59min)
@ -24,14 +24,6 @@ GAME_PRINT_STYLE = 127 -- Set the print style (64=normal // 96=dark // 127=dar
GAME_ACCOUNT_STYLE = 0 -- Set the account style (0-1 // no-yes) GAME_ACCOUNT_STYLE = 0 -- Set the account style (0-1 // no-yes)
GAME_WINDOWS_STYLE = 3 -- Set the windows style (0-7) GAME_WINDOWS_STYLE = 3 -- Set the windows style (0-7)
--GAME_TEXT_SPEED = 249 -- Set the Text Speed (247-249 // slow-fast)
--GAME_BATTLE_ANIMATION = 141 -- Set the battle animation (141-142 // no-yes)
--GAME_BATTLE_STYLE = 131 -- Set the battle style (130-131 // choice-set)
--GAME_SOUND_STYLE = 132 -- Set the sound style (132 or 141 // stereo-mono)
--GAME_PRINT_STYLE = 127 -- Set the print style (64=normal // 96=dark // 127=dark+ // 0=clear+ // 32=clear)
--GAME_ACCOUNT_STYLE = 0 -- Set the account style (0-1 // no-yes)
--GAME_WINDOWS_STYLE = 3 -- Set the windows style (0-7)
--Connection Settings --Connection Settings
INTERNAL = false -- Allow connection with LiveSplit ? INTERNAL = false -- Allow connection with LiveSplit ?
STREAMING_MODE = false -- Enable Streaming mode STREAMING_MODE = false -- Enable Streaming mode
@ -67,17 +59,13 @@ PRINT_STEP = false -- Print the current step in the console.
-- SET VALUES -- SET VALUES
local VERSION = "1.0" local VERSION = "0.2-BETA"
--YELLOW = memory.getcurrentmemorydomainsize() > 30000
local START_WAIT = 99 local START_WAIT = 99
local hasAlreadyStartedPlaying = false local hasAlreadyStartedPlaying = false
local oldSeconds local oldSeconds
local running = true local running = true
local lastHP local lastHP
--FirstSpawnDone = false
--FirstSpawnDone2 = false
--RUNNING4CONTINUE = false --used to continue a game --RUNNING4CONTINUE = false --used to continue a game
--RUNNING4NEWGAME = true --used to make a new game (remove last save also) --RUNNING4NEWGAME = true --used to make a new game (remove last save also)
@ -85,21 +73,6 @@ local lastHP
--local InternalDone = false --used when the above settings are done internally --local InternalDone = false --used when the above settings are done internally
--local UsingCustomPath = false --used when we set a custom path --local UsingCustomPath = false --used when we set a custom path
-- SET DIR
--[[local lowerGameRun = string.lower(GAME_RUN)
local lowerGameName = string.lower(GAME_NAME)
local secondStratDir = ""
local secondPaintDir = ""
if lowerGameRun == "no save corruption" then
if lowerGameName == "red" or lowerGameName == "blue" then
secondStratDir = ".red-blue"
secondPaintDir = secondStratDir
end
else
secondStratDir = YELLOW and ".yellow" or ".red-blue"
end]]
-- LOAD DIR -- LOAD DIR
local LowerGameName = string.lower(GAME_NAME) local LowerGameName = string.lower(GAME_NAME)
@ -152,8 +125,6 @@ local function resetAll()
Bridge.reset() Bridge.reset()
oldSeconds = 0 oldSeconds = 0
running = false running = false
--FirstSpawnDone = false
--FirstSpawnDone2 = false
-- client.speedmode = 200 -- client.speedmode = 200
if CUSTOM_SEED then if CUSTOM_SEED then
@ -175,9 +146,9 @@ p("Actually running Pokemon "..GAME_NAME.." Speedruns by "..OWNER, true)
Control.init() Control.init()
--STREAMING_MODE = not walk.init() --STREAMING_MODE = not walk.init()
--if INTERNAL and STREAMING_MODE then if INTERNAL and STREAMING_MODE then
-- RESET_FOR_TIME = true RESET_FOR_TIME = true
--end end
if CUSTOM_SEED then if CUSTOM_SEED then
client.reboot_core() client.reboot_core()
@ -190,11 +161,11 @@ if RESET_FOR_TIME and hasAlreadyStartedPlaying then
RESET_FOR_TIME = false RESET_FOR_TIME = false
p("Disabling time-limit resets as the game is already running. Please reset the emulator and restart the script if you'd like to go for a fast time.", true) p("Disabling time-limit resets as the game is already running. Please reset the emulator and restart the script if you'd like to go for a fast time.", true)
end end
--if STREAMING_MODE then if STREAMING_MODE then
-- Bridge.init() Bridge.init()
--else else
Input.setDebug(true) Input.setDebug(true)
--end end
--if PATH_IDX ~= 0 and STEP_IDX ~= 0 then --if PATH_IDX ~= 0 and STEP_IDX ~= 0 then
-- UsingCustomPath = true -- UsingCustomPath = true
@ -226,58 +197,35 @@ while true do
--end --end
if not Input.update() then if not Input.update() then
--if not Utils.ingame() then
if not Utils.ingame() and currentMap == 0 then if not Utils.ingame() and currentMap == 0 then
--if not Utils.ingame() and currentMap == 0 and currentMap2 == 0 then --if not Utils.ingame() and currentMap == 0 and currentMap2 == 0 then
--if currentMap == 0 then if running then
if running then if not hasAlreadyStartedPlaying then
if not hasAlreadyStartedPlaying then client.reboot_core()
client.reboot_core() --remove this for the new bizhawk hasAlreadyStartedPlaying = true
hasAlreadyStartedPlaying = true
else
--if not RUNNING4CONTINUE then
resetAll() --reset if not running to continue
--RUNNING4NEWGAME = true --set back on in case we done a reboot
--else
-- running = false --continue adventure
--end
end
else else
--if UsingCustomPath then --if not RUNNING4CONTINUE then
-- if not EXTERNALDONE then --continue adventure resetAll() --reset if not running to continue
-- RUNNING4CONTINUE, RUNNING4NEWGAME = true, false --RUNNING4NEWGAME = true --set back on in case we done a reboot
-- elseif EXTERNALDONE and InternalDone then --else
-- RUNNING4NEWGAME = true --set back to new game -- running = false --continue adventure
-- end
--end --end
Settings.startNewAdventure(START_WAIT) --start/continue adventure
end end
--else else
--if not running then --if UsingCustomPath then
-- Bridge.liveSplit() -- if not EXTERNALDONE then --continue adventure
-- running = true -- RUNNING4CONTINUE, RUNNING4NEWGAME = true, false
-- elseif EXTERNALDONE and InternalDone then
-- RUNNING4NEWGAME = true --set back to new game
-- end
--end --end
--Settings.choosePlayerNames() --set names Settings.startNewAdventure(START_WAIT) --start/continue adventure
--end end
else else
if not running then if not running then
--Bridge.liveSplit() Bridge.liveSplit()
running = true running = true
end end
--open and close menu for first spawn
--if Settings.FirstSpawn() then
--[[local Done = false
local MenuValue = Memory.value("menu", "main")
if MenuValue ~= 121 and Textbox.isActive() then
Input.press("Start", 2)
elseif MenuValue == 121 then
Input.press("B", 2)
Done = true
elseif MenuValue == 2 and not Textbox.isActive() and Done then
FirstSpawn = false
end
end]]
--else
--if RUNNING4NEWGAME then --remove last save game --if RUNNING4NEWGAME then --remove last save game
-- Settings.RemoveLastAdventure(START_WAIT) -- Settings.RemoveLastAdventure(START_WAIT)
--elseif RUNNING4CONTINUE then --continue the last adventure --elseif RUNNING4CONTINUE then --continue the last adventure
@ -287,18 +235,17 @@ while true do
--else --else
local battleState = Memory.value("game", "battle") local battleState = Memory.value("game", "battle")
Control.encounter(battleState) Control.encounter(battleState)
--local curr_hp = Pokemon.index(0, "hp") local curr_hp = Pokemon.index(0, "hp")
--if curr_hp == 0 and not Control.canDie() and Pokemon.index(0) > 0 then if curr_hp == 0 and not Control.canDie() and Pokemon.index(0) > 0 then
-- Strategies.death(currentMap, currentMap2) Strategies.death(currentMap, currentMap2)
--elseif Walk.strategy then elseif Walk.strategy then
if Walk.strategy then
if Strategies.execute(Walk.strategy) then if Strategies.execute(Walk.strategy) then
Walk.traverse(currentMap, currentMap2) Walk.traverse(currentMap, currentMap2)
end end
elseif battleState > 0 then elseif battleState > 0 then
--if not Control.shouldCatch(partySize) then if not Control.shouldCatch(partySize) then
Battle.automate() Battle.automate()
--end end
elseif Textbox.handle() then elseif Textbox.handle() then
Walk.traverse(currentMap, currentMap2) Walk.traverse(currentMap, currentMap2)
end end
@ -306,14 +253,13 @@ while true do
end end
end end
--[[if STREAMING_MODE then if STREAMING_MODE then
local newSeconds = Memory.value("time", "seconds") local newSeconds = Memory.value("time", "seconds")
if newSeconds ~= oldSeconds and (newSeconds > 0 or Memory.value("time", "frames") > 0) then if newSeconds ~= oldSeconds and (newSeconds > 0 or Memory.value("time", "frames") > 0) then
Bridge.time(Utils.elapsedTime()) Bridge.time(Utils.elapsedTime())
oldSeconds = newSeconds oldSeconds = newSeconds
end end
elseif PAINT_ON then]] elseif PAINT_ON then
if PAINT_ON then
Paint.draw(currentMap, currentMap2) Paint.draw(currentMap, currentMap2)
end end

View File

@ -9,53 +9,6 @@ local Pokemon = require "storage.pokemon"
local ItemList = require "storage.itemlist" local ItemList = require "storage.itemlist"
--[[local items = {
pokeball = 4,
bicycle = 6,
moon_stone = 10,
antidote = 11,
burn_heal = 12,
paralyze_heal = 15,
full_restore = 16,
super_potion = 19,
potion = 20,
escape_rope = 29,
carbos = 38,
repel = 30,
rare_candy = 40,
helix_fossil = 42,
nugget = 49,
pokedoll = 51,
super_repel = 56,
fresh_water = 60,
soda_pop = 61,
coin_case = 69,
pokeflute = 73,
ether = 80,
max_ether = 81,
elixer = 82,
x_accuracy = 46,
x_speed = 67,
x_special = 68,
cut = 196,
fly = 197,
surf = 198,
strength = 199,
horn_drill = 207,
bubblebeam = 211,
water_gun = 212,
ice_beam = 213,
thunderbolt = 224,
earthquake = 226,
dig = 228,
tm34 = 234,
rock_slide = 248,
}]]
local ITEM_BASE = Memory.value("inventory", "item_base") local ITEM_BASE = Memory.value("inventory", "item_base")
-- Data -- Data
@ -139,7 +92,6 @@ end
function Inventory.use(item, poke, midfight, BagMenu) function Inventory.use(item, poke, midfight, BagMenu)
if midfight then if midfight then
local battleMenu = Memory.value("battle", "menu") local battleMenu = Memory.value("battle", "menu")
--if battleMenu == 94 then
--open bag menu --open bag menu
if battleMenu == 186 then if battleMenu == 186 then
local rowSelected = Memory.value("battle", "menuY") local rowSelected = Memory.value("battle", "menuY")
@ -154,7 +106,6 @@ function Inventory.use(item, poke, midfight, BagMenu)
else else
Input.press("Left") Input.press("Left")
end end
--elseif battleMenu == 233 then
--inside bag menu --inside bag menu
elseif battleMenu == 128 then elseif battleMenu == 128 then
--if its not done --if its not done
@ -177,9 +128,9 @@ function Inventory.use(item, poke, midfight, BagMenu)
end end
elseif Utils.onPokemonSelect(battleMenu) then elseif Utils.onPokemonSelect(battleMenu) then
if poke then if poke then
--if type(poke) == "string" then if type(poke) == "string" then
-- poke = Pokemon.indexOf(poke) poke = Pokemon.indexOf(poke)
--end end
Menu.select(poke, true, "input") Menu.select(poke, true, "input")
else else
Input.press("A") Input.press("A")
@ -231,41 +182,6 @@ function Inventory.use(item, poke, midfight, BagMenu)
else else
return false return false
end end
--####################################
--[[if main == 144 then
if Memory.value("battle", "menu") == 95 then
Input.press("B")
else
local idx = 0
if poke then
idx = Pokemon.indexOf(poke)
end
Menu.select(idx, true)
end
elseif main == 128 or main == 60 then
if column == 5 then
Menu.select(Inventory.indexOf(item), "accelerate", true)
elseif column == 11 then
Menu.select(2, true)
elseif column == 14 then
Menu.select(0, true)
else
local index = 0
if poke then
index = Pokemon.indexOf(poke)
end
Menu.select(index, true)
end
elseif main == 228 then
if column == 14 and Memory.value("battle", "menu") == 95 then
Input.press("B")
end
elseif main == Menu.pokemon then
Input.press("B")
else
return false
end]]
return true return true
end end

View File

@ -62,47 +62,58 @@ local moveList = {
rock_slide = 157, rock_slide = 157,
} }
--[[local data = { local data = {
hp = {1, true}, moves = {2},
status = {4},
moves = {8}, exp = {7, true, true}, --0x1CE7
pp = {28},
level = {33}, pp = {23},
max_hp = {34, true},
level = {31},
attack = {36, true}, status = {32},
defense = {38, true},
speed = {40, true}, hp = {34, true},
special = {42, true}, max_hp = {36, true},
}]] attack = {38, true},
defense = {40, true},
speed = {42, true},
special_attack = {44, true},
special_defense = {46, true},
}
local previousPartySize local previousPartySize
--[[local function getAddress(index) local function getAddress(index)
return 0x116B + index * 0x2C return 0x1CDF + index * 0x30 --+48 index
end]] end
--local function index(index, offset) local function index(index, offset)
--[[local function index(index)
local double local double
--if not offset then local triple
-- offset = 0 if not offset then
--else offset = 0
-- local dataTable = data[offset] else
-- offset = dataTable[1] local dataTable = data[offset]
-- double = dataTable[2] offset = dataTable[1]
--end double = dataTable[2]
triple = dataTable[3]
end
local address = getAddress(index) + offset local address = getAddress(index) + offset
local address = getAddress(index)
local value = Memory.raw(address) local value = Memory.raw(address)
if double then if double and not triple then
value = value + Memory.raw(address + 1) value = value + Memory.raw(address + 1)
elseif double and triple then
--read double exp
value = value * 256 + Memory.raw(address + 1)
--read triple exp
value = value * 256 + Memory.raw(address + 2)
end end
return value return value
end end
Pokemon.index = index]] Pokemon.index = index
--[[local function indexOf(...) local function indexOf(...)
for ni,name in ipairs(arg) do for ni,name in ipairs(arg) do
local pid = pokeIDs[name] local pid = pokeIDs[name]
for i=0,5 do for i=0,5 do
@ -114,7 +125,7 @@ Pokemon.index = index]]
end end
return -1 return -1
end end
Pokemon.indexOf = indexOf]] Pokemon.indexOf = indexOf
-- Table functions -- Table functions
@ -128,7 +139,7 @@ function Pokemon.battleMove(name)
end end
end end
--[[function Pokemon.moveIndex(move, pokemon) function Pokemon.moveIndex(move, pokemon)
local pokemonIdx local pokemonIdx
if pokemon then if pokemon then
pokemonIdx = indexOf(pokemon) pokemonIdx = indexOf(pokemon)
@ -142,13 +153,11 @@ end
return i return i
end end
end end
end]] end
--function Pokemon.info(name, offset) function Pokemon.info(name, offset)
--[[function Pokemon.info(name) return index(indexOf(name), offset)
--return index(indexOf(name), offset) end
return index(indexOf(name))
end]]
function Pokemon.getID(name) function Pokemon.getID(name)
return pokeIDs[name] return pokeIDs[name]
@ -162,24 +171,24 @@ function Pokemon.getName(id)
end end
end end
--[[function Pokemon.getSacrifice(...) function Pokemon.getSacrifice(...)
for i,name in ipairs(arg) do for i,name in ipairs(arg) do
local pokemonIndex = indexOf(name) local pokemonIndex = indexOf(name)
if pokemonIndex ~= -1 and index(pokemonIndex, "hp") > 0 then if pokemonIndex ~= -1 and index(pokemonIndex, "hp") > 0 then
return name return name
end end
end end
end]] end
--[[function Pokemon.inParty(...) function Pokemon.inParty(...)
for i,name in ipairs(arg) do for i,name in ipairs(arg) do
if indexOf(name) ~= -1 then if indexOf(name) ~= -1 then
return name return name
end end
end end
end]] end
--[[function Pokemon.forMove(move) function Pokemon.forMove(move)
local moveID = moveList[move] local moveID = moveList[move]
for i=0,5 do for i=0,5 do
local address = getAddress(i) local address = getAddress(i)
@ -190,28 +199,29 @@ end]]
end end
end end
return -1 return -1
end]] end
--[[function Pokemon.hasMove(move) function Pokemon.hasMove(move)
return Pokemon.forMove(move) ~= -1 return Pokemon.forMove(move) ~= -1
end]] end
function Pokemon.updateParty() function Pokemon.updateParty()
local partySize = Memory.value("player", "party_size") local partySize = Memory.value("player", "party_size")
if partySize ~= previousPartySize then if partySize ~= previousPartySize then
--local poke = Pokemon.inParty("tododile", "paras", "spearow", "pidgey", "nidoran", "squirtle") --local poke = Pokemon.inParty("tododile", "paras", "spearow", "pidgey", "nidoran", "squirtle")
--local poke = Pokemon.inParty("tododile") local poke = Pokemon.inParty("tododile")
--if poke then if poke then
-- Bridge.caught(poke) Bridge.caught(poke)
-- previousPartySize = partySize previousPartySize = partySize
--end end
end end
end end
--[[function Pokemon.pp(index, move) function Pokemon.pp(index, move)
local midx = Pokemon.battleMove(move) local midx = Pokemon.battleMove(move)
return Memory.raw(getAddress(index) + 28 + midx) --return Memory.raw(getAddress(index) + 28 + midx)
end]] return Memory.raw(getAddress(index) + 22 + midx) --movePP address = +22
end
-- General -- General
@ -238,14 +248,19 @@ function Pokemon.isEvolving()
--return Memory.value("menu", "pokemon") == 144 --return Memory.value("menu", "pokemon") == 144
end end
--[[function Pokemon.getExp() function Pokemon.getExp(name)
return Memory.raw(0x117A) * 256 + Memory.raw(0x117B) local Index = 0
end]] if name then
Index = indexOf(name)
end
return index(Index, "exp")
--return Memory.raw(0x117A) * 256 + Memory.raw(0x117B)
end
--[[function Pokemon.inRedBar() function Pokemon.inRedBar()
local curr_hp, max_hp = index(0, "hp"), index(0, "max_hp") local curr_hp, max_hp = index(0, "hp"), index(0, "max_hp")
return curr_hp / max_hp <= 0.2 return curr_hp / max_hp <= 0.2
end]] end
function Pokemon.use(move) function Pokemon.use(move)
--local main = Memory.value("menu", "main") --local main = Memory.value("menu", "main")
@ -313,13 +328,13 @@ function Pokemon.use(move)
return true return true
end end
--[[function Pokemon.getDVs(name) function Pokemon.getDVs(name)
local index = Pokemon.indexOf(name) local index = Pokemon.indexOf(name)
local baseAddress = getAddress(index) local baseAddress = getAddress(index)
local attackDefense = Memory.raw(baseAddress + 0x1B) local attackDefense = Memory.raw(baseAddress + 0x14) --+20 index
local speedSpecial = Memory.raw(baseAddress + 0x1C) local speedSpecial = Memory.raw(baseAddress + 0x15) --+21 index
return bit.rshift(attackDefense, 4), bit.band(attackDefense, 15), bit.rshift(speedSpecial, 4), bit.band(speedSpecial, 15) return bit.rshift(attackDefense, 4), bit.band(attackDefense, 15), bit.rshift(speedSpecial, 4), bit.band(speedSpecial, 15)
end]] end
return Pokemon return Pokemon

View File

@ -1,9 +1,9 @@
local Bridge = {} local Bridge = {}
--local socket local socket
--if INTERNAL then if INTERNAL then
-- socket = require("socket") socket = require("socket")
--end end
local utils = require("util.utils") local utils = require("util.utils")
@ -21,7 +21,7 @@ local function send(prefix, body)
end end
end end
--[[local function readln() local function readln()
if client then if client then
local s, status, partial = client:receive("*l") local s, status, partial = client:receive("*l")
if status == "closed" then if status == "closed" then
@ -32,11 +32,11 @@ end
return s return s
end end
end end
end]] end
-- Wrapper functions -- Wrapper functions
--[[function Bridge.init() function Bridge.init()
if socket then if socket then
-- io.popen("java -jar Main.jar") -- io.popen("java -jar Main.jar")
client = socket.connect("127.0.0.1", 13378) client = socket.connect("127.0.0.1", 13378)
@ -49,9 +49,9 @@ end]]
print("Error connecting to Java!"); print("Error connecting to Java!");
end end
end end
end]] end
--[[function Bridge.tweet(message) function Bridge.tweet(message)
if INTERNAL and STREAMING_MODE then if INTERNAL and STREAMING_MODE then
print("tweet::"..message) print("tweet::"..message)
return send("tweet", message) return send("tweet", message)
@ -70,7 +70,7 @@ function Bridge.chat(message, extra, newLine)
p(message, newLine) p(message, newLine)
end end
return send("msg", "/me "..message) return send("msg", "/me "..message)
end]] end
function Bridge.time(message) function Bridge.time(message)
if not timeStopped then if not timeStopped then
@ -82,7 +82,7 @@ function Bridge.stats(message)
return send("stats", message) return send("stats", message)
end end
--[[function Bridge.command(command) function Bridge.command(command)
return send("livesplit_command", command); return send("livesplit_command", command);
end end
@ -100,7 +100,7 @@ function Bridge.process()
end end
end end
end]] end
function Bridge.input(key) function Bridge.input(key)
send("input", key) send("input", key)
@ -116,7 +116,7 @@ function Bridge.hp(curr, max)
send("hp", curr..","..max) send("hp", curr..","..max)
end end
--[[function Bridge.liveSplit() function Bridge.liveSplit()
send("start") send("start")
timeStopped = false timeStopped = false
end end
@ -126,7 +126,7 @@ function Bridge.split(finished)
timeStopped = true timeStopped = true
end end
send("split") send("split")
end]] end
function Bridge.encounter() function Bridge.encounter()
send("encounter") send("encounter")

View File

@ -113,9 +113,6 @@ function Input.escape()
end end
end end
end end
--local inputTable = {Right=true, Down=true}
--joypad.set(inputTable)
--bridgeButton("D,R")
end end
function Input.clear() function Input.clear()

View File

@ -29,12 +29,12 @@ local memoryNames = {
column = 0x0F65, column = 0x0F65,
current = 0x00DF, --32=off 79=on instead of 20=on current = 0x00DF, --32=off 79=on instead of 20=on
size = 0x0FA3, size = 0x0FA3,
option_current = 0x0F84,--DONE used while settings options (5=startmenu, 7=optionmenu) option_current = 0x0F84,--used while settings options (5=startmenu, 7=optionmenu)
shop_current = 0x0F87, --DONE 95=main 94=buy 80=ammount 30=accept 74=sell instead of 32=main 158/161=amount 20=buy/accept 248=sell shop_current = 0x0F87, --95=main 94=buy 80=ammount 30=accept 74=sell instead of 32=main 158/161=amount 20=buy/accept 248=sell
selection = 0x0F78, --DONE ?? going like 1 or 2 or 4 etc... selection = 0x0F78, --going like 1 or 2 or 4 etc...
text_input = 0x0F69, --DONE 65=inputing text_input = 0x0F69, --65=inputing
text_length = 0x06D2, --DONE text_length = 0x06D2,
main = 0x04AA, --DONE 121=open main = 0x04AA, --21=open
--pokemon = 0x0C51, --TO DO, USED WHILE EVOLVING --pokemon = 0x0C51, --TO DO, USED WHILE EVOLVING
--selection_mode = 0x0C35, --TO DO, USED WHEN SWAPING MOVE --selection_mode = 0x0C35, --TO DO, USED WHEN SWAPING MOVE
--transaction_current = 0x0F8B,--TODO, USED FOR SHOPPING --transaction_current = 0x0F8B,--TODO, USED FOR SHOPPING
@ -64,37 +64,39 @@ local memoryNames = {
--inside_area = 0x02D0, --can be used while inside a area we can use escape_rope? --inside_area = 0x02D0, --can be used while inside a area we can use escape_rope?
}, },
time = { time = {
hours = 0x14C4, --DONE or 0xD4C5 hours = 0x14C4, --or 0xD4C5
minutes = 0x14C6, --DONE minutes = 0x14C6,
seconds = 0x14C7, --DONE seconds = 0x14C7,
frames = 0x14C8, --DONE frames = 0x14C8,
}, },
shop = { shop = {
transaction_amount = 0x110C,--DONE transaction_amount = 0x110C,
}, },
battle = { battle = {
text = 0x0FCF, --DONE 1=11(texting) // 3=1(not) text = 0x0FCF, --1=11(texting) // 3=1(not)
menu = 0x0FB6, --DONE 106=106(att) // 186=94(free) // 128=233(item) // 145=224(pkmon) menu = 0x0FB6, --106=106(att) // 186=94(free) // 128=233(item) // 145=224(pkmon)
menuX = 0x0FAA, --DONE used for battle Row-X menuX = 0x0FAA, --used for battle Row-X
menuY = 0x0FA9, --DONE used for battle Row-Y menuY = 0x0FA9, --used for battle Row-Y
battle_turns = 0x06DD, --DONE?? USED FOR DSUM ESCAPE?? battle_turns = 0x06DD, --USED FOR DSUM ESCAPE??
opponent_id = 0x1206, --DONE or 0x1204 opponent_id = 0x1206, --or 0x1204
opponent_level = 0x1213, --DONE opponent_level = 0x1213,
opponent_type1 = 0x1224, --DONE opponent_type1 = 0x1224,
opponent_type2 = 0x1225, --DONE opponent_type2 = 0x1225,
opponent_move_id = 0x1208, --DONE used to get opponent moves ID --opponent_move_id = 0x1208, --used to get opponent moves ID
opponent_move_pp = 0x120E, --DONE used to get opponent moves PP --opponent_move_pp = 0x120E, --used to get opponent moves PP
our_id = 0x1205, --DONE old=1014 our_id = 0x1205, --old=1014
our_status = 0x063A, --DONE our_status = 0x063A,
our_level = 0x0639, --DONE our_level = 0x0639,
our_type1 = 0x064A, --DONE our_type1 = 0x064A,
our_type2 = 0x064B, --DONE our_type2 = 0x064B,
our_move_id = 0x062E, --DONE used to get our moves ID --our_move_id = 0x062E, --used to get our moves ID
our_move_pp = 0x0634, --DONE used to get our moves PP --our_move_pp = 0x0634, --used to get our moves PP
--attack_turns = 0x06DC, --DONE?? NOT USED?? --our_pokemon_list = 0x1288 --used to retract any of our pokemon values (slot 1-6)
--attack_turns = 0x06DC, --NOT USED??
--accuracy = 0x0D1E, --accuracy = 0x0D1E,
--x_accuracy = 0x1063, --x_accuracy = 0x1063,
--disabled = 0x0CEE, --disabled = 0x0CEE,
@ -122,21 +124,21 @@ local memoryNames = {
local doubleNames = { local doubleNames = {
battle = { battle = {
opponent_hp = 0x1216, --DONE 10FF index +278? // opponent_hp = 0x1216, --10FF index +278? //
opponent_max_hp = 0x1218, --DONE opponent_max_hp = 0x1218,
opponent_attack = 0x121A, --DONE opponent_attack = 0x121A,
opponent_defense = 0x121C, --DONE opponent_defense = 0x121C,
opponent_speed = 0x121E, --DONE opponent_speed = 0x121E,
opponent_special_attack = 0x1220,--DONE opponent_special_attack = 0x1220,
opponent_special_defense = 0x1222,--DONE opponent_special_defense = 0x1222,
our_hp = 0x063C, --DONE our_hp = 0x063C,
our_max_hp = 0x063E, --DONE our_max_hp = 0x063E,
our_attack = 0x0640, --DONE our_attack = 0x0640,
our_defense = 0x0642, --DONE our_defense = 0x0642,
our_speed = 0x0644, --DONE our_speed = 0x0644,
our_special_attack = 0x0646, --DONE our_special_attack = 0x0646,
our_special_defense = 0x0648, --DONE our_special_defense = 0x0648,
}, },
--[[pokemon = { --[[pokemon = {
@ -177,12 +179,22 @@ function Memory.double(section, key)
return raw(first) + raw(first + 1) return raw(first) + raw(first + 1)
end end
function Memory.value(section, key, forYellow) --function Memory.value(section, key, forYellow)
function Memory.value(section, key)
local memoryAddress = memoryNames[section] local memoryAddress = memoryNames[section]
if key then if key then
memoryAddress = memoryAddress[key] memoryAddress = memoryAddress[key]
end end
return raw(memoryAddress, forYellow) --return raw(memoryAddress, forYellow)
return raw(memoryAddress)
end
function Memory.getAddress(section, key)
local memoryAddress = memoryNames[section]
if key then
memoryAddress = memoryAddress[key]
end
return memoryAddress
end end
return Memory return Memory

View File

@ -20,15 +20,11 @@ local function getRow(menuType)
menuType = "row" menuType = "row"
end end
local row = Memory.value("menu", menuType) local row = Memory.value("menu", menuType)
--if scrolls then
-- row = row + Memory.value("menu", "scroll_offset")
--end
return row return row
end end
--local function setRow(desired, throttle, scrolls, menuType, loop) --local function setRow(desired, throttle, scrolls, menuType, loop)
local function setRow(desired, throttle, menuType, loop) local function setRow(desired, throttle, menuType, loop)
--local currentRow = getRow(menuType, scrolls)
local currentRow = getRow(menuType) local currentRow = getRow(menuType)
if throttle == "accelerate" then if throttle == "accelerate" then
if sliding then if sliding then
@ -45,11 +41,7 @@ local function setRow(desired, throttle, menuType, loop)
else else
sliding = false sliding = false
end end
--if menuType ~= "hours" or menuType ~= "minutes" then return Menu.balance(currentRow, desired, true, loop, throttle)
return Menu.balance(currentRow, desired, true, loop, throttle)
--else
-- return Menu.balance(currentRow, desired, false, loop, throttle)
--end
end end
local function isCurrently(desired, menuType) local function isCurrently(desired, menuType)
@ -87,7 +79,6 @@ function Menu.select(option, throttle, menuType, dontPress, loop)
else else
menuTypeSent = menuType menuTypeSent = menuType
end end
--if setRow(option, throttle, scrolls, menuType, loop) then
if setRow(option, throttle, menuTypeSent, loop) then if setRow(option, throttle, menuTypeSent, loop) then
local delay = 1 local delay = 1
if throttle or menuType == "option" then if throttle or menuType == "option" then
@ -120,7 +111,6 @@ function Menu.balance(current, desired, inverted, looping, throttle)
else else
throttle = 1 throttle = 1
end end
--local goUp = current > desired == inverted
local goUp local goUp
if inverted then if inverted then
if desired < current then if desired < current then
@ -182,7 +172,6 @@ function Menu.setOption(name, desired)
if Memory.value("setting", name) == desired then if Memory.value("setting", name) == desired then
return true return true
end end
--if setRow(rowFor[name], true, false, "settings") then
if setRow(rowFor[name], 2, "settings") then if setRow(rowFor[name], 2, "settings") then
Menu.setCol(desired, false, 2) Menu.setCol(desired, false, 2)
end end
@ -193,11 +182,9 @@ end
function Menu.isOpen() function Menu.isOpen()
return Memory.value("game", "textbox") == 1 or Memory.value("menu", "current") == 79 return Memory.value("game", "textbox") == 1 or Memory.value("menu", "current") == 79
--return Memory.value("game", "textbox") == 1 or Memory.value("menu", "current") == 24
end end
function Menu.close() function Menu.close()
--if Memory.value("game", "textbox") == 0 and Memory.value("menu", "main") < 8 then
if Memory.value("game", "textbox") == 0 and Memory.value("menu", "main") == 0 then if Memory.value("game", "textbox") == 0 and Memory.value("menu", "main") == 0 then
return true return true
end end

View File

@ -15,7 +15,7 @@ function Paint.draw(currentMap, currentMap2)
drawText(0, 14, currentMap..","..currentMap2.." : "..px.." "..py) drawText(0, 14, currentMap..","..currentMap2.." : "..px.." "..py)
drawText(0, 0, elapsedTime()) drawText(0, 0, elapsedTime())
--[[if Memory.value("game", "battle") > 0 then if Memory.value("game", "battle") > 0 then
local curr_hp = Pokemon.index(0, "hp") local curr_hp = Pokemon.index(0, "hp")
local hpStatus local hpStatus
if curr_hp == 0 then if curr_hp == 0 then
@ -24,7 +24,7 @@ function Paint.draw(currentMap, currentMap2)
hpStatus = "RED" hpStatus = "RED"
end end
if hpStatus then if hpStatus then
drawText(120, 7, hpStatus) drawText(0, 70, hpStatus)
end end
end end
@ -35,13 +35,13 @@ function Paint.draw(currentMap, currentMap2)
local speed = Pokemon.index(tidx, "speed") local speed = Pokemon.index(tidx, "speed")
local scl_att = Pokemon.index(tidx, "special_attack") local scl_att = Pokemon.index(tidx, "special_attack")
local scl_def = Pokemon.index(tidx, "special_defense") local scl_def = Pokemon.index(tidx, "special_defense")
drawText(0, 134, attack.." Att/"..defense.." Def/"..speed.." Spd/"..scl_att.." Scl_Att/"..scl_def.." Scl_Def") drawText(0, 90, attack.." | "..defense.." | "..speed.." | "..scl_att.." | "..scl_def)
end]] end
local enc = " encounter" local enc = " encounter"
if encounters > 1 then if encounters > 1 then
enc = enc.."s" enc = enc.."s"
end end
drawText(0, 90, encounters..enc) drawText(0, 82, encounters..enc)
return true return true
end end

View File

@ -5,7 +5,6 @@ local Textbox = require "action.textbox"
local Input = require "util.input" local Input = require "util.input"
local Memory = require "util.memory" local Memory = require "util.memory"
--local facingDirections = {Up=8, Right=1, Left=2, Down=4}
local facingDirections = {Up=4, Right=12, Left=8, Down=0} local facingDirections = {Up=4, Right=12, Left=8, Down=0}
function Player.isFacing(direction) function Player.isFacing(direction)

View File

@ -8,8 +8,6 @@ local Memory = require "util.memory"
local Menu = require "util.menu" local Menu = require "util.menu"
local Utils = require "util.utils" local Utils = require "util.utils"
--local START_WAIT = 99
--local tempDir --local tempDir
local settings_menu = 7 local settings_menu = 7
@ -74,8 +72,7 @@ function Settings.startNewAdventure(startWait)
end end
--press A or Start --press A or Start
elseif startMenu == 127 then elseif startMenu == 127 then
--if MenuCurrent == 59 then --french if MenuCurrent == 104 then
if MenuCurrent == 104 then --english
Input.press("A", 2) Input.press("A", 2)
else else
if not Setting_done and math.random(0, startWait) == 0 then if not Setting_done and math.random(0, startWait) == 0 then
@ -84,8 +81,7 @@ function Settings.startNewAdventure(startWait)
end end
else else
--Set Name --Set Name
--if MenuCurrent == 79 then --french if MenuCurrent == 110 then
if MenuCurrent == 110 then --english
if InputRow == 1 and GAME_GENDER == 2 then if InputRow == 1 and GAME_GENDER == 2 then
Input.press("Down", 2) Input.press("Down", 2)
elseif InputRow == 2 and GAME_GENDER == 1 then elseif InputRow == 2 and GAME_GENDER == 1 then
@ -95,8 +91,7 @@ function Settings.startNewAdventure(startWait)
end end
--Set hours/minutes/name --Set hours/minutes/name
elseif MenuCurrent == 32 or MenuCurrent == 107 then elseif MenuCurrent == 32 or MenuCurrent == 107 then
--if ShopCurrent == 77 then --french if ShopCurrent == 78 then
if ShopCurrent == 78 then --english
--set hours --set hours
if HoursRow < GAME_HOURS then if HoursRow < GAME_HOURS then
Input.press("Up", 1) Input.press("Up", 1)
@ -115,8 +110,7 @@ function Settings.startNewAdventure(startWait)
Input.press("A", 1) Input.press("A", 1)
end end
end end
--elseif MenuCurrent == 231 then --french elseif MenuCurrent == 232 then
elseif MenuCurrent == 232 then --english
--remake setting not done --remake setting not done
Setting_done = false Setting_done = false
--set our name --set our name
@ -127,25 +121,6 @@ function Settings.startNewAdventure(startWait)
end end
end end
--[[function Settings.FirstSpawn()
if not FirstSpawnDone then
local MenuValue = Memory.value("menu", "main")
if MenuValue == 121 then
Input.press("B", 2)
FirstSpawnDone2 = true
elseif MenuValue == 0 then
if Textbox.isActive() then
Input.press("Start", 2)
elseif not Textbox.isActive() and FirstSpawnDone2 then
FirstSpawnDone = true
return true
end
end
else
return true
end
end]]
--[[function Settings.RemoveLastAdventure(startWait) --[[function Settings.RemoveLastAdventure(startWait)
if not tempDir then if not tempDir then
if Memory.value("menu", "size") ~= 2 and math.random(0, startWait) == 0 then if Memory.value("menu", "size") ~= 2 and math.random(0, startWait) == 0 then
@ -190,21 +165,7 @@ end]]
end end
end]] end]]
--[[function Settings.choosePlayerNames() --[[function Settings.pollForResponse()
local name = PLAYER_NAME
if dirText ~= "glitch" then
if (Memory.value("player", "name") ~= 141) or (Memory.value("player", "name2") ~= 136) then
name = RIVAL_NAME
end
else
if (Memory.value("player", "name") ~= 141) or (Memory.value("player", "name2") ~= 136) then
name = "> "
end
end
Textbox.name(name, true)
end
function Settings.pollForResponse()
local response = Bridge.process() local response = Bridge.process()
if response then if response then
Bridge.polling = false Bridge.polling = false