Jump to content
  • 0

How to make group searches with variables?


Estrelad

Question

This is my script, but isn't working...

::start:: 

a=gg.prompt({"hp",[1]="150"}) 

b=gg.prompt({"hp max",[1]="200"} 

gg.searchNumber(a;b::5) 

gg.editall(999) 

What I did wrong? Why I can't use letters as variables? And, how can I fix it to work?

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

1 hour ago, Estrelad said:

This is my script, but isn't working...

::start:: 

a=gg.prompt({"hp",[1]="150"}) 

b=gg.prompt({"hp max",[1]="200"} 

gg.searchNumber(a;b::5) 

gg.editall(999) 

What I did wrong? Why I can't use letters as variables? And, how can I fix it to work?

 

i dont think thats possible the only group search that is valid is

gg.searchNumber("30D;50D;0.2F;", gg.TYPE_DWORD)

hmmm i dont get what ur trying to pull here.

Link to comment
Share on other sites

6 hours ago, Estrelad said:

 

Hello. 

 

local a = gg.prompt({"hp"},{0})

local b = gg.prompt({"max hp"},{0})

gg.searchNumber(a;b::5) 

gg.editall(999) 

 

Something like that I've used before 

 

Maybe that will help. 

Good luck @Estrelad

Link to comment
Share on other sites

Index them as a variable in the prompt and then concatenate the index's as a variable here I did them as val and then just search val

local A = gg.prompt({

'How many coins do you have?',

'How much stone do you have?',

'How many gems do you have?'},

nil ,{[1] = 'number', [2] = 'number', [3] = 'number'})
val = A[1]..";"..A[2]..";"..A[3]

if A == nil then 

gg.alert('Script Minimized')
gg.setVisible(false)
else

Then whatever you'd want to happen after they input valid numbers would go after else

..";".. is a concatenation that in this casd connects to variables while inserting ; to separate

 

Link to comment
Share on other sites

10 hours ago, Estrelad said:

This is my script, but isn't working...

::start:: 

a=gg.prompt({"hp",[1]="150"}) 

b=gg.prompt({"hp max",[1]="200"} 

gg.searchNumber(a;b::5) 

gg.editall(999) 

What I did wrong? Why I can't use letters as variables? And, how can I fix it to work?

 

I'd recommend just prompting for both values with a so for you it would be like

local a = gg.prompt({

'Current Hp?',

'Max Hp?'},

nil,{ [1] = 'number', [2] = 'number'})

They shouldn't have a problem being indexed as 1 and 2 as long as they are indented but they can now be called individually like a[1] or a[2] or you can concatenate them and call them both at once by storing that concatenation in a local variable 

 

Link to comment
Share on other sites

a=gg.prompt({"hp", "hp max"},{"150", "200"}, {"number", "number"}) --Combine both prompt in one
gg.searchNumber(a[1]..";"..a[2].."::5") -- Using concatenation

local RANGE = 5
gg.searchNumber(string.format("%d:%d::%d", a[1], a[2], RANGE) -- Using string formatting
gg.editall(999) 

 

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.