Fate-Grand-Order_Lua
Fate-Grand-Order_Lua copied to clipboard
Discussion with my collaborator
Having a new discussion thread seemed like the fastest way for us to discuss non-commit and non-PR related issue. @ryuga93
I can't figure out the function calling here:
function menu()
atkround = 1
npClicked = 0
turnCounter = {0, 0, 0, 0, 0}
click(Location(1900,400))
wait(1.5)
if Refill_or_Not == 1 and stoneused < How_Many then
refillstamina()
end
click(Location(1900,500))
wait(1.5)
click(Location(2400,1350))
wait(8)
end
function refillstamina()
if StaminaRegion:exists("stamina.png", 0) then
if Use_Stone == 1 then
click(StoneClick)
click(Location(1650,1120))
stoneused = stoneused + 1
else
click(AppleClick)
click(Location(1650,1120))
stoneused = stoneused + 1
end
wait(1.5)
menu()
end
end
The 3rd line from last memu() called inside refillstamina() was the one you recently added. Wouldn't it caused a lot of wait(1.5)?
1.Every time when refillstamina() was called but game's not currently at AP refill window. 2.Every time memu() was called).
Or I got the whole function calling inside function concept wrong?
The wait & menu() in refillstamina() will not be called if stamina.png does not exist.
I think I forgot to indent both functions...
sure I understand, but then it will keep calling this part
click(Location(1900,400))
if Refill_or_Not == 1 and stoneused < How_Many then
refillstamina()
end
And misbehave, right? Just tested that.
If I did the permission right, you should be able to commit freely now(collaborator thing). Make changes as you wish! : )
Once it click on the OK and refilled the stamina, the game will return to the home window, at least for EN.
I change this because for me the script lack one step and stop at friend selection window.
Will it move to friend selection window after refill for JP?
Yes it will
Wow, version differences....... We should make an extra variable to bypass this issue.
I guess only in JP it will move to friend selection directly, which is probably NOT the case in other countries. Because I played the game since 1st day, so I remembered this behavior change.
https://github.com/29988122/Fate-Grand-Order_Lua/commit/ca56a42245ec4f18398d1c65c7cbc918e5ed99fa Put a temp variable to solve the issue. Added a few comments to code. Also fixed the timing to be more forgiving..since I ran Memu and it's not a good thing to have timing too tight - when I was playing overwatch, it stuck frequently lol. Bad PC.
I can't even run Memu with Dota :/
Anyway from now on I shall focus on JP version, you can test it on EN version only. I guess ppl will file an issue whenever bug occurred.
Now I understand why ppl said Unit test / test automation is important. Such a hassle to test and document everything.
Yea, and the reason I push the updates slowly, first the card selection, then the autoskill.
That would be a mess if I push all at once and a bug decided to say hello.
I'm from EE background, so initially my coding was way messy that yours. A software engineering job totally changed my coding: modular functions, minimize repetition, unit test etc...
Btw, not sure you realize or not, I haven't added the combat uniform switch skill support. That will come later :P. Also, a collaborator for CN would be a big plus for the long run. My experience with CN games tells me that the road will be "坎坷辛苦" @@
Really have to thank your for the autoskill.
The 2018 Vaneltine's is significantly harder than other event..it helped a ton : p
I got bride Nero for the reward XD
新年快乐!
新年快樂 : D
Recently FGO CN changed their font, again. Damn the lack of support of transparent images is such a hassle.
About the recognition issue of current stage status, I've tried various methods included:
-
http://ankulua-tw.boards.net/thread/10#numberOCR Not working, returned strange value(66) rather than throwing exception or correct result.
-
Sikuli is using Tesseract to do OCR, but this is not provided by Ankulua. A no-go.
-
Figure out how Sikuli implemented find(), and try to apply a dirty processing onto stage pngs for them to be recognized. Not working because I know 0 shit.
For now I just throw in a http://sikulix-2014.readthedocs.io/en/latest/pattern.html#Pattern.similar , hope it's going to work.
Any ideas?
Well in the end I decided to use simple snapshot diff to determine the change of stages.. The only side effects is that you'll have to start from battle 1/3 and cannot pause in the middle of battle.
Hi, sorry for not checking in, how is the autoskill going? My pc broke down, and I'm not able to contribute much due to work. But I'll try to get to you if you need to discuss stuff.
It's fine, we all have our work/life/side project/hobby balances. : D
I implemented a way to save region snapshot every turn, and use it as the base pic to be compared next turn, therefore less font issue.
Worked fine currently, unless the background's #0,0,0 xD
Heard that US server has a slight UI upgrade. Remember to check if anything's abnormal, thx bro!
I have no words @ryuga93 @potchy
https://github.com/29988122/Fate-Grand-Order_Lua/commit/42ae17b1d9be4fb97992958d32f64d3e00d3dc88#diff-1b3d9652b77d835d34d699a6f005f563
They just reuse last year's code, and thus the stamina refill behavior was also from one year ago...
廢到笑。
So the US now will directly enters friend selection after refill?
Edit: Oh it's the new jp event. Well they know the DRY concept in programming XD
@ryuga93 @potchy
Thanks guys, I appreciated everything you've done to the script. Version number is 2.0.0 now. Readme.md is now edited to give credit to you guys.
Live long and prosper.
Yay ver 2.0! Thanks @potchy!
@potchy To be honest I don't really understanding the support module. I'm writing docs XD
Am I correct for the following behavior? Please correct me line by line, therefore I can have a better grasp of the code.
Settings:
preferred servants: "waver, merlin, caster fox"
preferred CEs: "lunchtime, any, lunchtime"
Support_SwapsPerRefresh = 3
Support_MaxRefreshes = 2
Then:
It will check the topmost *3* entries on the support list.
It will check for the support-CE *PAIR*, e.g., waver with lunchtime, merlin with any CE, caster fox with lunchtime.
It will check the support-CE pair recursively from the 1st entry, then 2nd, and then 3rd entry on the support list.
Is the above description correct?
Another question: How about "any" pair? e.g.,
preferred servants: "waver, caster fox, any"
preferred CEs: "lunchtime, lunchtime, any"
Then it will search the 1st entry on the friend support list(any, any pair worked as a fallback), no matter the value of Support_SwapsPerRefresh is. Right?
Yet another question.
in regular.lua, line 285~308, function TargetChoose(): I don't really understand the return value, return function, and the structure of ankulua-utils.lua.
Without changing its behavior(guess I'll change them later), how would you rewrite TargetChoose() using the method you've been calling in ankulua-utils.lua?
Eh... no. That is not how it works at all. And I tried my best to write clear code. 😢
Firstly, you can't write Any
more than once.
I use it mostly in events, as I don't care which Servant the script selects as long as it has a Bonus CE equipped like Maid in Halloween.
So, if you write this:
Support_PreferredServants = "Any"
Support_PreferredCEs = "lunchtime.png, maid_in_halloween.png"
or this:
Support_PreferredServants = "" -- leaving it blank works the same way
Support_PreferredCEs = "lunchtime.png, maid_in_halloween.png"
Then the script will search for: • Chaldea Lunchtime • OR Maid in Halloween
And if you write this:
Support_PreferredServants = "waver.png, tamamo.png"
Support_PreferredCEs = "Any"
or this:
Support_PreferredServants = "waver.png, tamamo.png"
Support_PreferredCEs = ""
Then the script will search for: • Waver • OR Tamamo
Finally, if you write this:
Support_PreferredServants = "waver.png, tamamo.png"
Support_PreferredCEs = "lunchtime.png, maid_in_halloween.png"
Then the script will search for: • Waver + Lunchtime • OR Waver + Maid in Halloween • OR Tamamo + Lunchtime • OR Tamamo + Maid in Halloween
As for ankulua-utils...
local function useSameSnapIn(func)
snapshot()
local value = func()
usePreviousSnap(false)
return value
end
Here, func
is an actual function passed by argument. It may or may not produce a value. We do this all the time in Javascript. Initially, I wrote it like this:
local function useSameSnapIn(func)
snapshot()
func()
usePreviousSnap(false)
end
However, in support.lua:97, specifically, I needed the return value of searchMethod
, which is the matched Servant/CE. So, I made useSameSnapIn
store the value produced by func
and return it later.
In regular.lua, I would rewrite battle()
like so:
function battle()
ankuluaUtils.useSameSnapIn(battlePartOne)
wait(0.5)
if decodeSkill_NPCasting == 0 then
--enter card selection screen
click(Location(2300,1200))
wait(1)
end
if Battle_NoblePhantasm == "spam" or (Battle_NoblePhantasm == "danger" and TargetChoosen == 1) then
ultcard()
end
wait(0.5)
ankuluaUtils.useSameSnapIn(doBattleLogic)
atkround = atkround + 1
if UnstableFastSkipDeadAnimation == 1 then
--https://github.com/29988122/Fate-Grand-Order_Lua/issues/55 Experimental
for i = 1, 6 do
click(Location(1500,500))
wait(2)
end
end
wait(3)
end
function battlePartOne() -- please don't make me decide the name :C
wait(2.5)
InitForCheckCurrentStage()
--TBD: counter not used, will replace atkround.
local RoundCounter = 1
if TargetChoosen ~= 1 then
--Choose priority target for NP spam and focuse fire.
TargetChoose()
end
wait(0.5)
if Enable_Autoskill == 1 then
executeSkill()
end
end
Obviously, I would also remove all calls to usePreviousSnap
.
I hope I explained myself well. :flushed:
Eh... no. That is not how it works at all. And I tried my best to write clear code.
Apparently it's my problem - a n00b. XD
Anyway it's clear enough now! Thanks for the tutoring, my Mr. Mentor : D
Will modify the readme and comments according to this behavior.
Obviously, I would also remove all calls to usePreviousSnap. I hope I explained myself well
It gave me chills when I read my old comment
--TBD: counter not used, will replace atkround.
Yeah, refactoring incoming! Gotta read more coding style related book.
No prob. I'm still learning Lua as well. I'm just lucky that it's very similar to Javascript. 😅
So... @ryuga93, about AutoSkill, why did you choose to subtract 96 from the ASCII code?
function decodeSkill(str, isFirstSkill)
--magic number - check ascii code, a == 97. http://www.asciitable.com/
local index = string.byte(str) - 96`
Couldn't this line
if index >= -44 and index <= -42 and decodeSkill_NPCasting == 0 then
have been written like this instead?
if index >= 52 and index <= 54 and decodeSkill_NPCasting == 0 then
It's an obfuscation to prevent others cloning our script and make it as their own!
Just kidding XD
SkillClickArray = {Skill1Click, Skill2Click, Skill3Click, Skill4Click, Skill5Click, Skill6Click, Skill7Click, Skill8Click, Skill9Click, Master1Click, Master2Click, Master3Click}
I tend to make the code a bit complicated while making it cleaner...
SkillClickArray[97] = Skill1Click
SkillClickArray[98] = Skill2Click
.
.
.
If the subtraction does not make the script run slower significantly, 1 line is just nicer than 12 lines lol
Oh, right. I totally missed that. :expressionless: That's pretty smart, actually, but I was thinking of changing those declarations to something a bit more explicit, as to make it easier for newcomers. What do you think?
From this:
SkillClickArray = {Skill1Click, Skill2Click, Skill3Click, Skill4Click, Skill5Click, Skill6Click, Skill7Click, Skill8Click, Skill9Click, Master1Click, Master2Click, Master3Click}
SkillClickArray[-47] = Servant1Click
SkillClickArray[-46] = Servant2Click
SkillClickArray[-45] = Servant3Click
SkillClickArray[-44] = Ultcard1Click
SkillClickArray[-43] = Ultcard2Click
SkillClickArray[-42] = Ultcard3Click
To this:
SkillClickTable = {
-- 1st Servant skills
["a"] = Skill1Click,
["b"] = Skill2Click,
["c"] = Skill3Click,
-- 2nd Servant skills
["d"] = Skill4Click,
["e"] = Skill5Click,
["f"] = Skill6Click,
-- 3rd Servant skill
["g"] = Skill7Click,
["h"] = Skill8Click,
["i"] = Skill9Click,
-- Master skills
["j"] = Master1Click,
["k"] = Master2Click,
["l"] = Master3Click,
-- Skill targets
["1"] = Servant1Click,
["2"] = Servant2Click,
["3"] = Servant3Click,
-- Noble Phantasms
["4"] = Ultcard1Click,
["5"] = Ultcard2Click,
["6"] = Ultcard3Click
}
Sure, there are more lines, but I believe it's more intuitive this way. Plus, it will be easier to introduce new characters for target change (#32) ~~if we ever decide to do it lol~~
Sure! I agree to make the code intuitive for community project.
Coming from C/Java background, all I know about arrays is
variable[index] = value
I was quite surprise to discover that lua accepts negative index when I first coded the autoskill, due to it's table/key-value nature.
Me too.
When I read this one: https://www.lua.org/pil/11.html
I was like MIND=BLOWN
Also why the f the index started from 1 lul
Guess I need somebody's help make the site running. Time's scarce to me at the moment.
Checked Github hosting, and apparently, I have 0 idea how to do frontend/jekyll/wordpress/even the simplest template applying.
The site will include dev info(TBD, mentioned by ryuga93), contributor info, and i18n of readme.md. Also, current contributors ( @ryuga93 @potchy @TryBane ) must be assigned repo permission.
TODO: I don't seem to get the terminology between projects, organizations, and personal repo. This needs to be solved before hosting our site repo, I guess. Currently /Fate-Grand-Order_Lua's hosting as my personal repo on Github.
Meanwhile,
-
I'll overhaul the current readme to its smallest possible form i.e., user information ONLY, increase the readability. Other behavior description/code details will be in the abovementioned site.
-
Also, by reducing the amount of comments in the setting Lua files, we won't have to do minor trival comment changes in the future.
-
By redirecting user to the readme/githubpage site, we're able to separate the idea of "comments" and "documentations" once and for all. We've just done refactoring, and I believe it's the correct timing doing so to eliminate all the hassle in the foreseeable future.
I feel like having a separate website for such a small project is kinda pointless. If it's just for the sake of having a better organized documentation, it's easier to move everything to the Wiki tab instead.
Reading through here made me realize how funny it was that I implemented the change to pure chars for indexes when potchy proposed it 2 months ago. Also might be a good idea to comment their representations like he did, and I'm considering doing just that. Also would like to move the toast that appears at the main menu portion of the script to the init() function as it does not need to be repeated every iteration (I have never had an instance where I needed to be reminded that it will change targets while it was running, since I never kept watch outside of testing functionality after a change)
Also, there is still a lot of refactoring that needs to be done. I am working on creating a new module to handle the observer method. Also adding additional functions to handle some of the messier things in the code.
But before that, if @potchy wants to take care or the resolution scaling, it should not conflict with the observer module I am working on.
Also not sure if this was what you intended, but I am not fond of the idea of removing comments from the modules or regular.lua. I can understand removing it from the settings file however, as it might make it easier for users to deal with.
@potchy Okay, I somehow ignored the wiki tab totally. My bad LMAO.
Will cope.
Better Workflow
@ryuga93 @potchy @TryBane
First, we should NOT and will NOT change out current workflow just for the sake of a new, fashion methodology. It should stay the same 99% of the time.
To us, this "project" section is just a better version of a "to-do notepad"! It also helps visualize our current pending bugs/wait-to-be-done enhancements. Since issue tracker can be a little bit overwhelming.
That's all. Again, our workflow should stay the same - take it easy.
I write a simple readme in the description sections. https://github.com/29988122/Fate-Grand-Order_Lua/projects
Ah, I see what you're talking about. I haven't used github for collaboration in a long time (Jan of 2017) so I didn't even know that was a thing.
I also think that is a good idea, centralize the known bugs/enhancement ideas. Since the issues can be opened by anyone some can/will be dupes of already requested enhancements. I like this idea, and I think it will help to keep track.
Might also be able to just have someone mark that they are working on it so that others don't think it is being left alone. Just a thought.
@TryBane Yes. We don't often "freeze" because you know, our codebase should have some level of abstraction.(hint: we don't have that 1 month ago)
We(regular user included) should be able to make changes as the form of PR all the time(avoid commit only unless it's a simple tweak that doesn't need discussion), that's how version control system - git - works.
See this picture for example of your said issue:
It's now with more clarity.
Yes, I consider what potchy has done more as refactoring than what I did. Some of the things i did was refactoring, but not nearly everything I wanted. I felt that getting the new system for autoskill up was more important to get right first, then work on refactoring. I think I will be able to do that now, even while potchy works on the resolution scaling algorithm. As for Ryuga enhancing autoskill, I believe that might wait till I've finished the observer module. Mostly because the changes he would make might affect the way observer is written. Though if I discuss my intentions first, it will become clear whether that is necessary.
Simple workflow example for you to follow from now on (or NOT, I'll do the chores for you every now and then, this is my responsibility xD):
-
I create a new issue as what I said in this thread https://github.com/29988122/Fate-Grand-Order_Lua/issues/142
-
I classify the issue into BOTH label: enhancement and project: enhancement.
-
I then enter project section, move the said issue/card from "request (unassigned)" to "somebody's doing it"
-
Finally, I add a note under that issue card telling others the current status of that issue.
So yeah, by doing so we can better understand the current status of this repo.
Makes sense to me. I think this sounds like a decent way to approach the workflow. So you would be the only one moving the enhancements over or are we free to do so ourselves and then mark our name below? And if not, where do we claim an enhancement to work on, here or somewhere else?
@TryBane
free to do so
I tend to AVOID interrupt our current interactive flow - we're doing this for pure pleasure, rules will ruin it(probably). So do literally anything as you please.
Currently we discuss things in many separated issue/PR/commit, right? When we feel like we have consensus in the discussion, we draft a PR / commit, right? Keep it that way, feel no pressure.
I just want to provide an extra way to track our discussion. You can help creating issues->projects->notes if you remember/feel happy (not boring) doing so. However, you can also do the codes/discussions only, as always; I'm the one who's responsible to put them into our to-do notebook for you to track - smooth our collaboration process.
@TryBane >As for Ryuga enhancing autoskill, I believe that might wait till I've finished the observer module.
So I add a note into project section, am I right about the description?
Yeah, that looks accurate to me. Also just found out how to get there on mobile. Not as intuitive as I'd like but that is githubs issue. I think this will be a nice at a glance view of what is being worked on. Hopefully nobody will take issue if I work on a bunch of the ones not claimed, since I enjoy programming and always look for an excuse to do so.
Regarding the Readme changes you've made so far @29988122 (and maybe you aren't done with them yet) but just wanted to point out that Capturing images for Screen Recognition should probably suggest that the steps are usable for adding Servant/CE images for supports and others. Just a thought since I've seen some asking for help regarding that. Might even be a good idea to link that specific location in the support selection area so they can easily see there is step-by-step instructions on how to do just that.
Also, the isEvent option is not for (or at least not anymore as far as I'm aware) an extra point reward screen at the end of the result menu. It is for quest item buffs such as what you see in Onigashima or Halloween 2016 (Halloween 2018 for EN) events where there were special items you had the option of using at the beginning of any mission. It may have been for a point reward system at the end of result screen before, but the system I implemented should take care of that too (though I may need to make it slightly longer for that and another reason)
Uh... how would guys call a module that contains only Locations/Regions?
ui
, gui
, game-map
, map
? My creativity is lacking.
This is for the Resolution Scaling module you are working on? I would call it something like scaling.lua
.
If it literally is only encompassing all Regions/Locations then maybe directory.lua
might be a good one?
https://www.ptt.cc/bbs/FATE_GO/M.1545670814.A.C2F.html
At the major transportation hub @ TW
Cool AF
Latest interview of Kinoko Nasu
Jpn: https://www.4gamer.net/games/266/G026651/20181228023/
Chn: https://www.ptt.cc/bbs/TypeMoon/M.1546086975.A.9B4.html
Key sentence: Kinoko: We really wanna make a clear end upon 2nd chapter finished - that is - end the current iteration of FGO, and then make a fresh start
LULWUT
Personal opinion: I'm OK with that, I guess it will only be a mid-level revamp, rather than a whole remake.
Give me a full anime series + bring FGO Arcade to PC and I'll be happy
Looking forward to having a Chapter 5.6.7 anime series...But it couldn't be as bad as Fate Extra Last Encore.
By the way
我看到這段真的要笑尿了兄弟
梶田: 拜此所賜,對第一次看到的BOSS用手上所有的Servant找出攻略方法這點 ,也是FGO的一大魅力呢。 只是另一方面,當攻略方法被開發出來以後之後就是機械式的重複選卡 的周回動作了。試誤的快樂與周回的反差實在是很激烈呢..... 奈須: 謹聽高見... 梶田: 如果今後想要在這一點改善的話,FGO有一個巨大的弱點必須消除吧, 現在並沒有能夠SKIP戰鬥的功能,加速也只能調兩倍速。我對這一點 一直有著疑問,已經被攻略摸熟的關卡需要手動不斷打的理由究竟是否 存在呢?
AND
梶田:
玩家也不只是想追求輕鬆而以。以現實問題來說,手機遊戲的周回就像
奈須桑說的「不斷糾纏的工作」那樣,繼續累積下去的話是很危險的,
還有動力的時候是沒關係,只要哪天緊繃的線斷裂的話就會失去對這個
遊戲的執著,自己不想看到FGO有那樣的結果,實在太浪費了。
奈須:
說的好...老是不掉的素材之類的,我自己也常常在例會中質問著「這
到底是怎樣?」....。不會減損Servant的魅力,同時也讓遊玩的感覺
變好.... 以那樣的改動為目標,跟Delightworks會一起努力的。
梶田:
我們作為玩家也是,想愛著那樣的FGO。作為手機遊戲,要跟玩得舒服
取得平衡是很難...但是追求著更好的解答這樣的態度一定能傳達的!
笑到不知道該說什麼,你們自己也知道周回無聊到讓人會崩潰啊 -..-
To 奈須: 别管DW了,答案就在这里~
XD
Fate Extra Last Encore made my head spin even with the knowledge from the PSP game, and they say it's beginner friendly lol
I'm dead. http://ankulua.boards.net/thread/7/settings#autoGameArea http://ankulua.boards.net/thread/7/settings#getGameArea http://ankulua.boards.net/thread/7/settings#setGameArea
If we replace getRealScreenSize()
for autoGameArea(true)
and getGameArea()
the script should work in devices with notches. Later we can also replace ApplyOffsetsToTable
and ApplyOffsetsToLocationOrRegion
for setGameArea(region)
. I'm totally dead.
For those games, we can use setGameArea() to include only the game area and excluding the black area on left and right. We can then keep other parts of the script unchanged and make the script working on both devices.
THOSE GAMES
other parts of the script unchanged
sigh
Well at least they "listened". Btw I think I saw the exact same screenshot of those game before, not sure where, could be my imagination XD
@29988122 seriously, I think we should get rid of the "releases" tab, because we always forget to update it and people are always using outdated versions x_x
OK I'll just add a line in readme, tell them to zip the repo...(Clone or Download button)
Done, easier than what I've expected.
Now release section's only for major version and changelog... XD
OOOOOOOOOOK, they're blocking emus again. Bye my consecutive login bonus, I don't even bother login via my phone. (no event currently in JP server, yay)
Magisk hide working as always, tho.
So are we still proceeding with the observer design thing? Just wanna know the current status.
@29988122 Dayum, I was thinking of interfacing to Project Pendragon Alter and test it on Nox :(
@ryuga93 See if @TryBane has something to say / to do about the observer thing.
We've already done most of the refactoring I'd say. Here's our current progress: https://github.com/29988122/Fate-Grand-Order_Lua/projects/6#column-4037905
A lot of the refactoring was already accomplished by potchy. The only thing left for me is to get the observer pattern taken care of but I can do that here soon. I have Saturday and Sunday off this week and my work is cutting my hours down. This is a bonus for me, cause it means I can work more on articles for Gamepress and also work on this project at the same time :D
Anyways, I'll work on getting that observer pattern setup this weekend if you guys don't mind the wait.
@TryBane Thanks bro and no worries, we can wait 👍 .
No worries +1
We're just a bunch of volunteers after all, do it as you please XD
Do you guys know any servant database that has command card sprite, at every stage of accession? I could only managed to find this https://kazemai.github.io/fgo-vz/, but they are cropped from the card types, and only 3 images available train the Pendragon AI.
If I could get all the cards which include card types I would have 9 images to work with.
@ryuga93 我剛好最近在做android逆向...雖然一點毛關係都木有
我是覺得你的best shot就是模擬器打開fgo,點選設定內的下載所有檔案,然後去
/data/data/com.aniplex.fategrandorder/files/
在那之下會有一個特別大的...好像是assets資料夾? 裡面就是幾乎所有的素材檔案了。
檔案拉出來之後,你再研究下格式,然後寫個解包吧。
當然我們不要重複發明輪子
或者可以試試你有空的時候,去問那些data mining解包大佬,加個群交流交流也是可以的 - 他們應該很樂意協助,都是碼猴,自己人自己人
谢谢你的建议,但感觉太多东西要弄很麻烦所以已暂时放弃了Orz,在弄到素材档案之前得先弄个可以传输档案的http GET/POST。 pokeguys (#75) 提过Ankulua本身的httpGet()/ httpPost() 可以做到,但我还得研究一下。
除此之外,我想先让LUA更详细地认识战斗画面,写个半自动、不需要完整command的Autoskill再继续也不迟。因为现在的Pendragon Alter只懂最好的出卡顺序和brave chain,我们的LUA再改一下就可以知道brave chain了,根本不需要AI lolz。至少当LUA懂得战斗画面的大部分情况,就可以让AI发挥真正的自动战斗,在特殊情况下可以如人类般找出不一样的答案。
其实LUA也可以做到真正的自动战斗,只是可能没AI那样全面,写法也比较单调、花时间。我想到的方法是写个servant的object然后extend至每一个servant,花时间的是必须自己把所有的技能和宝具写进去。不过也许有更好的方法吧。
话说逆向蛮好玩 :3。记得以前玩神女控时不小心(?)把触摸精灵给破解了呵呵@@
http get / post
Yeah...troublesome especially when I / we're not really familiar with http protocol.
autoskill without the hassle of manually assigning parameters
Absolutely. I read a little about the recent starcraft 2 AI, but the level's too high for me apparently. I "believe"(wish, to be honest) that there must be a better way other than manually inputting data of every servant - it's not scalable nor feasible.
破解觸摸精靈 XD 你壞壞 我想到之前無意間發現網上其實有人在逆向ankulua,不過我有知會ankulua作者那個blog write-up的存在,後來blog作者好像將其撤下了。
雖說內容看起來其實也不難....(咦
It might be doable if we can get the servant data from the FGO database websites available and use them in our code. Then, we can delegate the scalability to the websites.
嗯,其实破解思路并不难,主要障碍是解开“暗号”,找到对的地方下手。
ryuga93
XD, indeed. But I wonder if the resolution's enough for us.
Just FYI: I asked if someday Ankulua would provide support of functions added in sikulix 1.1.4 such as: https://sikulix-2014.readthedocs.io/en/latest/pattern.html
And he said that he will look into it after Lunar New Year. Finally we have a way to deal with irregular/non-rectangle shape...XD
@ryuga93 For how to transfer file through Ankulua function.
Steps
- Read file in hex
- Send request with file content in hex.
- Done.
function readFile(fileName)
local file = io.open(Config.runtimePath .. fileName, 'rb')
local t = ''
repeat
local str = file:read(4 * 1024)
for c in (str or ''):gmatch'.' do
t = t .. string.format('%02X', c:byte())
end
until not str
file:close()
return t
end
function fetchAPI(method, endpoint, data)
if (not isString(method)) then
scriptExit('[fetchAPI] Method Not a String')
end
if (not isString(endpoint)) then
scriptExit('[fetchAPI] Endpoint Not a String')
end
if (not isTable(data)) then
scriptExit('[fetchAPI] Data Not a Table')
end
if (method:upper() == 'GET') then
return httpGet(Config.API_URL..endpoint)
else
return httpPost(Config.API_URL..endpoint, data)
end
end
function OCR(endpoint, reg)
screenshot(reg, 'tmp.png')
return fetchAPI('POST', endpoint, { hex=readFile('tmp.png'), token=getDeviceID() })
end
Issue
Each time you create a new request through the function, it will log the action and store it into a variable. At the end of the script, it will show up as an alert box to tell the user which URL are being requested.
But there is a small issue in Ankulua behavior. When the file is too large / too many request, the app itself will quit silently. This issue has been reported but the author of Ankulua refused to add a proper way to perform file upload or remove the logging stuff (which turn out is total meaningless and can be bypass).
Summary
- Ankulua author fix the request logging function.
- Ankulua author implement a better way to upload file.
- Build a fully customized HTTP lib in Lua.
Ref: HTTP library (Using busybox as cURL / Android NDK build a cURL binary)
After applying API, we can add some useful features like Servant current NP, Servant Skill Level, Player current AP etc. Those features required pre-processing and turn into binarized image, otherwise it cannot apply to tesseract and extract the number/string in the image.
@PokeGuys thanks! Will try it and see what I can cook up.
Although I won't be available within at least 3 months...
http://ankulua-tw.boards.net/thread/149/ Recent update of AnkuLua.
Here's the deal: https://sikulix-2014.readthedocs.io/en/latest/pattern.html#Pattern.mask We can greatly improve image recognition, overcome cropping restraints, by implementing the masking function.
@reconman this thread can be used for general discussion/chitchat btw.
https://github.com/29988122/Fate-Grand-Order_Lua/projects https://github.com/29988122/Fate-Grand-Order_Lua/wiki
These two links are some todos/documentations I wrote about half a year ago. Feel free to modify them if you feel the need to. Also, Project Pendragon by PokeGuys/ryugawa is another ongoing project bringing ML/AI in FGO automation script. WIP.
Just a FYI; thank you for your contribution!
@29988122 I've seen this issue and the 2 linked pages already.
Currently there are 3 places of documentation:
- In the code
- In the README
- In the Wiki
How should things be handled in the future? Update all 3 at the same time on every change?
I've been taught that you should only put code logic in code comments (sometimes write comments even when the code itself is self-evident), and any design/business logic in documentations.
Also README should be SIGNIFICANTLY SHORTER, cause it's for end users not for devs.
As you can see, I did not do them very well. Just a n00b coder and n00b tech documentation writer. I also tackled the doc/comment/readme sync issue myself a year ago, cause I've encountered this issue so many times in this repo alone. However I got limited results.
Not enough experience/no mentor caused this, I guess.
At the moment, I think you can do the coding style/comments/documentation cleanup as you wish - it's better if we follow one style from now on. (ask potchy first maybe)
Is the logic of choosing the danger servant before doing SkillCommand intentional?
Some more info on what I mean: onTurnStarted() chooses the target automatically, and then after that performBattle() will apply the SkillCommand.
Intentional.
I (we) can't quite figure out how to merge the choosing target (and user config) into SkillCommand. Currently I just point that to the enemy with probably most health (hence danger/servant).
Feel free to modify that part of the logic, to see if you can figure out how to combine target choosing/card chaining/skill using and make them run more smoothly!
In case anyone needs this: https://github.com/lsq5i5j/Fgo_teamup Readme in Chinese https://bbs.nga.cn/read.php?tid=21054760
Basically a battle emu....should be useful for NP % calculate/ML DL card selection use.
The latest version should be downloaded here, not on Github https://mega.nz/folder/yDQ1SKTJ#ZgCcQN6sGqisXkrOAKxVGQ