FangYX Posted October 13, 2020 Posted October 13, 2020 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
CmP Posted October 13, 2020 Posted October 13, 2020 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
FangYX Posted October 13, 2020 Author Posted October 13, 2020 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?
Lover1500 Posted October 13, 2020 Posted October 13, 2020 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)
FangYX Posted October 13, 2020 Author Posted October 13, 2020 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
Lover1500 Posted October 13, 2020 Posted October 13, 2020 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)
CmP Posted October 13, 2020 Posted October 13, 2020 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.
Lover1500 Posted October 13, 2020 Posted October 13, 2020 8 minutes ago, CmP said: local var if N[1] == "1" then var = "100" end if N[1] == "2" then var = "150" end -- other remaining code Thanks, i did miss again.
Question
FangYX
7 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.