Jump to content

CmP

Ascended
  • Content Count

    317
  • Donations

    $0.00 
  • Joined

  • Last visited

  • Days Won

    17

Everything posted by CmP

  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.
  16. The group search is not ordered, so I would prefer second approach from those Enyby mentioned. For this case it would be something like the following: gg.setRanges(gg.REGION_ANONYMOUS) gg.clearResults() gg.searchNumber('1014350479;1012202996;1083179008;1050253722;1031127695;1065353216;1065353216;1067282596:61', gg.TYPE_DWORD) local results = gg.getResults(5000) local edited = {} for i, v in ipairs(results) do if v.value == 1014350479 then edited[#edited + 1] = {address = v.address, flags = v.flags, value = 1011011011} elseif v.value == 1050253722 or v.value == 1031127695 then edited[#edited + 1] = {address = v.address, flags = v.flags, value = 1} end end gg.setValues(edited)
  17. The answer is present in the description of returned value of prompt function from the documentation. In your case the call to the function (if dialog was not cancelled) returns a table with one element that has the key 1. Here is an example of how such table may look like: t = {[1] = 'Value from the field'} To access value that is associated with key, you need to index the table with that key. For the example above it would be: t[1] So in your code, you need to change usages of returned value by "prompt" function to access value of table element, not the table itself. For example: gg.searchNumber(prompt[1], gg.TYPE_DOUBLE)
  18. Such statements require proofs. You can say anything, but without proofs your words won't have any value. Being able to steal data does not mean that application does it. If it was so, one could say that all applications with root access are viruses and steal data. Obviously, it doesn't work like this and if you think it does, just don't use such applications. Moreover, don't use any applications with internet access, they can also steal your data.
  19. Noted, thanks for the advice. That's great.
  20. Well, maybe not by many, but at least by some for sure. In this topic I mentioned "some trigger of action when GG interface is active" and that it may be useful for helper scripts (the ones that help user in process of using GG). Yes, I have not offered any solution for such trigger, but you have found one and implemented it in the last update. I think that this new feature will be useful at least for some script developers (including me), so I wrote previous message to thank you for coming up with your solution for trigger of action for scripts.
  21. Long-awaited feature by many script developers, thank you!
  22. CmP

    LUA scripting

    @Puje you need to call "getValues" function to update the values. See this example: Examples of Lua scripts (#4rb1nadf)
  23. @ohright, this seems to be the chunk with the actual script. You can try to decompile it using any methods that you are aware of. load_0002005.lua
  24. This approach is correct, but there is one detail that is not considered: string that represents a number and an actual number is not the same key in a table. For example, r[1] and r['1'] refer to two different values in the table. So if you have string that represents a number, just convert it to an actual number using "tonumber" function (or any other way), then use that number to index the table with values for group search (table "p" in your case). Something like this: gg.searchNumber(r[1]..';100;'..p[tonumber(r[1])]..';1000:', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1) And that's it, you don't need bad list anymore. Also don't forget that "prompt" function can return nil and this case should be handled in order to avoid errors.
  25. You can, but this would be redundant, if you already have a table with information about desired memory items (essentially, addresses and types). For your case it is enough to perform first step from my previous post once (per script run), then perform second step whenever it is needed. Therefore, you don't need to use "loadResults" at all.
×
×
  • Create New...