Jump to content
  • 0

lua Script with promt an group-search


Maddin

Question

hy, i stop at this point.... and i don't know how i can solve the situation.

The Question is in this Code.

function FW()
   gg.clearResults()
 
      -- User-Promt to enter the Values 1 - 2 - 3 for the following Search
   d = gg.prompt(
      {'Geschwindigkeit', 'Schaden', 'Spezialschaden'},
      {},
      {[1]='text', [2]='text', [3]='text'}   
   )


 
   -- User enter 123 for "Geschwindigkeit"
   -- User enter 456 for "Schaden"
   -- User enter 789 for "Spezialschaden"


 
   gg.searchNumber('d[1] - Values;d[2] - Values;d[3] - Values', gg.TYPE_DWORD) -- here should be the values of Variable "d[1];d[2];d[3]" with the Values entered by the User
   local results = gg.getResults(100)
   for i, v in ipairs(results) do
     if v.value == 'd[1] - Values' then -- here should be the values of "d[1]"
         v.value = '10000'
      elseif v.value == 'd[2] - Values' then -- here should be the values of "d[2]"
         v.value = '999999'
      elseif v.value == 'd[3] - Values' then -- here should be the values of "d[3]"
        v.value = '999999' end   
   end
   gg.setValues(results)
end
_______________________________________________
added 1 minute later

And now it should do a group search with '123;456;789'

After the search the 123 changed in 10000
456 in 999999
789 in 999999

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

On 6/9/2018 at 8:06 AM, Maddin said:

I think i solved it by myself....

function FW() 
     gg.clearResults()
     d = gg.prompt(
          {'Geschwindigkeit', 'Schaden', 'Spezialschaden'},
          {},
          {[1]='text', [2]='text' , [3]='text'}
     )
 
     s = d[1] .. ';' .. d[2] .. ';' .. d[3]
 
     gg.searchNumber(s, gg.TYPE_DWORD)
     local results = gg.getResults(100)
     for i, v in ipairs(results) do
          if v.value == d[1] then
               v.value = '10000'
          elseif v.value == d[2] then
               v.value = '999999'
          elseif v.value == d[3] then
               v.value = '999999' end
     end
     gg.setValues(results)
end

 

Are you still active?  Have a question or two.

Link to comment
Share on other sites

I think i solved it by myself....

function FW() 
     gg.clearResults()
     d = gg.prompt(
          {'Geschwindigkeit', 'Schaden', 'Spezialschaden'},
          {},
          {[1]='text', [2]='text' , [3]='text'}
     )
 
     s = d[1] .. ';' .. d[2] .. ';' .. d[3]
 
     gg.searchNumber(s, gg.TYPE_DWORD)
     local results = gg.getResults(100)
     for i, v in ipairs(results) do
          if v.value == d[1] then
               v.value = '10000'
          elseif v.value == d[2] then
               v.value = '999999'
          elseif v.value == d[3] then
               v.value = '999999' end
     end
     gg.setValues(results)
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.