Jump to content


  • Content Count

  • Donations

  • Joined

  • Last visited

  • Days Won


Everything posted by CmP

  1. This way the values won't be frozen. Need to call "addListItems" function after the loop that sets "freeze" field to "true".
  2. "freezeType" parameter has default value of "gg.FREEZE_NORMAL", so it's not necessary to explicitly specify it. However, you are absolutely correct about missing call to "addListItems" function that is required to save values to saved list.
  3. CmP

    Cheat Engine server

    It is needed in all cases if you want to use Cheat Engine from PC as client to the server that is running on your android device. Here you can find the description of what the command does: https://developer.android.com/studio/command-line/adb#forwardports
  4. Then you should be grateful that someone who can see the comments pointed you to the answer to your question, shouldn't you? And the explanation may be still useful for someone else.
  5. CmP

    Find nearby

    If address of target value is 0x22446688 and you want to search for dword values that are located within 0x100 distance from target value, the following code can be used: gg.clearResults() gg.startFuzzy(gg.TYPE_DWORD, 0x22446588, 0x22446788) Also there is a brief explanation of how nearby search works in the following post: 96.0: Added nearby search - GameGuardian (#bese6m2m)
  6. CmP


    If "spam a text" means "repeat text certain amount of times", then you need to: 1. construct string in which desired text is repeated desired amount of times; 2. pass it as argument to "alert" function. First step can be done using loop or "string.rep" function. Examples: -- Using loop local str = '' for i = 1, 10 do str = str .. 'text to repeat\n' end -- Using string.rep function local str = string.rep('text to repeat\n', 10) Second step is just to call "alert" function and pass constructed string to it as argument. Example: gg.alert(str) No, there is no function for pasting clipboard contents in GG API, because it's not something that is needed (or even applicable) for GG scripts. And after all, you can paste copied text to text fields manually.
  7. You can use group search of bytes. Search string for your case may look like the following: "0;0;0;70h~7Fh;0~~0;0~~0;0Eh~FEh;98h::8" With this search string and selected "Byte" type it should find all sequences of bytes that match your pattern. However, it can also find some sequences that don't match the pattern fully. This is because it's not possible to specify a range for finding a byte of pattern "?E", but one can specify a range that includes all of the values that match the pattern. This alone is enough to eliminate some non-matching bytes, including the most frequent value in memory - 0. To exclude results that are not full matches of the pattern, you need to check 7th byte of every found byte sequences. If it doesn't match the pattern "?E", delete currently checked sequence from search results.
  8. This question is answered in the comment above yours, but it seems that you don't understand how nearby search works, so I will try to clarify. Nearby search works just like normal search, but it only searches for values at within certain distance before and/or after target value. For example, target value's address is 12345000 in hex. If you choose distance 1000 (also in hex) and select "Before" and "After", then the search will be performed only in the following range of addresses: [12345000 - 1000; 12345000 + 1000], i.e. from 12344000 to 12346000. You can achieve the same effect by inputting these numbers in "From" and "To" fields of the normal search dialog. At this point it should be obvious, how can you use this feature in script. If it's not, read the comment above yours, then try to find the answer in documentation for "searchNumber" function.
  9. 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.
  10. 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.
  11. 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.
  12. You can do it identically to the following example of freezing values: Examples of Lua scripts (#719ibioj)
  13. 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
  14. 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)
  15. 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)
  16. 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)
  17. 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.
  18. 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
  19. 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
  20. 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)
  21. 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.
  22. 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.
  23. Yeah, absolutely, thanks for pointing that out.
  24. 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)
  25. 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)
  • Create New...