|
Post by barkingbarnacle on May 15, 2017 3:08:44 GMT
hi.
ive made 5 functions;
go home go arena go dungeon do dungeon do arena
they need to be in two groups, that loop together like so
go home -> go arena -> do arena
then, when out of arena points
go home -> go dungeon -> do dungeon
then when out of dungeon points
back to beginning
how would I begin to do this?
I tried putting a "break" at the "out of points" screen, with a loop at the bottom of the functions, but it kept looping back to the arena function over and over. never went to the dungeon.\\\\
edit: only two are loops (do arena/ do dungeon), the other three are just image click loops with wait timers for lag.
|
|
|
Post by Mercobots on May 15, 2017 14:22:06 GMT
hi This is what you are looking for ?
local arena = false -- main loop while true do goHome() -- if arena then goArena() doArena() arena = false else goDungeon() doDungeon() arena = true end end
|
|
|
Post by barkingbarnacle on May 15, 2017 18:42:26 GMT
hi This is what you are looking for ? local arena = false -- main loop while true do goHome() -- if arena then goArena() doArena() arena = false else goDungeon() doDungeon() arena = true end end
Actually, I think so? My problem lies in the two infinite loops (arena/dungeon battles), I need to break from those loops but retain my place in the function list. Maybe I just need to come at this from a different angle. upon further thinking, this is the structure i need to get all of my stuff done. i just dont know how to end the two infinite loops gracefully. would this do it? would that end my arena battle loop, then go to the dungeon battle loop? then put a similar thing in the out of points line for the dungeon battle? edit 3: i had to remove "local" from the arena = false thing, but i got it to work. my actions are all now working together. i now do so much more, easier, interchangeable on the fly. wonderful. thanks! if outofpnts:exists(Pattern("outofpoints.png"), 0.1) then arena = false break
|
|
|
Post by barkingbarnacle on May 15, 2017 22:28:28 GMT
Now, how do I put my regions and functions in another file and call on that?
-- LOAD REGIONS/FUNCTIONS
localPath = scriptPath()
dofile(localPath .. "lib/regions.lua")
dofile(localPath .. "lib/functions.lua")
that work???
|
|
|
Post by Mercobots on May 15, 2017 22:43:20 GMT
hi this a way to break your infinite loops and get the position or next action this is just to help you expand your mind arenaStart = function()
-- Go to arena -- Click and images match
-- Do arena -- infinite loop while true do
-- Example -- return Boolean , next action
if winBattel then
return true, "home"
elseif loseBattle then
return true, "dungeon"
else
return false, "none"
end
end
end
-- dungeonStart = function()
-- Go to Dungeon -- Click and images match
-- Do Dungeon -- infinite loop
while true do
-- Example -- return Boolean , next action
if dungeon_end then
return true, "home"
elseif dungeon_timeout then
return true, "arena"
else
return false, "none"
end
end
end
-- -- next_action = "arena" -- --
-- main loop
while true do
goHome()
if next_action == "arena" then
_boolean , _string = arenaStart()
next_action = _string
end
if next_action == "dungeon" then
_boolean , _string = dungeonStart()
next_action = _string
if _boolean then
--getResources()
end
end
end Now, how do I put my regions and functions in another file and call on that? -- LOAD REGIONS/FUNCTIONS
localPath = scriptPath()
dofile(localPath .. "lib/regions.lua")
dofile(localPath .. "lib/functions.lua")
that work??? Yes, absolutely
|
|
|
Post by barkingbarnacle on May 15, 2017 23:32:39 GMT
It'll take me a few hours to wrap my head around that little bit there, and fully understand it. But, I'll report back. That looks like it'll make me rewrite everything so it's faster. So far, eleven different modes of play and five to seven options for each as far as item evaluation and powering up. This is fun!
|
|