Jump to content
Sign in to follow this  
OGNewbie

How to put input in setvalue after search.

Recommended Posts

Posted (edited)

Hi all, 

I want to put value by myself after the search complete how do I do that.

The gg.prompt does not work on set value as it shows error saying string required got table. 

Help Appriciated.

The example code below:

 

 

function custom1()

 

    gg.clearResults()

    gg.getRanges()

    gg.setRanges(gg.REGION_C_ALLOC)

    gg.searchNumber("19811;10616;10606;10611:512",gg.TYPE_DWORD)

    local Lapiss = gg.getResults(gg.getResultsCount())

    Lapiss[2].value = 

    Lapiss[2].freeze = true

    Lapiss[2].freezeType = gg.FREEZE_NORMAL

    Lapiss[3].value = 

    Lapiss[3].freeze = true

    Lapiss[3].freezeType = gg.FREEZE_NORMAL

    Lapiss[4].value = 

    Lapiss[4].freeze = true

    Lapiss[4].freezeType = gg.FREEZE_NORMAL

    gg.setValues(Lapiss)

    gg.addListItems(Lapiss)

 

end

Edited by OGNewbie

Share this post


Link to post
Share on other sites

try this example..

gg.searchNumber("19811;10616;10606;10611:512",gg.TYPE_DWORD)

local Lapiss = gg.getResults(gg.getResultsCount())

for i,v in pairs(Lapiss) do
    if v.value == 19811 then
       v.value = <your value>
       v.freeze = true
    elseif
       v.value == 10616 then
       v.value = <your value>
       v.freeze = true
    elseif
       v.value == 10606 then
       v.value = <your value>
       v.freeze = true
    elseif
       v.value == 10611 then
       v.value = <your value>
       v.freeze = true
    end
 end
gg.addListItems(Lapiss)

 

Share this post


Link to post
Share on other sites
Posted (edited)
16 minutes ago, MonkeySAN said:

try this example..


gg.searchNumber("19811;10616;10606;10611:512",gg.TYPE_DWORD)

local Lapiss = gg.getResults(gg.getResultsCount())

for i,v in pairs(Lapiss) do
    if v.value == 19811 then
       v.value = <your value>
       v.freeze = true
    elseif
       v.value == 10616 then
       v.value = <your value>
       v.freeze = true
    elseif
       v.value == 10606 then
       v.value = <your value>
       v.freeze = true
    elseif
       v.value == 10611 then
       v.value = <your value>
       v.freeze = true
    end
 end
gg.addListItems(Lapiss)

 

No, I did not mean like that. The code you gave me is same but in different way.

Sorry for misunderstanding. Thanks anyway.

What I wanted to know was what do I put after (=) in Lapiss[1].value = , so that when I run the script it asks for me to input the value so that it can be edited to the new inputed value.

The gg.prompt did not work in it like Lapiss[1].value = gg.prompt({'"edit value"}, [1] = 'number'),  I know this one is wrong but something like this.

Edited by OGNewbie

Share this post


Link to post
Share on other sites
Posted (edited)

maybe something like this..

gg.searchNumber("1;2;3:512",4)

local d = gg.prompt({"Edit value 1:","Edit value 2:","Edit value 3:"},{0,0,0})

if d == nil then gg.clearResults() os.exit()
else
  
local t = gg.getResults(10000)
  
for i,v in pairs(t) do
    if v.value == 1 then
       v.value = d[1]
    elseif
       v.value == 2 then
       v.value = d[2]
    elseif
       v.value == 3 then
       v.value = d[3]
    end
 end
 gg.setValues(t)
 gg.clearResults()
 end

 

Edited by MonkeySAN

Share this post


Link to post
Share on other sites
On 6/9/2021 at 6:01 PM, MonkeySAN said:

maybe something like this..


gg.searchNumber("1;2;3:512",4)

local d = gg.prompt({"Edit value 1:","Edit value 2:","Edit value 3:"},{0,0,0})

if d == nil then gg.clearResults() os.exit()
else
  
local t = gg.getResults(10000)
  
for i,v in pairs(t) do
    if v.value == 1 then
       v.value = d[1]
    elseif
       v.value == 2 then
       v.value = d[2]
    elseif
       v.value == 3 then
       v.value = d[3]
    end
 end
 gg.setValues(t)
 gg.clearResults()
 end

 

Yes, this does work the way I wanted. Thanks MonkeySAN

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...