forked from Crazy3001/Universal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInteractivePC.lua
More file actions
110 lines (93 loc) · 2.51 KB
/
Copy pathInteractivePC.lua
File metadata and controls
110 lines (93 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
local openBox = openPCBox
local getBoxCount = getPCBoxCount
local getBox = getCurrentPCBoxId
local getBoxSize = getCurrentPCBoxSize
local getPokeID = getPokemonIdFromPC
local isBoxRefreshed = isCurrentPCBoxRefreshed
setTextOption(1,"1")
setTextOptionName(1,"Page")
setTextOption(2,"")
setTextOptionName(2,"Search")
setOption(3,false)
setOptionName(3,"Submit")
-- while true do
-- if openPCBox(1) then
-- getTime()
-- else
-- openPCBox(2)
-- end
-- end
-- function errorChecks()
-- assert(stringContains(getMapName(),"Pokecenter"),"You must be in a Pokecenter.")
-- end
function onStart()
if isPCOpen() then
if isBoxRefreshed() then
local page = getOption(1)
log("InteractivePC has booted up!")
log("Welcome, the time is "..time())
if openBox(page) then
pokes = getAllPokeIDsInBox(page)
if #pokes == 0 then log("Box empty") end
for i=1,#pokes,1 do
log(i..": "..pokes[i])
end
end
end
else
return usePC()
end
end
-- registerHook("onStart",errorChecks())
function getAllPokeIDsInBox(box)
pokes = {}
for poke=1,getCurrentPCBoxSize(),1 do
pokes[poke] = getPokeID(box,poke)
end
return pokes
end
function getAllPokeIDs()
local pc = {}
for box=1,getBoxCount(),1 do
for poke=1,getBoxSize(),1 do
pc[box][poke] = getPokeID(box,ii)
end
end
return pc
end
function refreshScreen()
log("Box: "..getBoxId().."/"..getBoxCount().." │ Pokemon: "..getPCPokemonCount())
log("┌──────┬──────┬──────┬──────┐")
--log("│".. .."│".. .."│".. .."│".. .."│")
log("├──────┼──────┼──────┼──────┤")
log("│ 16 │ 8 │ │ │")
log("├──────┼──────┼──────┼──────┤")
log("│ 64 │ 32 │ 16 │ │")
log("├──────┼──────┼──────┼──────┤")
log("│ 128 │ 512 │ 128 │ 64 │")
log("└──────┴──────┴──────┴──────┘")
end
function time()
time = getTime()
if time > 12 then
meridiem = "PM"
time = math.floor(time/2)-1
else
meridiem = "AM"
end
return time.." "..meridiem
end
-- if isPCOpen() then
-- if isCurrentPCBoxRefreshed() then
-- log("inside box")
-- -- while true do
-- -- -- if getOption(submit) then
-- -- -- submit()
-- -- -- setOption(submit,false)
-- -- -- end
-- -- return refreshScreen()
-- -- end
-- end
-- else
-- usePC()
-- end