Jump to content
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

  • Similar Content

    • 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.. 

       

    • By g1doz
      Q1: How use fast freeze options in script
      Q2: if i want use gg.required but i want this to check latest version automatically, Not to write him the current version number, is this possible?
      Q3: I'm read about function make Request in gameguardian.net/help but  there is something I did not understand is how do I exchange data between script and Server For example I asked a user to enter a user name and password and this data I want to send to server and he compares them with the Database And tell him if they are true or wrong, how it is done on This function.
      Q4: For example, I want to create a script that changes the name of the player, I'm going to use the search in gg option "Text UTF-8" and after search they show me the results of the type Byte, Then I change it normally, For example, I want to show a pop-up message telling him to enter your name in the first cell and your new name in the second cell, How do I do this on Script?.
      Thanks guys for help, i really love this forum.
    • By JintanOwO
      Hi!
      Name of Game: I Monster-pro Dark Dungeon Roguelike RPG(Dreamsky)
      Play Store Link: [Payment version] (costs less than 1 dollar) [Free version]
      Version: 1.1.12 (11018)
      What cheat?: Gold, Diamonds, Items, Life, More backpack and trunk space.
      Have you tried cheating this game? What happened?: 
      ENGLISH:
       
      ESPAÑOL:

×
×
  • Create New...