CyrA Posted December 26, 2018 Posted December 26, 2018 Hello, I would like to Open 3 issues : one critical bug in last version, one major bug in all tested version, and one request for explication and improvement. All of this is related with the following lua script for gg : function searchNSave(input) gg.searchNumber(input.search, gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1) local r = gg.getResults(input.maxresults, nil, nil, nil, nil, nil, nil, nil, nil) local str = '' for i,v in ipairs(r) do if v.value ~= input.stars and v.value > 0.9 and v.value < 5.1 then local f = {} f[1] = {} f[1].address = v.address f[1].flags = v.flags f[1].name = input.name..' ('..i..') '..v.value gg.addListItems(f) str = str ..' '.. v.value end end gg.toast(input.name..':'..str) end local heros = {} local nb = 0 nb = 1 heros[nb] = {} heros[nb].name = 'Alice' heros[nb].stars = 3 heros[nb].search = '12;249;3;56;1;1;1;7;12;56;223;244;12;1;56;226;12;247;56;184;1;12;56:1057' heros[nb].maxresults = 23 nb = 2 heros[nb] = {} heros[nb].name = 'Bob' heros[nb].stars = 3 heros[nb].search = '8;3;197;3;56;3;4;7;56;319;182;58;1;246;70201;56;8;247;56;153;1;240;58;56:1121' heros[nb].maxresults = 25 nb = 3 heros[nb] = {} heros[nb].name = 'Carol' heros[nb].stars = 3 heros[nb].search = '8;3;197;3;56;3;5;7;440;56;221;58;1;220201;261;56;319;58;247;56;68;3;58;56:1121' heros[nb].maxresults = 25 nb = 4 heros[nb] = {} heros[nb].name = 'Dave' heros[nb].stars = 3 heros[nb].search = '8;3;209;3;56;3;7;56;221;58;1;20201;219;56;58;247;56;15;3;58;56:1025' heros[nb].maxresults = 22 for i,hero in ipairs(heros) do -- gg.clearResults() gg.toast(i..'/'..nb..': '..hero.name..' (stars='..hero.stars..')...') searchNSave(hero) gg.sleep(500) end 1st issue; critical bug: This script worked fine with version 8.69.1 but with th last version (70.2) the call "gg.addListItems(f)" in the "searchNSave" function do nothing ! (Then i have had to downgrade to 8.69.1). 2nd issue, major bug: If "gg.clearResults()" is uncommented, the following "gg.searchNumber()" will do nothing exactly half of the time. Always calling gg.clearResult() before gg.searchNumber() is an undocumented workaround to avoid this bug which could be easily fixed by including gg.clearResults() in the beginning of gg.searchNumber(). 3rd issue, request for explication/improvment: The "search" strings are generated by an other (bash) script who extract data from some files written by the game. Then we notice they may contain the same value more than once. I have notice it may not be useful as gg always result all occurrences of a searched value in its range, and it seems to only increase the time of search. Is is exact ? May you improve the group search feature by introducing eventual {} for each number, to permit to precise the (range of) occurrence of a searched value in the range. eg: '8{3};15;2014{2~5}:1025' will search for exactly 3 times a '8', any numbers of '15' (default = {1~} = from 1 to infinite), and beetween 2 and 5 times a '2014'. Then you may improve this feature to always rewrite search string to it's optimized form, eg: '2;56;7;56;220201;56;311{1~5};203;56;311;56:801' -> '2;7;56{4~};203;311{2~5};220201:801' That's all. PS: where to submit my lua scripts to hack games with GG ?
Administrators Enyby Posted December 26, 2018 Administrators Posted December 26, 2018 1. Need clear example which can be run for any process. You post something required special condition, so it hard to test properly. Make clear and small example for any process. 2. Same as above. 3. No. This can not work in that way. It is not regular expressions or something like that. ps. In downloads section. 1
CyrA Posted December 26, 2018 Author Posted December 26, 2018 1&2 : So u would like to have a script to test bug 1 and 2. Eg a non-regression or unitary test. Have you already some of them somewhere (so I may improve them) ? (I don't know how to make lua script using arbitrary written memory region instead of those of a running game). 3. I understand very well that the search string is directly parsed and executed, and that is not a light feature request. Maybe you could let my contribute to GG (and give me a partial git access) ? ps. Thanks, going back looking for it.
Administrators Enyby Posted December 26, 2018 Administrators Posted December 26, 2018 1, 2: Just make simple script which illustrate issue. I think your script not work for me at all, because I do not have this game, and others condition not met. Is is easy. For example if not work gg.addListItems then you can make something like that: gg.clearResults() gg.searchNumber('0', gg.TYPE_DWORD) t = gg.getResults(10000) gg.addListItems(t) v = gg.getListItems() print(#t, #v) Search zero get a lot results. We load first 10000 and add to saved list. And get it back to script. And finally we print count loaded values. Also its stay in saved list and you check it via UI. And it is OK for me. If it not OK I get not 10000 in second value of print. And in saved list see less items then 10000. 3. We do not share source. It is very complicated. In my assumption you can not understand what going here, but you can leak sources. So for access to source we need talk in PM where you must approve your interest and skill. _______________________________________________ added 4 minutes later 3. If you interest you can try imagine how make ordered (or not ordered) search with limited amount memory for input of unlimited amount of memory. Better for one pass and optimized. This task is not easy as sound. Also you need hold some cases like duplicates in search. For example "5;5;5;5". Also it can be ordered or not. 2
Administrators Enyby Posted December 26, 2018 Administrators Posted December 26, 2018 3 hours ago, CyrA said: for i,v in ipairs(r) do if v.value ~= input.stars and v.value > 0.9 and v.value < 5.1 then local f = {} f[1] = {} f[1].address = v.address f[1].flags = v.flags f[1].name = input.name..' ('..i..') '..v.value gg.addListItems(f) str = str ..' '.. v.value end end This way can be not effective. You can build table in loop and make one call addListItems for all items. It must be faster, but require more memory. 1
CyrA Posted December 26, 2018 Author Posted December 26, 2018 (edited) I have re-install last version (70.2) and add a print in my function : function searchNSave(input) gg.searchNumber(input.search, gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1) local r = gg.getResults(input.maxresults, nil, nil, nil, nil, nil, nil, nil, nil) local str = '' for i,v in ipairs(r) do if v.value ~= input.stars and v.value > 0.9 and v.value < 5.1 then local f = {} f[1] = {} f[1].address = v.address f[1].flags = v.flags f[1].name = input.name..' ('..i..') '..v.value gg.addListItems(f) str = str ..' '.. v.value local v = gg.getListItems() print(#f, #v) end end gg.toast(input.name..':'..str) end And i get: Edited December 26, 2018 by CyrA screenshot too large
Administrators Enyby Posted December 26, 2018 Administrators Posted December 26, 2018 Also in your case this number can be not equal. You add list items to not empty list. If item duplicate, then it replace. If not - added to list. _______________________________________________ added 1 minute later 9 minutes ago, CyrA said: gg.addListItems(f) Add print here for this issue. Maybe you get error here. addListItems can return string with error. _______________________________________________ added 2 minutes later And add print f. print(f, gg.addListItems(f)) 2
CyrA Posted December 26, 2018 Author Posted December 26, 2018 I have improve my function as you recommended : function searchNSave(input) gg.searchNumber(input.search, gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1) local r = gg.getResults(input.maxresults, nil, nil, nil, nil, nil, nil, nil, nil) local str = '' local f = {} local j = 1 for i,v in ipairs(r) do if v.value ~= input.stars and v.value > 0.9 and v.value < 5.1 then f[j] = {} f[j].address = v.address f[j].flags = v.flags f[j].name = input.name..' ('..i..') '..v.value j = j +1 str = str ..' '.. v.value end end gg.addListItems(f) local v = gg.getListItems() print(#f, #v) gg.toast(input.name..':'..str) end But the result is the same :
CyrA Posted December 26, 2018 Author Posted December 26, 2018 Ok, I also rename 'f' to 't' (just in case of some lua secret magic like ( cf. getn() ) : function searchNSave(input) gg.searchNumber(input.search, gg.TYPE_DOUBLE, false, gg.SIGN_EQUAL, 0, -1) local r = gg.getResults(input.maxresults, nil, nil, nil, nil, nil, nil, nil, nil) local str = '' local t = {} local j = 1 for i,v in ipairs(r) do if v.value ~= input.stars and v.value > 0.9 and v.value < 5.1 then t[j] = {} t[j].address = v.address t[j].flags = v.flags t[j].name = input.name..' ('..i..') '..v.value j = j +1 str = str ..' '.. v.value end end print(t, gg.addListItems(t)) local v = gg.getListItems() print(#t, #v) gg.toast(input.name..':'..str) end And the list I like too add seems correct: 1
Administrators Enyby Posted December 26, 2018 Administrators Posted December 26, 2018 Look like bug. If you not set `value` then value not added to saved list. Will be fixed in next release. 2
CmP Posted December 26, 2018 Posted December 26, 2018 11 hours ago, CyrA said: 2nd issue, major bug: If "gg.clearResults()" is uncommented, the following "gg.searchNumber()" will do nothing exactly half of the time. Always calling gg.clearResult() before gg.searchNumber() is an undocumented workaround to avoid this bug which could be easily fixed by including gg.clearResults() in the beginning of gg.searchNumber(). This is not a bug, it is supposed to work like that. Refer to description of "searchNumber" function in GG help: https://gameguardian.net/help/classgg.html#a7efd4ac7766e72688cb4a84a3915721e Quote If no results in results list then perform new search else refine search. So if you need new search, make sure to clear results list first. 2
CyrA Posted December 27, 2018 Author Posted December 27, 2018 12 hours ago, CmP said: This is not a bug, it is supposed to work like that. Refer to description of "searchNumber" function in GG help: https://gameguardian.net/help/classgg.html#a7efd4ac7766e72688cb4a84a3915721e So if you need new search, make sure to clear results list first. Thx a lot. For now I didn't need to refine to take care of this hint. Maybe the documentation could be more explicit, eg: put a gg.clearResults in the "see also" and in the example + write in comment when gg.searchNumber will do a new search or a refine. 2
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now