Jump to content


  • Content Count

  • Donations

  • Joined

  • Last visited

  • Days Won


CmP last won the day on February 18

CmP had the most liked content!

Community Reputation

340 Boss

About CmP

  • Rank
    Experienced Member

Additional Information

  • Android
    7.x (Nougat)
  • Device
    Xiaomi Redmi Note 4X

Recent Profile Visitors

7,818 profile views
  1. I did not mean it and why do you think that he did it wrong? The only mistake in the code from the message you quoted was pointed out by Enyby several posts above. As per my suggestion, he did exactly what I described.
  2. You don't need to search for values each time, so move the code for searching values (and the call to "getResults" function) outside the function. It should be executed once before the first call to "doAction" function, so you can insert it, for example, right before the line with "while true do" code.
  3. There is an example of the code for performing an action by clicking on GG icon: Examples of Lua scripts (#d2j0lrom) It's not a complete solution for your task, but may be a good starting point.
  4. You can do it identically to the following example of freezing values: Examples of Lua scripts (#719ibioj)
  5. Use numeric for loop: for i = 1, 100, 1 do print(i) end More info about it can be found in Lua reference manual: https://www.lua.org/manual/5.3/manual.html#3.3.5
  6. You need to call "getResults" function to store results list in a variable. For example: gg.searchNumber('300', gg.TYPE_DWORD) local r = gg.getResults(100) Then, when results list has been cleared and you want to restore saved results, just use "loadResults" function: gg.loadResults(r)
  7. As it is written in the previous post, it can be done with a script. For example, script can monitor changes of search result list and save search results when such change occurs. This idea is implemented in the following script: Search results auto backup (#6fyaxdwh)
  8. CmP

    LUA scripting

    You have quoted old message. "REGION_VIDEO" constant was not present in the API back then. As for you question. Of course there is a number associated with this constant. You can print it with the following code: print("gg.REGION_VIDEO:", gg.REGION_VIDEO)
  9. Just like you did it with one global variable, but create as many global variables as switches you need. Or better create a table that will contain status values for all switches.
  10. CmP

    how to track value change

    Identically to the code for one value, just different actions in "if" blocks. For example: local v = gg.getResults(2) gg.setVisible(false) while not gg.isVisible() do local old1 = v[1].value local old2 = v[2].value v = gg.getValues(v) if old1 ~= v[1].value then gg.setSpeed(1.0) gg.toast('First value has changed: ' .. old1 .. ' -> ' .. v[1].value) end if old2 ~= v[2].value then gg.setSpeed(90.0) gg.toast('Second value has changed: ' .. old2 .. ' -> ' .. v[2].value) end gg.sleep(100) end
  11. CmP

    how to track value change

    The idea is same for tracking changes of multiple values. Just few things need to be changed in the code: 1. Build/get a table with all required values, not just one. Example: local t = gg.getResults(2) -- Using first two results t[#t + 1] = {address = 0x11223344, flags = gg.TYPE_DWORD} -- And a value at custom address 2. Save old values of table elements before entering loop. Custom field can be used for that. Example: t = gg.getValues(t) for i, v in ipairs(t) do v.old_value = v.value end 3. Process all elements of the table in loop. Example: while not gg.isVisible() do t = gg.getValues(t) for i, v in ipairs(t) do if v.value ~= v.old_value then -- do something v.old_value = v.value end end gg.sleep(100) end
  12. The following code may have identical effect to the code you have logged: gg.setRanges(gg.REGION_ANONYMOUS) gg.searchNumber('256;100F;30F::65', gg.TYPE_DWORD) gg.refineNumber('256', gg.TYPE_DWORD) local results = gg.getResults(1) results[1].value = 1 results[1].freeze = true results[2] = {address = results[1].address + 12, flags = gg.TYPE_DWORD, value = 0, freeze = true} gg.addListItems(results)
  13. It's not the only way, but it is suitable for your case. The most efficient implementation of this way from the ones proposed in this topic can be found in this post: How to group values to edit in a search? (#2mhgpa6) It reuses the table returned by "getResults" function that leads to better performance of the code, but as it was mentioned above, it does not really matter when results count is relatively small.
  14. Oh, that's a good idea, haven't thought about it. Just like it was mentioned few posts above, another thing has been learned. It's amazing that new things can be learned even about the topics that looks easy.
  15. Yeah, absolutely, thanks for pointing that out.
  • Create New...