On-Grid Booster Project Vs 3.5 (0 чел.)
 | | |
|
Сообщения темы: On-Grid Booster Project Vs 3.5
|
|
Re: On-Grid Booster Project 9 г., 4 мес. назад
|
Репутация: 10
|
Hahahaha, made a good breakthrough. I was totally working on something else and spit out this snipet of code. It will end up removing the need for corporate bm's, just use syncronized bm's. And it will also be able to track empty belts and on-grid location too.
Take a peak.
The part that scans PNP and write ini
Предупреждение: Помехи!
| Код: |
OpenPnPPersonal()
sleep, 500
ImageSearch, PNPX, PNPY, 0, 0, winWidthX, winHeightY, *30 %PNPWindowID%
ImageSearch, PNPPersX, PNPPersY, PNPX, PNPY, winWidthX, winHeightY, *30 %PNPPersOpen%
PNPPersX1 := (PNPPersX +30)
PNPPersY1 := (PNPPersY +15)
PNPPersX2 := (PNPPersX +60)
PNPPersY2 := (PNPPersY +600)
Color := 0x67c367
Skip := 20
VarY := PNPPersY1
BMCount := 0
Loop
{
PixelSearch, PBMX, PBMY, PNPPersX1, VarY, PNPPersX2, PNPPersY2, Color, 10, Fast RGB
If(PBMX != ""){
IniWrite, 0|%PBMX%|%PBMY%, %SharedDir%OGEPVars.ini, Booster, %BMCount%
;MouseMove, PBMX, PBMY, 7
OGDebugFunc("Test","Found Green BM")
BMCount++
VarY += Skip
}
Else If(PBMX = ""){
Break
}
sleep, 25
}
IniWrite, %BMCount%, %SharedDir%OGEPVars.ini, Booster, BMCount
|
The part that reads the ini and chooses location to warp
Предупреждение: Помехи!
| Код: |
OpenPnPPersonal() ;Function to open personal PnP
IniRead, BMCount, %SharedDir%OGEPVars.ini, Booster, BMCount
Coice_Num :=0
LoopCount := (BMCount +1)
Loop, %LoopCount%
{
Coice_Num++
IniRead, Result, %SharedDir%OGEPVars.ini, Booster, %Coice_Num%
BM_Array := StrSplit(Result,"|")
;BM_Array[1] = 0 for unknown belt status 1 for empty belt 2 for On Location
;BM_Array[2] = X coordinates
;BM_Array[3] = Y coordinates
If (BM_Array[1]= 2){
;MouseMove, BM_Array[2],BM_Array[3]
OGWarpToLoc(BM_Array[2],BM_Array[3]) ;Function to warp to location X,Y
Break
}
If (Coice_Num > BMCount){
;MsgBox, "Booster is not on grid."
Break
}
sleep, 25
}
Random,Coice_Num,1,%BMCount%
|
|
|
|
|
Последнее редактирование: 13.06.2017 17:26 Редактировал Minesalot.
|
|
|
Re: On-Grid Booster Project 9 г., 4 мес. назад
|
Репутация: 10
|
|
Quick question. I can't find the answer for something.
I want to pick a Random 1-20, then check it against a variable. if they match continue on. if they do not match pick another random 1-20. But remove the # that was picked first. rinse repeat.
So
Random 1,20 ; all 20 are choices
it picks 5
read ini = 1 so 5 is not good
Random 1-20 ; 5 is no longer an option to choose from
Maybe an array ? I do not know how to write this array.
Read an ini file for MaxCount
Read the ini file for each BM and store BM number and #|XXX|YYY
Then pick a random BM from the available ones that match 0|XXX|YYY and ignore the ones who match 1|XXX|YYY
The ini file looks like this
[Booster]
OnGrid=0
BMCount=5
0=0|124|190
1=0|114|210
2=0|124|230
3=2|124|250
4=0|124|270
|
|
|
|
|
|
|
Re: On-Grid Booster Project 9 г., 4 мес. назад
|
Репутация: 34
|
|
Assay := []
i := 0
While (Array.Length() < 20){
i ++
Array.Push(i)
}
Array.RemoveAt(x)
|
|
|
|
|
|
|
Re: On-Grid Booster Project 9 г., 4 мес. назад
|
Репутация: 10
|
innominate wrote:
Assay := []
i := 0
While (Array.Length() < 20){
i ++
Array.Push(i)
}
Array.RemoveAt(x)
Thanks. I just turned what you put here into this. It grabs all the available unknown BM's and puts them into an array then picks one at random.
Предупреждение: Помехи!
| Код: |
IniRead, BMCount, %SharedDir%OGEPVars.ini, Booster, BMCount
Array := []
i := 0
While (i < BMCount){
i ++
IniRead, Result, %SharedDir%OGEPVars.ini, Booster, %i%
BM_Array := StrSplit(Result,"|")
If (BM_Array[1] = 0){
;MsgBox, % BM_Array[1]
Array.Push(i)
}
}
MsgBox, % ArrayToString(Array)
msgbox, % Array[random(1, array.maxindex() )]
|
|
|
|
|
|
|
|
Re: On-Grid Booster Project 9 г., 4 мес. назад
|
Репутация: 10
|
|
For my next trick, lol.
I need to set a UTC timestamp Then scan BM's. Then next time it tries to scan it makes sure Downtime has happened since the last scan.
|
|
|
|
|
|
|
Re: On-Grid Booster Project 9 г., 4 мес. назад
|
Репутация: 34
|
|
Look for UTC stuff in the CorpBM script.
|
|
|
|
|
|
|
 | | |
|
|
© Macro Laboratory 2026
Все права защищены!
|