Hello There, Guest! Login Register


Pathfinder v2.3.2
#1
PathFinder
Version 2.3.2

The Pathfinder is a module, that is a library containing multiple functions. The main one being used to move the bot in the world.
In Proshine if you need to move from a map A to B, distanced by multiple other maps, you need to make a case and an action for every map in between them.
The PathFinder first use is to remove that need, you can use the function MoveTo(start, dest) and it will simply take you there with the best path.
This allow for advanced scripts, and cross map script are easier to make and read.
The pathfinder also supports discovering items, headbutting tree, diging spots or harvesting berries on the way
It comes with a documented API, and configurable settings.
Features

  • Move to the requested map support for the 3 Main regions.
  • Move to a specific cell on a map.
  • Checking for possible paths.
  • Move to the closest Pokecenter.
  • Use the closest Pokecenter.
  • Use the closest Pokemart to buy the requiered items. (testing, item map need to be completed.)
  • Uses Bike or Mount.
  • Uses digways as shortcut if has a Pokemon that can use dig.
  • Discover digways if it can't use it.
  • Subway support for the 3 main regions.
  • Boat and Train support from one Region to another.
  • Headbutt trees on the way.
  • Dig digspots on the way.
  • Discover all items on the way.
  • Harvest berries. ( currently need more testing )
  • Settings for every features.
  • Custom Settings per Bot.
  • Examples script such as an AnywhereLever, a script to get the 3 rods.
Known Bugs and WIP

  • X map does not work! Not everything is currently implemented, I welcome help if you want to implement maps, make pull request on github.
How to use

Documentation is available in the README.md and HOWTO.md to help.
LoadMe_Test.lua is a simple script you can use as an example.
If you need more help you can ask here or find me on Discord (#Melt2450). 
How to configure

Settings are located in Settings/static_Settings.lua
Everything is detailed in the file.


[Image: ZJQXtAK.png]


Show ContentChangelog:
 
Reply
#2
Nice one, ill update the EV-Trainer with that. Thanks for the release
No support for scripts from other authors or edited scripts ( except config.lua ). If you change something on the "core" and it isnt working anymore then you can fix it by your own.
Feel free to contact me for informations and tips !

 
Reply
#3
Amazing, was also doing this very slowly, but you beat me, great work, will add to some of my scripts!
 
Reply
#4
Wow. This what I've been waiting for to finish my Universal EV Trainer. but I think I will not as Migno releases his own Smile
God Karp Trainer loading... *splash*splash Huh

 
Reply
#5
Quick question!

MoveToPC()
Will this also use "paid" nurses like the one on Seafoam B4F or is it just the nearest "free" pokecenter ?
No support for scripts from other authors or edited scripts ( except config.lua ). If you change something on the "core" and it isnt working anymore then you can fix it by your own.
Feel free to contact me for informations and tips !

 
Reply
#6
(2016-09-25, 08:11:03)imMigno Quick question!

MoveToPC()
Will this also use "paid" nurses like the one on Seafoam B4F or is it just the nearest "free" pokecenter ?

MoveToPC() simply moves to the nearest map with the name "Pokecenter" in it.
So it won't use the nurse or be aware of possible nurse on maps.
 
Reply
#7
Got a suggestion:

My situation:
I currently run the script to get from Indigo Plateau Center to Route 10 in Kanto, the script run well but took a long trip through the whole Victory Road in order to get the my Spot. Why dont you add the Abrateleport @ Indigo Plateau Center to the exceptions ? It would make things faster since you get less encounters that way.

Found a Bug:
Route 10 before the Powerplant is not supported, the scripts stops with "no action executed"
No support for scripts from other authors or edited scripts ( except config.lua ). If you change something on the "core" and it isnt working anymore then you can fix it by your own.
Feel free to contact me for informations and tips !

 
Reply
#8
(2016-09-26, 18:03:57)imMigno Got a suggestion:

My situation:
I currently run the script to get from Indigo Plateau Center to Route 10 in Kanto, the script run well but took a long trip through the whole Victory Road in order to get the my Spot. Why dont you add the Abrateleport @ Indigo Plateau Center to the exceptions ? It would make things faster since you get less encounters that way.

Found a Bug:
Route 10 before the Powerplant is not supported, the scripts stops with "no action executed"

I was aware for route 10 the exception were never done, the abrateleport is a nice addition I'll do them when I have some time.
 
Reply
#9
Another suggestion:

• Add a function to "reset" the path. Tried implementing your pathfind to my EV-Trainer but the bot stopps once a destination is reached. When calling another "MoveTo" it shows the "no action executed" message.

Something like:
PathFinder.resetPath()
would be pretty neat
No support for scripts from other authors or edited scripts ( except config.lua ). If you change something on the "core" and it isnt working anymore then you can fix it by your own.
Feel free to contact me for informations and tips !

 
Reply
#10
(2016-09-27, 09:28:31)imMigno Another suggestion:

• Add a function to "reset" the path. Tried implementing your pathfind to my EV-Trainer but the bot stopps once a destination is reached. When calling another "MoveTo" it shows the "no action executed" message.

Something like:
PathFinder.resetPath()
would be pretty neat

ResetPath should be automatically handled by the script, otherwise it means something is wrong. 
When it says "no action executed" It probably means the script tries to calls moveToMap() sucessfully, but does not end up moving. Most likely missing a Pokemon with surf or cut.

This is on my list to add errors if possible. Meanwhile it is said in the README to make sure you have what is neccessary to move arround.

I added UseNearestPC() in the PathFinder calls.
 
Reply
#11
Take a look @Viridan Forest, it seems to refuse to use the Bike there Smile
No support for scripts from other authors or edited scripts ( except config.lua ). If you change something on the "core" and it isnt working anymore then you can fix it by your own.
Feel free to contact me for informations and tips !

 
Reply
#12
can anyone explain to me how to use this, I open all the scripts to read them and I dont understand how it works at all Sad
 
Reply
#13
(2016-09-30, 10:12:55)imMigno Take a look @Viridan Forest, it seems to refuse to use the Bike there Smile

Working fine.

(2016-09-30, 23:09:35)BlackCape can anyone explain to me how to use this, I open all the scripts to read them and I dont understand how it works at all Sad

Have you checked the REAME and the Loadme ? They have pretty clear explanation
You only need to require the file with the methods.

local pf = require "Pathfinder/Pathfinder/Maps_Pathfind" -- requesting table with methods

-[[
----- Check out settings in Pathfind/Settings/static_settings.lua -------------------------------
------------------
MoveTo(dest) --> Main function for moving to dest. return false when done. true if destination is not reached. Need to be called multiple times.
MoveToPC()   --> Move to nearest Pokecenter.
UseNearestPokecenter() --> Go heal your team to the nearest Pokecenter.

--> Possible Setting Calls (Bike and Dig are set depending of Bot item/pokemons)
    EnableBikePath()
    DisableBikePath()
    EnableDigPath()
    DisableDigPath()
------------------]]

function onPathAction()
    pf.MoveTo("Viridian City") -- example use of MoveTo(dest)
end

You can use the LoadMe as a template.
If it's not clear enough for you, feel free to precise what you don't understand.
 
Reply
#14
This is absolutely amazing, great work!  I'm learning and making all sorts of different things, this makes it much easier and cleaner.

One question tho:

Is it possible to to call for a require in a sub-folder?

Heres my folder structure:

Script-|-Lib--all your files
          |-Kanto--all kanto scripts
          |-Johto--all johto scripts
          |-Hoenn--all Hoenn scripts

How can I use "local PathFinder = require "Lib/Maps_Pathfind"" if its in a different folder? (Besides having a 'Lib' folder in every directory.. which I am doing right now). Is it possible to go back folders? Or do all scripts have to be in the 'main' scripts folder?

Thanks
 
Reply
#15
(2016-10-01, 21:57:28)Melt Have you checked the REAME and the Loadme ? They have pretty clear explanation
You only need to require the file with the methods.

local pf = require "Pathfinder/Pathfinder/Maps_Pathfind" -- requesting table with methods

-[[
----- Check out settings in Pathfind/Settings/static_settings.lua -------------------------------
------------------
MoveTo(dest) --> Main function for moving to dest. return false when done. true if destination is not reached. Need to be called multiple times.
MoveToPC()   --> Move to nearest Pokecenter.
UseNearestPokecenter() --> Go heal your team to the nearest Pokecenter.

--> Possible Setting Calls (Bike and Dig are set depending of Bot item/pokemons)
    EnableBikePath()
    DisableBikePath()
    EnableDigPath()
    DisableDigPath()
------------------]]

function onPathAction()
    pf.MoveTo("Viridian City") -- example use of MoveTo(dest)
end

You can use the LoadMe as a template.
If it's not clear enough for you, feel free to precise what you don't understand.
So all i need to do is make a script with PathFinder.MoveTo("City name") -- example use of MoveTo(dest) and it will just move to that city for me? 
what I dont understand is that when I load the script named KantoMap, it just says "Could not load script DigwaysMap.lua: 

module 'Pathfinder/Lib/lib' not found"
same for the scripts in the example folder, I dont understand what I need to do. I opened and read everything in LoadMe_Test and README, but it's so confusing xD
 
Reply
#16
(2016-10-02, 02:58:02)BlackCape So all i need to do is make a script with PathFinder.MoveTo("City name") -- example use of MoveTo(dest) and it will just move to that city for me? 
what I dont understand is that when I load the script named KantoMap, it just says "Could not load script DigwaysMap.lua: 

module 'Pathfinder/Lib/lib' not found"
same for the scripts in the example folder, I dont understand what I need to do. I opened and read everything in LoadMe_Test and README, but it's so confusing xD

You have to leave all his files the way they are. Don't move them or rename them. 

The files that came with it, (other than LoadMe_Test) arent meant to be loaded.  They are required files that have functions in them, which are called from scripts.


@Melt:

I also updated 'HoennMap.lua' and 'Maps_Exceptions.lua' to include Sky Pillar 1F - 6F.  Here's the code I added if you want to add it in:

HoennMap.lua:
HoennMap["Sky Pillar Entrance"] = {["Route 131"] = 1, ["Sky Pillar Entrance Cave 1F"] = 2, ["Sky Pillar 1F"] = 1}
HoennMap["Sky Pillar Entrance Cave 1F"] = {["Sky Pillar Entrance"] = 2}
HoennMap["Sky Pillar Entrance"] = {["Route 131"] = 1, ["Sky Pillar Entrance Cave 1F"] = 2, ["Sky Pillar 1F"] = 1}
HoennMap["Sky Pillar 1F"] = {["Sky Pillar Entrance"] = 1, ["Sky Pillar 2F"] = 1}
HoennMap["Sky Pillar 2F"] = {["Sky Pillar 1F"] = 1, ["Sky Pillar 3F"] = 1}
HoennMap["Sky Pillar 3F"] = {["Sky Pillar 2F"] = 1, ["Sky Pillar 4F"] = 1}
HoennMap["Sky Pillar 4F"] = {["Sky Pillar 3F"] = 1, ["Sky Pillar 5F"] = 1}
HoennMap["Sky Pillar 5F"] = {["Sky Pillar 4F"] = 1, ["Sky Pillar 6F"] = 1}
HoennMap["Sky Pillar 6F"] = {["Sky Pillar 5F"] = 1}

Maps_Exceptions.lua:
-- SKY PILLAR --
DescMaps["Sky Pillar Entrance_to_Sky Pillar 1F"] = {function() Mode_MoveToCell("Sky Pillar Entrance", 13,30,37,48,26,32) end, function() Mode_MoveToCell("Sky Pillar Entrance", 25,7,36,26,27,6) end}
DescMaps["Sky Pillar Entrance Cave 1F_to_Sky Pillar Entrance"] = {function() Mode_MoveToCell("Sky Pillar Entrance Cave 1F", 5,2,18,16,17,6) end}
DescMaps["Sky Pillar 3F_to_Sky Pillar 4F"] = {function() Mode_MoveToCell("Sky Pillar 3F", 1,5,14,11,3,6) end}
DescMaps["Sky Pillar Entrance_to_Route 131"] = {function() Mode_MoveToCell("Sky Pillar Entrance", 25,7,36,26,35,23) end, function() Mode_MoveToCell("Sky Pillar Entrance", 13,30,37,49,26,49) end}
DescMaps["Sky Pillar Entrance Cave 1F_to_Route 131"] = {function() Mode_MoveToCell("Sky Pillar Entrance Cave 1F", 5,2,18,18,7,17) end}
 
Reply
#17
(2016-10-02, 00:44:11)Crazy3001 This is absolutely amazing, great work!  I'm learning and making all sorts of different things, this makes it much easier and cleaner.

One question tho:

Is it possible to to call for a require in a sub-folder?

Heres my folder structure:

Script-|-Lib--all your files
          |-Kanto--all kanto scripts
          |-Johto--all johto scripts
          |-Hoenn--all Hoenn scripts

How can I use "local PathFinder = require "Lib/Maps_Pathfind"" if its in a different folder? (Besides having a 'Lib' folder in every directory.. which I am doing right now).  Is it possible to go back folders? Or do all scripts have to be in the 'main' scripts folder?

Thanks

Hello and thanks for the support,

From what I understand:
-You are trying to load myscript.lua located in Script/Kanto/myscript.lua, and you want to require a script in a parent directory. That means you will need the full path from root, in windows that is C:/Users/Path/to/My/Pathfinder.lua. It's not recommended to do that.
Instead you can do what you're doing right now (having a lib in every folder) or just have a main script in your Script folder that requires the files in Lib and the one you want to use in Kanto/Johto/Hoenn.

-That said you still need to have your main script.lua  where the LoadMe_Test.lua is located or you need to change every require in pathfinder to match your tree since they are not relative sadly.

-If you want to have your script.lua on a parent directory which is probably what most people would want, I have a branch which supports it, sadly moonsharp currently does not support it. Thanks to silv3r I have a fix for it and a compiled version of moonsharp that handles it is in the github branch https://github.com/MeltWS/ProShinePathfi...athModules
This allow you to require Maps_Pathfind.lua from any parent directory.

(2016-10-02, 02:58:02)BlackCape
(2016-10-01, 21:57:28)Melt Have you checked the REAME and the Loadme ? They have pretty clear explanation
You only need to require the file with the methods.

local pf = require "Pathfinder/Pathfinder/Maps_Pathfind" -- requesting table with methods

-[[
----- Check out settings in Pathfind/Settings/static_settings.lua -------------------------------
------------------
MoveTo(dest) --> Main function for moving to dest. return false when done. true if destination is not reached. Need to be called multiple times.
MoveToPC()   --> Move to nearest Pokecenter.
UseNearestPokecenter() --> Go heal your team to the nearest Pokecenter.

--> Possible Setting Calls (Bike and Dig are set depending of Bot item/pokemons)
    EnableBikePath()
    DisableBikePath()
    EnableDigPath()
    DisableDigPath()
------------------]]

function onPathAction()
    pf.MoveTo("Viridian City") -- example use of MoveTo(dest)
end

You can use the LoadMe as a template.
If it's not clear enough for you, feel free to precise what you don't understand.
So all i need to do is make a script with PathFinder.MoveTo("City name") -- example use of MoveTo(dest) and it will just move to that city for me? 
what I dont understand is that when I load the script named KantoMap, it just says "Could not load script DigwaysMap.lua: 

module 'Pathfinder/Lib/lib' not found"
same for the scripts in the example folder, I dont understand what I need to do. I opened and read everything in LoadMe_Test and README, but it's so confusing xD

local PathFinder = require "ProshinePathfinder/Pathfinder/Maps_Pathfind" -- requesting table with methods

function onPathAction()
PathFinder.MoveTo("Indigo Plateau Center") -- example use of MoveTo(dest)
end

function onBattleAction() run() end

These five lines makes you move from anywhere to "Indigo Plateau Center"
There is only one script you need to load in proshine, it's named LoadMe_Test.lua, the first line in it make sure to load everything else for you.
You can build up from it.
 
Reply
#18
Awesome job! However, there seems to be a bug. I did not have the appropriate badge to enter saffron yet. But it still push it way through Saffron when I am going from lavender to celadon. Well, somehow manage to glitch into saffron with it lol.
 
Reply
#19
(2016-10-06, 17:02:30)funfair91 Awesome job! However, there seems to be a bug. I did not have the appropriate badge to enter saffron yet. But it still push it way through Saffron when I am going from lavender to celadon. Well, somehow manage to glitch into saffron with it lol.
Thanks,
The pathfinder does not take into account if you have unlocked access to maps or not, so going threw saffron if you didn't unlock the path is the intended behavior.
 
Reply
#20
(2016-10-02, 17:13:49)Melt
local PathFinder = require "ProshinePathfinder/Pathfinder/Maps_Pathfind" -- requesting table with methods

function onPathAction()
PathFinder.MoveTo("Indigo Plateau Center") -- example use of MoveTo(dest)
end

function onBattleAction() run() end

These five lines makes you move from anywhere to "Indigo Plateau Center"
There is only one script you need to load in proshine, it's named LoadMe_Test.lua, the first line in it make sure to load everything else for you.
You can build up from it.
it just says Could not load script Fuchisia.lua: 

module 'ProshinePathfinder/Pathfinder/Maps_Pathfind' not found no matter what I try
 
Reply
#21
It should be:
require "Pathfinder/Maps_Pathfind"

If you add different folders on your own, you have to change all the requires in every file.
 
Reply
#22
(2016-10-08, 00:07:48)BlackCape
(2016-10-02, 17:13:49)Melt
local PathFinder = require "ProshinePathfinder/Pathfinder/Maps_Pathfind" -- requesting table with methods

function onPathAction()
PathFinder.MoveTo("Indigo Plateau Center") -- example use of MoveTo(dest)
end

function onBattleAction() run() end

These five lines makes you move from anywhere to "Indigo Plateau Center"
There is only one script you need to load in proshine, it's named LoadMe_Test.lua, the first line in it make sure to load everything else for you.
You can build up from it.
it just says Could not load script Fuchisia.lua: 

module 'ProshinePathfinder/Pathfinder/Maps_Pathfind' not found no matter what I try

I'm not sure which version you are using, I changed the hierarchie at some point so the required path can vary.
But you can check the one you need in your LoadMe_Test.lua file.
Keep in mind you need to place your main script ( The one you load in Proshine, Fuchisia.lua in your case) in the same folder as LoadMe_Test.lua.
(unless you want to use the version from the branch "relativePathModule" on github ...)
 
Reply
#23
i opened test lua from MT. Silver pokecenter and got this error
Error during the script execution: Pathfinder/Maps_Pathfind.luaSad19,1-26): bad argument #1 to 'next' (table expected, got nil)

trying to reach Mt. Silver Lower Mountainside

tried changing things and still get this error!
 
Reply
#24
Mt. Silvers currently not supported by PathFinder. I am working on it tho, I'll PM you when/if I get it finished.

If you open PathFinder/Maps/Kanto/KantoMap.lua it shows all supported maps.
 
Reply
#25
Excuse me Melt, how can i change bike to mount? i edited code in useBike function in lib and anywhere has useItem("Bicycle"), hasItem("Bicycle") ...changed Bicycle to S Glaceon Mount but it's not work
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)