Advertisement
antonsavov

Untitled

Jan 24th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. -- clones a vocab by number (row and column) to the position of a provided player name
  2. --
  3. --
  4.  
  5.  
  6. --the position of a fictional player onto the activation stone of where the newly placed vocab needs to be cloned
  7. POSITION = {
  8. x = 18,
  9. y = 57,
  10. z = -30
  11. }
  12. ROW = 1 --the number of the row for the wanted vocab. First is 1, not 0
  13. COL = 7 --the number of the column for the wanted vocab. First is 1, not 0
  14.  
  15. VOCAB_WIDTH = 27 -- in blocks
  16. VOCAB_HEIGHT = 19 -- in blocks
  17. NUMBER_OF_VOCAB = 10 -- the numebr of vocab columns, each column has 4 items, so number of rows is 4
  18.  
  19. --this is the block at ~-4 ~ ~-4 from the corner of the shape zone
  20. --i.e., (the one with the grammar shape in it) of the vocab that is closest to zero
  21. FIRSTVOCAB= {
  22. x=-60,
  23. y=57,
  24. z=-107
  25. }
  26.  
  27. --a multi builder which uses the vocab constructor to create sets of vocab
  28. function makeVocabZones(quant,w)
  29. local x,y,z = FIRSTVOCAB.x, FIRSTVOCAB.y, FIRSTVOCAB.z
  30. local result = {}
  31. local namecount = 1
  32. for i=0,quant-1 do
  33. for k=0,3 do
  34. local zpos = i
  35. local ypos = k
  36. if i == -1 then
  37. print("vocab at X")
  38. print(x)
  39. print("and Z")
  40. print(z)
  41. end
  42. local nextVocab = newVocabZone(x,y+(ypos*(VOCAB_HEIGHT+3)),z+((w+1)*zpos),w )
  43. table.insert(result,nextVocab)
  44. namecount = namecount +1
  45. end
  46. end
  47. return result
  48. end
  49.  
  50. --vocab constructor. Enforces some data structure
  51. function newVocabZone(x,y,z,w )
  52. local nvz = {}
  53. nvz.x ,nvz.y ,nvz.z ,nvz.w = x,y,z,w
  54.  
  55. nvz.cx = nvz.x - nvz.w - 2
  56. nvz.cy = nvz.y
  57. nvz.cz = nvz.z
  58.  
  59. return nvz
  60.  
  61. end
  62.  
  63.  
  64. --vocabzone creation
  65. vocabSet = makeVocabZones(NUMBER_OF_VOCAB,VOCAB_WIDTH)
  66.  
  67. -- this function does the cloning to a position
  68. function cloneVocab(position,row,col)
  69. local index = (col-1)*4 + row
  70. local vocab = vocabSet[index]
  71. if vocab then
  72. commands.clone(vocab.cx,vocab.cy,vocab.cz,vocab.cx+vocab.w,vocab.cy+VOCAB_HEIGHT,vocab.cz+vocab.w,position.x-math.floor(vocab.w/2),position.y-1,position.z-math.floor(vocab.w/2),"masked")
  73. print("cloned vocab at col:"..col.." and row:"..row.." to x:"..position.x..", y:"..position.y..", z:"..position.z..". done!")
  74. print("the vocab master's origin is at x:"..vocab.cx..", y"..vocab.cy..", z:"..vocab.cz)
  75. else
  76. print("something wrong with vocab")
  77. end
  78.  
  79. end
  80.  
  81. function main()
  82. cloneVocab(POSITION,ROW,COL)
  83. end
  84.  
  85. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement