Minesalot wrote:
Working on a method to sense roid types in overview and confirm things. Instead of imagesearching for "Nothing Found".
ScanOverview function looks promising. It spits out this to the ini.
| Code: |
[ScanOverview]
RoidDistance=11000|12000|12000|12000|12000|13000|13000|14000|14000|15000|17000|20000|24000
RoidName=Asteroid (Plagi|Asteroid (Azure|Asteroid (Plagi|Asteroid (Plagi|Asteroid (Rich|Asteroid (Plagi|Asteroid (Plagi|Asteroid (Plagi|Asteroid (Plagi|Asteroid (Azure|Asteroid (Plagi|Asteroid (Plagi|Asteroid (Azure
RoidType=NoImage|NoImage|NoImage|NoImage|NoImage|NoImage|NoImage|NoImage|NoImage|NoImage|NoImage|NoImage|NoImage
|
How would I go about reading the ini for RoidName, and checking it against the current crystal set?
[Crystal]
Primary=Plagioclase
Secondary=Pyroxeres
Tertiary=Scordite
Looks like it grabs the first 5 characters of the name and then puts a |
-I would have to iniread that line
-search for the first 5 characters of Primary if it appears at all.
-if it does not, I would then need to search for the other 5% and 10% version of each name. That could get quite big on the code
I may be complicating things though.
-If I just changed crystal types to primary settings and ScanOverview find roids, no need to do anything.
-If ScanOverview is empty run crystal change ahk
And btw ScanOveriew will come in handy on a few other things too.
Nevermind, found a bit of code that will help a lot. going to make some changes to a few things.
| Code: |
Name := "Asteroid (Plagi|Asteroid (Plagi|Asteroid (Plagi|Asteroid (Plagi|Asteroid (Rich|Asteroid (Plagi|Asteroid (Plagi|Asteroid (Plagi|Asteroid (Azure|Asteroid (Plagi|Asteroid (Azure||"
Type := "ContainerWhite|ContainerWhite|ContainerWhite|NoImage|NoImage|NoImage|NoImage|NoImage|NoImage|NoImage|NoImage|NoImage|NoImage"
NameCount := % HowOftenIs(Name,"Asteroid")
TypeCount := % HowOftenIs(Type,"ContainerWhite")
msgbox, % Primary " : " NameCount " | Container : " TypeCount
ExitApp
HowOftenIs(Haystack,Needle)
{
count = 0
pos = 0
Loop,
{
StringGetPos, pos, Haystack, %Needle%,, %pos%
If (Errorlevel<>0)
break
count += 1
pos +=1
}
return count
}
|
So, I think you have a good idea, but you could probably do a little more efficiently. Bear in mind the StrSplit() function, splitting on | would make an array where each object is a string. I'd read in the asteroid names from OverviewScan, split it to an array, and read in your Ini like this (using Plagioclase/Azure Plagio/Rich Plagio as primary, Veldspar/ConcentrateD Veldspar/Dense Veldspar as secondary, and Scordite/Condensed Scordite/Massive Scordite as tertiary for the example):
[Crystals]
Primary=Rich|Azure|Plagi|Plagioclase
Secondary=Dense|Conce|Velds|Veldspar
Tertiary=Massi|Conde|Scord|Scordite
Hopefully the first 5 characters of each asteroid are sufficiently unique...
So, for the method itself, you'd read in primary, split it to an array, and basically do a For loop for each item in Primary, use your function to determine the count. If the count > 0, break out of the loop, take the last item in the Primary array ("Plagioclase") and take that as the name to use to find the Crystal to swap to. Basically, checking each asteroid to see if it contains each of the valid Plagioclase names. If it finds any of them, break out of the loop, and use the last item of the array as the name of the crystal you want to load. Regarding the HowOften function, I'd probably modify it so that it can read in an array and iterate through each one finding a string, rather than using a count. Although teh count would be useful, if you want to set a limit on how many rocks need to be present to swap crystals (i.e., if there're 10 Pyrox and 1 Plagio, just use Pyrox).