Jump to content
  • 0

I find the string value in Lua code but I can't change it


Pala9999
 Share

Question

I wrote this code with the help of chat gpt but after searching and finding this code as utf16, I cannot change the number when I change it to a different number in this format ;192762458137 can you help me?
 

function utf16le_search()
    gg.clearResults()  -- Clear previous search results

    -- Set memory ranges to include all specified ranges (Java Heap, C++ Heap, etc.)
    gg.setRanges(gg.REGION_ANONYMOUS | gg.REGION_JAVA_HEAP | gg.REGION_C_HEAP | gg.REGION_C_ALLOC | gg.REGION_C_DATA | gg.REGION_C_BSS)

    -- Search for the UTF-16LE value
    gg.searchNumber(";192762458137", gg.TYPE_UNICODE)

    local results = gg.getResults(5000)  -- Retrieve up to 5000 results

    if #results > 0 then
        gg.toast("192762458137 value was found and the results were recorded")
        gg.addListItems(results)  -- Add the results to the list
    else
        gg.toast("No value found")
    end
end

utf16le_search()

 

This code below is a piece of code that chat gpt wrote, I used to find and change the value I wrote, but it does not work properly.

 

function utf16le_search()
    gg.clearResults()  -- Clear previous search results

    -- Set memory ranges to include all specified ranges (Java Heap, C++ Heap, etc.)
    gg.setRanges(gg.REGION_ANONYMOUS | gg.REGION_JAVA_HEAP | gg.REGION_C_HEAP | gg.REGION_C_ALLOC | gg.REGION_C_DATA | gg.REGION_C_BSS)

    -- Search for the UTF-16LE value
    gg.searchNumber(";192762458137", gg.TYPE_UNICODE)

    local results = gg.getResults(5000)  -- Retrieve up to 5000 results

    if #results > 0 then
        gg.toast("192762458137 value was found and the results were recorded")
        gg.addListItems(results)  -- Add the results to the list

        -- Define the new value (for example, a new UTF-16LE number or text)
        local new_value = ";987654321098"  -- New UTF-16LE value (example)
        
        -- Write the new value to the locations where the old value was found
        for i, result in ipairs(results) do
            result.value = new_value  -- Change the old value to the new value
        end

        -- Apply the changes
        gg.setValues(results)  -- Apply the updates to the results

        gg.toast("Values were successfully changed")
    else
        gg.toast("Value not found")
    end
end

utf16le_search()

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
On 11/8/2024 at 11:55 PM, Pala9999 said:

I wrote this code with the help of chat gpt but after searching and finding this code as utf16, I cannot change the number when I change it to a different number in this format ;192762458137 can you help me?
 

function utf16le_search()
    gg.clearResults()  -- Clear previous search results

    -- Set memory ranges to include all specified ranges (Java Heap, C++ Heap, etc.)
    gg.setRanges(gg.REGION_ANONYMOUS | gg.REGION_JAVA_HEAP | gg.REGION_C_HEAP | gg.REGION_C_ALLOC | gg.REGION_C_DATA | gg.REGION_C_BSS)

    -- Search for the UTF-16LE value
    gg.searchNumber(";192762458137", gg.TYPE_UNICODE)

    local results = gg.getResults(5000)  -- Retrieve up to 5000 results

    if #results > 0 then
        gg.toast("192762458137 value was found and the results were recorded")
        gg.addListItems(results)  -- Add the results to the list
    else
        gg.toast("No value found")
    end
end

utf16le_search()

 

This code below is a piece of code that chat gpt wrote, I used to find and change the value I wrote, but it does not work properly.

 

function utf16le_search()
    gg.clearResults()  -- Clear previous search results

    -- Set memory ranges to include all specified ranges (Java Heap, C++ Heap, etc.)
    gg.setRanges(gg.REGION_ANONYMOUS | gg.REGION_JAVA_HEAP | gg.REGION_C_HEAP | gg.REGION_C_ALLOC | gg.REGION_C_DATA | gg.REGION_C_BSS)

    -- Search for the UTF-16LE value
    gg.searchNumber(";192762458137", gg.TYPE_UNICODE)

    local results = gg.getResults(5000)  -- Retrieve up to 5000 results

    if #results > 0 then
        gg.toast("192762458137 value was found and the results were recorded")
        gg.addListItems(results)  -- Add the results to the list

        -- Define the new value (for example, a new UTF-16LE number or text)
        local new_value = ";987654321098"  -- New UTF-16LE value (example)
        
        -- Write the new value to the locations where the old value was found
        for i, result in ipairs(results) do
            result.value = new_value  -- Change the old value to the new value
        end

        -- Apply the changes
        gg.setValues(results)  -- Apply the updates to the results

        gg.toast("Values were successfully changed")
    else
        gg.toast("Value not found")
    end
end

utf16le_search()

 

gg.clearResults()

gg.searchNumber(";192762458137",2)

gg.getResults(gg.getResultsCount())

gg.editAll(";987654321098,2)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...