Jump to content
  • 0

Error in object finder script


DimoNULL
 Share

Question

If script started i getting error`local pos1 = gg.prompt("Enter XYZ", "", gg.TYPE_FLOAT)`

bad argument #1 to 'gg.prompt' (string: table expected, got string) (field 'prompt')

 

Script:

 

gg.toast("Enter XYZ:")

local pos1 = gg.prompt("X:", nil, gg.TYPE_FLOAT)

local pos2 = gg.prompt("Y:", nil, gg.TYPE_FLOAT)

local pos3 = gg.prompt("Z:", nil, gg.TYPE_FLOAT)

 

local search_string = string.format("%.2f~%.2f;%.2f~%.2f;%.2f~%.2f:9", pos1-0.02, pos1+0.02, pos2-0.02, pos2+0.02, pos3-0.02, pos3+0.02)

gg.setRanges(gg.REGION_ANONYMOUS)

gg.searchNumber(search_string, gg.TYPE_FLOAT)

 

gg.toast("Finished")

 

Where the error?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
gg.setRanges(gg.REGION_ANONYMOUS)
gg.toast("Enter XYZ:")

local pos = gg.prompt({"X:","Y:","Z:"},{0,0,0})

local searchString = string.format("%.2f~%.2f;%.2f~%.2f;%.2f~%.2f:9", pos[1] - 0.02, pos[1] + 0.02, pos[2] - 0.02, pos[2] + 0.02, pos[3] - 0.02, pos[3] + 0.02)

gg.alert("Search = "..searchString)

gg.searchNumber(searchString, gg.TYPE_FLOAT)

gg.toast("Finished")

 

Link to comment
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
 Share

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