Merge pull requests
This commit is contained in:
parent
f7365cf176
commit
d63ed66072
11
main.lua
11
main.lua
|
@ -32,7 +32,7 @@ local Settings = require "util.settings"
|
|||
local Pokemon = require "storage.pokemon"
|
||||
|
||||
local hasAlreadyStartedPlaying = false
|
||||
local oldSecs
|
||||
local oldSeconds
|
||||
local running = true
|
||||
local lastHP
|
||||
|
||||
|
@ -64,7 +64,7 @@ local function resetAll()
|
|||
Walk.reset()
|
||||
Paint.reset()
|
||||
Bridge.reset()
|
||||
oldSecs = 0
|
||||
oldSeconds = 0
|
||||
running = false
|
||||
-- client.speedmode = 200
|
||||
|
||||
|
@ -73,6 +73,7 @@ local function resetAll()
|
|||
p("RUNNING WITH A FIXED SEED ("..Strategies.seed.."), every run will play out identically!", true)
|
||||
else
|
||||
Strategies.seed = os.time()
|
||||
print("PokeBot v"..VERSION..": starting a new run with seed "..Strategies.seed)
|
||||
end
|
||||
math.randomseed(Strategies.seed)
|
||||
end
|
||||
|
@ -170,10 +171,10 @@ while true do
|
|||
end
|
||||
|
||||
if STREAMING_MODE then
|
||||
local newSecs = Memory.raw(0x1A44)
|
||||
if newSecs ~= oldSecs and (newSecs > 0 or Memory.raw(0x1A45) > 0) then
|
||||
local newSeconds = Memory.value("time", "seconds")
|
||||
if newSeconds ~= oldSeconds and (newSeconds > 0 or Memory.value("time", "frames") > 0) then
|
||||
Bridge.time(Utils.elapsedTime())
|
||||
oldSecs = newSecs
|
||||
oldSeconds = newSeconds
|
||||
end
|
||||
elseif PAINT_ON then
|
||||
Paint.draw(currentMap)
|
||||
|
|
|
@ -37,10 +37,15 @@ local memoryNames = {
|
|||
},
|
||||
game = {
|
||||
map = 0x135E,
|
||||
frames = 0x1A45,
|
||||
battle = 0x1057,
|
||||
textbox = 0x0FC4,
|
||||
},
|
||||
time = {
|
||||
hours = 0x1A41,
|
||||
minutes = 0x1A43,
|
||||
seconds = 0x1A44,
|
||||
frames = 0x1A45,
|
||||
},
|
||||
shop = {
|
||||
transaction_amount = 0x0F96,
|
||||
},
|
||||
|
|
|
@ -82,10 +82,10 @@ end
|
|||
-- TIME
|
||||
|
||||
function Utils.igt()
|
||||
local secs = Memory.raw(0x1A44)
|
||||
local mins = Memory.raw(0x1A43)
|
||||
local hours = Memory.raw(0x1A41)
|
||||
return secs + mins * 60 + hours * 3600
|
||||
local hours = Memory.value("time", "hours")
|
||||
local mins = Memory.value("time", "minutes")
|
||||
local secs = Memory.value("time", "seconds")
|
||||
return (hours * 60 + mins) * 60 + secs
|
||||
end
|
||||
|
||||
local function clockSegment(unit)
|
||||
|
@ -108,22 +108,18 @@ function Utils.timeSince(prevTime)
|
|||
end
|
||||
|
||||
function Utils.elapsedTime()
|
||||
local secs = Memory.raw(0x1A44)
|
||||
if secs < 10 then
|
||||
secs = "0"..secs
|
||||
end
|
||||
local mins = Memory.raw(0x1A43)
|
||||
if mins < 10 then
|
||||
mins = "0"..mins
|
||||
end
|
||||
return Memory.raw(0x1A41)..":"..mins..":"..secs
|
||||
local secs = Memory.value("time", "seconds")
|
||||
local mins = Memory.value("time", "minutes")
|
||||
local hours = Memory.value("time", "hours")
|
||||
return hours..":"..clockSegment(mins)..":"..clockSegment(secs)
|
||||
end
|
||||
|
||||
function Utils.frames()
|
||||
local totalFrames = Memory.raw(0x1A41) * 60
|
||||
totalFrames = (totalFrames + Memory.raw(0x1A43)) * 60
|
||||
totalFrames = (totalFrames + Memory.raw(0x1A44)) * 60
|
||||
return totalFrames + Memory.raw(0x1A45)
|
||||
local totalFrames = Memory.value("time", "hours") * 60
|
||||
totalFrames = (totalFrames + Memory.value("time", "minutes")) * 60
|
||||
totalFrames = (totalFrames + Memory.value("time", "seconds")) * 60
|
||||
totalFrames = totalFrames + Memory.value("time", "frames")
|
||||
return totalFrames
|
||||
end
|
||||
|
||||
return Utils
|
||||
|
|
Loading…
Reference in New Issue