Jump to content

CmP

Ascended
  • Content Count

    412
  • Donations

    $0.00 
  • Joined

  • Last visited

  • Days Won

    26

CmP last won the day on July 14

CmP had the most liked content!

Community Reputation

428 Boss

About CmP

  • Rank
    Experienced Member

Recent Profile Visitors

11,025 profile views
  1. CmP

    freeze value

    There is no way to do that. Your understanding is absolutely correct.
  2. CmP

    Search

    Finding such groups of values can be done by firstly searching for known value (XX). For each found value it is then needed to check the condition of whether Value1 xor Value2 is equal to the found value. If the condition is met, group of values can be added to results list or saved list. Below is an example of implementing this approach with lua script: local knownValue = "123" gg.clearResults() gg.searchNumber(knownValue, gg.TYPE_DWORD) local results = gg.getResults(gg.getResultsCount()) local checkedValues = {} for i, v in ipairs(results) do checkedValues[i * 2 - 1] = {address = v.address - 8, flags = v.flags} checkedValues[i * 2] = {address = v.address - 4, flags = v.flags} end -- Retrieving all values to check at once to avoid calling "getValues" in loop checkedValues = gg.getValues(checkedValues) local foundGroups = {} for i, v in ipairs(results) do local value1 = checkedValues[i * 2 - 1] local value2 = checkedValues[i * 2] local xorResult = value1.value ~ value2.value if xorResult == v.value then table.insert(foundGroups, value1) table.insert(foundGroups, value2) table.insert(foundGroups, v) end end gg.loadResults(foundGroups)
  3. CmP

    addListItems with v.name

    Could be the case when elements of traversed table need to be modified themselves. Assigning new value to "v" has no effect on "t[index]", so referring to table element explicitly is required in this case. Example: -- Wrong, table is unchanged for i, v in ipairs(t) do v = {address = 0x10203040 + 4 * i, flags = gg.TYPE_DWORD, value = "0"} end -- Correct for i, v in ipairs(t) do t[i] = {address = 0x10203040 + 4 * i, flags = gg.TYPE_DWORD, value = "0"} end
  4. CmP

    addListItems with v.name

    This is wrong. "t" is a table of tables, so "v" in our loop refers to particular sub-table (one per iteration). Lua reference manual states the following: In our case it means that "v" is a reference to same table as "t[index]", so any of these references can be used to set value of a field in that same table. Here is the code to illustrates that "name" field of sub-tables is indeed being set: local t = { {address = 0x11223344, flags = gg.TYPE_DWORD, value = 0}, {address = 0x11223348, flags = gg.TYPE_DWORD, value = 0} } for i, v in ipairs(t) do v.name = "Characters" end for i, v in ipairs(t) do print(i, t[i].name) end
  5. CmP

    addListItems with v.name

    You need to either filter the table returned by "getListItems" function via "deleting" (setting to nil) elements that have different name or build a new table only with elements that have desired name. Here is an example of implementing the first approach (first 5 lines of the code): How to remove named value in the save list? (#86ip1n3c)
  6. There are two script-based options to consider: - to use gg.dumpMemory function on each memory range of interest to produce a separate file for each range; - to implement custom dumping logic for producing result in desired form (for example, dumping all memory ranges of interest to one file). Implementing the first option is pretty straightforward, here is an example of how it can be done: local outputPath = "/sdcard/Download" local ranges = gg.getRangesList() for i, v in ipairs(ranges) do if v.state == "A" then gg.dumpMemory(v["start"], v["end"], outputPath) end end Implementing the second option is less straightforward, one firstly needs to determine how custom dump result should look like. Also any implementation of the second option is likely to be noticeably slower than implementation of the first option where dumping is performed with GG's built-in function.
  7. Use "getValues" function to get value at desired address, then modify "value" field in returned table as needed and call "setValues" function. For example: local result = gg.getResults(1) local val = {} val[1] = {address = result[1].address + 0x14, flags = gg.TYPE_DWORD} val = gg.getValues(val) val[1].value = val[1].value + 1000 gg.setValues(val)
  8. Try adding logging to the code. Replace the regular call to "getResults" function with: local results = gg.getResults(50000) print("Count of results:", #results) and the call to "editAll" function with: print("Edited values:", gg.editAll("0", gg.TYPE_DWORD))
  9. There is a code in that post, but in case you have difficulties with adapting it, here is a basic template: local function f1() print("Feature 1") end local function f2() print("Feature 2") end local features = { {name = "First feature", func = f1}, {name = "Second feature", func = f2} } local featureNames = {} local featureFunctions = {} for i, v in ipairs(features) do table.insert(featureNames, v.name) table.insert(featureFunctions, v.func) end local choice = gg.choice(featureNames) if choice ~= nil then featureFunctions[choice]() end
  10. Take a look at the approach shown in this post: How to create Menu with values (#2j8mdsbl) The idea is to have one table with definition of every item in a menu with each item having a name and a function. It is then trivial to construct a table of names and functions from the main table. Table with names is then passed to "gg.choice" or "gg.multiChoice" function and the returned value(s) is used to index functions table to retrieve the function that corresponds to selected feature(s) and finally retrieved function is called.
  11. For example, with the following adaptation of the code: local function A() print("A") end local function B() print("B") end local function C() print("C") end local function D() print("D") end local function E() print("E") end local mapping = { [1] = {name = "A", func = A}, [4] = {name = "B", func = B}, [5] = {name = "C", func = C}, [3] = {name = "D", func = D}, [6] = {name = "E", func = E} } local menuNames = {} local menuFunctions = {} for i, v in ipairs(values) do local item = mapping[v.value] if item ~= nil then -- ignoring values that are absent in "mapping" table table.insert(menuNames, item.name) table.insert(menuFunctions, item.func) end end local choice = gg.choice(menuNames) if choice ~= nil then menuFunctions[choice]() end Let me know whether it works as you expect it to.
  12. As you can notice, "ipairs" iterator function is used on "values" table obtained from the call to "getValues" function that has "results" table as it's argument that in turn is obtained from the call to "getResults" function that returns a table with all it's elements being traversable with "ipairs" function. So usage of "ipairs" function in the code from my post is correct and replacing it with "pairs" won't make any difference in this case.
  13. This local variable needs to be created outside the "if" block for it to be visible in the "else" block where the variable is used: local myValues -- ... if not myValues then -- ... myValues = ... -- setting the variable created outside the block -- ... else -- using the variable end "addListItems" function doesn't edit values unless they need to be frozen ("freeze" field being set to true), for editing values one needs to use "setValues" function.
  14. First of all, it seems that using saved list and loading results is not required in your case, so the code can be rewritten to: gg.clearResults() gg.searchNumber("1000", gg.TYPE_DWORD) local count = gg.getResultsCount() local results = gg.getResults(count) for i, v in ipairs(results) do v.address = v.address + 4 end local values = gg.getValues(results) -- table with target values Then, the menu that you described can be created from data in "values" table with the following code: local mapping = { [1] = "A", [4] = "B", [5] = "C", [3] = "D", [6] = "E" } local menuItems = {} for i, v in ipairs(values) do local item = mapping[v.value] if item ~= nil then -- ignoring values that are absent in "mapping" table table.insert(menuItems, item) end end gg.choice(menuItems)
  15. You are right, the code from my post above doesn't work as expected. There is a mistake in it. Here is a fixed version of the code that works for me: local ros = gg.getListItems() for i, v in ipairs(ros) do if v.name ~= "lock fly" then ros[i] = nil end end gg.removeListItems(ros) gg.toast(" unlock fly ")
×
×
  • Create New...