Jump to content
  • 0

How to put input in setvalue after search.


OGNewbie

Question

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

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

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

Link to comment
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)

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.