Jump to content
  • 0

How to write it right?


FangYX

Question

N = gg.prompt({"Test :[1;5]"},{},{"number"})
if N == nil then os.exit() else
if N[1] == true then
gg.searchNumber("1.0;1.0;1.5::9", gg.TYPE_FLOAT)
gg.getResults(100)
if N[1] == 1 then gg.editAll("1") end
if N[1] == 2 then gg.editAll("2") end
if N[1] == 3 then gg.editAll("3") end
if N[1] == 4 then gg.editAll("4") end
if N[1] == 5 then gg.editAll("5") end
end end

 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

1 hour ago, CmP said:

N = gg.prompt({"Test :[1;5]"}, {}, {"number"})
if N == nil then
  os.exit()
else
  gg.searchNumber("1.0;1.0;1.5::9", gg.TYPE_FLOAT)
  gg.getResults(100)
  gg.editAll(N[1])
end

 

but how to write it if i want to change the value with 100, 150 or something?

Link to comment
Share on other sites

3 hours ago, Fathoni267 said:

but how to write it if i want to change the value with 100, 150 or something?

--Here you should use set memory region

N = gg.prompt({"Test :[1;5]"}, {"1"}, {"number"}) -- pre-put value in prompt for better
if N == nil then os.exit()
  elseif N[1]=="" then os.exit() end

gg.searchNumber("1.0;1.0;1.5::9", 16) -- 16 is gg.TYPE_FLOAT
  gg.getResults(100)
  gg.editAll("100",16) -- if want 100 (float type)

 

Link to comment
Share on other sites

45 minutes ago, Lover1500 said:

--Here you should use set memory region

N = gg.prompt({"Test :[1;5]"}, {"1"}, {"number"}) -- pre-put value in prompt for better
if N == nil then os.exit()
  elseif N[1]=="" then os.exit() end

gg.searchNumber("1.0;1.0;1.5::9", 16) -- 16 is gg.TYPE_FLOAT
  gg.getResults(100)
  gg.editAll("100",16) -- if want 100 (float type)

 

no, i mean the 1 is 100, 2 is 150, 3 is 180 like that

Link to comment
Share on other sites

10 hours ago, Lover1500 said:

 


if N[1]=="1" then local var = "100" end
if N[1]=="2" then local var = "150" end
-- etc

gg.searchNumber("1.0;1.0;1.5::9", 16)
gg.getResults(1000)
gg.editAll(var, 16)

 

Local variable has to be declared outside of the if-blocks for it to be visible at the last line. Like this: 

local var
if N[1] == "1" then var = "100" end
if N[1] == "2" then var = "150" end
-- other remaining code

Alternatively, global variable can be used, in which case no declaration is needed.

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.