Jump to content
Sign in to follow this  
Kimiice7

Help with seekbar gg.prompt add variable group search

Recommended Posts

Please help me how to make group search like this

r = gg.prompt({'LEVEL [1;5]'},{1},{'number'})
p = {'10','20','30','40','50'}


--bad list--
if r[1] == '1' then rp = p[1] end
if r[1] == '2' then rp = p[2] end
if r[1] == '3' then rp = p[3] end
if r[1] == '4' then rp = p[4] end
if r[1] == '5' then rp = p[5] end

gg.searchNumber(r[1]..';100;'..rp..';1000:', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)

--How to call rp in group search without making bad list..??--
--Because i have 100 items in table p{} --
-- for p[x] , how to set x= r[1] ?? --
-- i tried this --
--gg.searchNumber(r[1]..';100;'..p[r[1]]..';1000:', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)--
--also tried x = r[1] then call p[x] but didn't work--

--Thanks for your help guys--

help variable gg.prompt.lua

Share this post


Link to post
Share on other sites

11 minutes ago, Kimiice7 said:

-- i tried this --
--gg.searchNumber(r[1]..';100;'..p[r[1]]..';1000:', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)--

This approach is correct, but there is one detail that is not considered: string that represents a number and an actual number is not the same key in a table. For example, r[1] and r['1'] refer to two different values in the table.

So if you have string that represents a number, just convert it to an actual number using "tonumber" function (or any other way), then use that number to index the table with values for group search (table "p" in your case). Something like this: 

gg.searchNumber(r[1]..';100;'..p[tonumber(r[1])]..';1000:', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)

And that's it, you don't need bad list anymore. Also don't forget that "prompt" function can return nil and this case should be handled in order to avoid errors.

Share this post


Link to post
Share on other sites

 There are three ways to solve.
First two required you to create a table. 

First method

local num = {
{value = 1, number = "10"},
{value = 2, number = "20"},
{value = 3, number = "30"},
{value = 4, number = "40"},
{value = 5, number = "50"}}

With this table, you can do checking and do number searching. 
 

for _, v in ipairs(num) do
    if v.value == r[1] then
		gg.searchNumber(r[1]..';100;'..v.number..';1000:', 4)
        
    end
end

 

Second method:

 

local num = {
[1] = "10",
[2] = "20",
[3] = "30",
[4] = "40",
[5] = "50"}

gg.searchNumber(r[1]..';100;'..num[r[1]]..';1000:', 4)

Third method : 

Since you have a sequence of x * 10. 
then simply do this.

gg.searchNumber(r[1]..';100;'..(r[1]*10)..';1000:', 4)

 

Edited by ItsSC
Accidentally pressed quote instead of edit.

Share this post


Link to post
Share on other sites
18 minutes ago, CmP said:

This approach is correct, but there is one detail that is not considered: string that represents a number and an actual number is not the same key in a table. For example, r[1] and r['1'] refer to two different values in the table.

So if you have string that represents a number, just convert it to an actual number using "tonumber" function (or any other way), then use that number to index the table with values for group search (table "p" in your case). Something like this: 


gg.searchNumber(r[1]..';100;'..p[tonumber(r[1])]..';1000:', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)

And that's it, you don't need bad list anymore. Also don't forget that "prompt" function can return nil and this case should be handled in order to avoid errors.

Thanks man..

This is exactly what i want to do but i don't know how to make it..

You gave me a simple and clear explaination..

And the example make it perfect..

Thanks alot..

Really appreciate..

[sorry have bad english]

Share this post


Link to post
Share on other sites
35 minutes ago, ItsSC said:

 There are three ways to solve.
First two required you to create a table. 

First method


local num = {
{value = 1, number = "10"},
{value = 2, number = "20"},
{value = 3, number = "30"},
{value = 4, number = "40"},
{value = 5, number = "50"}}

With this table, you can do checking and do number searching. 
 


for _, v in ipairs(num) do
    if v.value == r[1] then
		gg.searchNumber(r[1]..';100;'..v.number..';1000:', 4)
        
    end
end

 

Second method:

 


local num = {
[1] = "10",
[2] = "20",
[3] = "30",
[4] = "40",
[5] = "50"}

gg.searchNumber(r[1]..';100;'..num[r[1]]..';1000:', 4)

Third method : 

Since you have a sequence of x * 10. 
then simply do this.


gg.searchNumber(r[1]..';100;'..(r[1]*10)..';1000:', 4)

 

I can't use third methode.. Because the real table i have they not contain the squennced numbers like 10,20,30

Anyway..

Thanks for show me some defferent methode..

Its usefull to improve my kowledge and my skill..

Thanks bro.. Appreciate this..

 

Share this post


Link to post
Share on other sites
On 12/5/2019 at 3:47 PM, Kimiice7 said:

Please help me how to make group search like this

r = gg.prompt({'LEVEL [1;5]'},{1},{'number'})
p = {'10','20','30','40','50'}


--bad list--
if r[1] == '1' then rp = p[1] end
if r[1] == '2' then rp = p[2] end
if r[1] == '3' then rp = p[3] end
if r[1] == '4' then rp = p[4] end
if r[1] == '5' then rp = p[5] end

gg.searchNumber(r[1]..';100;'..rp..';1000:', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)

--How to call rp in group search without making bad list..??--
--Because i have 100 items in table p{} --
-- for p[x] , how to set x= r[1] ?? --
-- i tried this --
--gg.searchNumber(r[1]..';100;'..p[r[1]]..';1000:', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)--
--also tried x = r[1] then call p[x] but didn't work--

--Thanks for your help guys--

help variable gg.prompt.lua 720 B · 3 downloads

well , if you need to do this om exactly this numbers then use it : ) :

local r = gg.prompt({'LEVEL [1;5]'},{1},{'number'})

local rp = r[1]*10

gg.searchNumber(r[1]..';100;'..rp..';1000:', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)

Edited by TopGEOYT

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  

  • Similar Content

    • By Fallen_Stress
      Hi plz I am trying to make an script with sickbarr but I want my gg search value and addListItem and after just getListItem if I am using seekba gg search well and addListItem but getListItem dont work 
       
       
       
      ------------------------------------------
      -----------Search And Save Value------------
      -- Search Speed Hack Value
      gg.setRanges(gg.REGION_ANONYMOUS)
      a = gg.searchNumber("2.98271989822;4.45916652679;1.04395198822:9", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1)
      a = gg.refineNumber('4.45916652679', gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1)
      a = gg.getResults(1)
      local r = gg.addListItems(a)

      if gg.isVisible(true) 
      then gg.setVisible(false)
      end
      gg.clearResults()
      Random=1
      function SM()
      n = gg.prompt({'Player Speed Hack:[5; 20]','exit'}, {5, false}, {'number','checkbox'})
      if n == nil then gg.sleep(1)
      else
      if n[1] then spd() end
      if n[2] then exit() end

      end
      Random=-1
      end

      function spd()
      local r = gg.getListItems(a)
      gg.editAll(n[1], gg.TYPE_FLOAT)
      end

      function exit()
      print('script by i-do-trolling')
      gg.toast('script exit')
      os.exit()
      end
      while(true)
      do
        if gg.isVisible(true) then
          Random=1
          gg.setVisible(false) 
        end 
        gg.clearResults()
        if Random==1 then   SM() end
      end
       
       
    • By loversSlayer
      Want to use group search with variable.
      Its easy to search with one var like (var, gg.TYPE_), but i want to know is there way that i could put var in group search like (1;1~100;var;98::16, gg TYPE_)
      For me its only way to search for value in script cause its always so different.
    • By loversSlayer
      basically I just tried to use my old script. As far as I know it works perfectly on 87.5, but I updated my GG like 5-minutes ago and that's what happened (screenshot)
      the part of code:
      fly_save = 9.11F
      I tried just to hide it with -- and it stop crashing so there is something in syntax, but I don't have any idea what's happened cause it works correctly on GG 87.5 <.
      Maybe there is something changed in new versions but I didn't found anything in changelogs.

    • By Kimiice7
      help gg.prompt.lua
      Qjctx = 1
      if gg.isVisible(true) then
        gg.setVisible(false)
      end
      function main()
      n = gg.prompt({M='value1',N='value2'},nil,{'number','number'})
       if n == nil then os.exit() end
      if n.M and n.N then A()
      end
      end
      function A()
      gg.clearResults()
      gg.searchNumber(n.M..';'..n.N, gg.TYPE_DWORD)
      gg.clearResults()
      gg.alert(n.M.. '+'..n.N..'='..(n.M+n.M))
      end
      main()
      while true do
          if gg.isVisible(true) then
              gg.setVisible(false)
              Qjctx = 1
          end
          gg.sleep(100)
          if Qjctx == 1 then
              main()
          end
      end
       
      Please help me fix this
      For example i do search value1 = 4 and value2 = 4
      First search work fine..
      But when i try to do second search i got this error..
      After restarting script its work again.. And always second action got error..
       
      Thanks for your help.. 

       

×
×
  • Create New...