Circle / Wedge Query Function

zardOz2 - Custom level - from Windows
PlayEdit8 players liked this.Log in to like this level.

This function is designed to make the current square query box into a circle or wedge eminating from a central point...

HOW TO USE:
myvariable=arcquery(X-position, Y-position, radius, arcStart,arcSize, layer)

Will return a table of object ID#s of any object within the radius of a wedge eminating from the X/Y position. the arcStart and arcSize numbers are based on the 0.0-1.0 angle values, for a full circle use 0 and 1 for your arcStart and arcSize values.

If the layer argument is left blank it will default to layer 1.

Views: 666 Downloads: 210 Unique objects: 2 Total objects: 41

Discuss this level

Log in to comment on this level.
  • Killroy: @zardOz: Ya I understood what you meant. :)
  • zardOz2: Sorry I should say it is identical to the result of X in the second equation
  • zardOz2: @Killroy: Also note the method I used here that looks like this... A>B and X=C or X=D ... Is a special shortcut which is identical to ... if A>B then X=C else X=D end
  • zardOz2: NP @Killroy: I really need to fix the errors in my guide, the tables section does have some goofs in it
  • Killroy: @zardOz: Awesome. Thank you sir. That was very helpful. I've gone over your lua tutorial before but I just recently started learning how to script with lua.
  • zardOz2: @Killroy: sure, ill try... be sure to check out my wiki beginners guide, this stuff is covered in the tables section. This level has complex techniques and is not the best to learn from...
    the # sign is used to find the length of the table(number of entries) so if you have a table like... mytable={1,10,3,4,7} ... #mytable will be = to 5 since five entries are in the table.
    {} are used for making tables, most times you will need to initialize the table first like mytable={} before setting it's contents, or if you need to clear a table of its contents you will also need to do mytable={}
    the [] is used to retreive or set a specific entry in the table so mytable[1]=1 mytable[2]=10 ...mytable[5]=7
    now if you combine them you can really do a lot with table data, mytable[#mytable] is equal to the last value in the table regardless of length, if you wanted to set a 6th entry in the table you would do mytable[#mytable+1]=15, making the table now mytable={1,10,3,4,7.15}
  • Killroy: @zardOz: Hey bro. Can you explain to me what the purpose of these symbols are for. #, {} and (x[x]) in this one I'm asking about the [ ]. Why is it there and for what reason. If you could be as specific as possible. Thanks in advance bro.
  • zardOz2: @demon666:

LEVEL ID: 15637