è¾²æ¥ã¿ã¼ãã«ããã°ã©ãã³ã°ããã¥ã¼ããªã¢ã«ï¼ï¼ï¼
ãã¦ååã¯æ°ã«ãªãå¼ããããããã©
ããã°ã©ã ãåããã¦ã¿ãã¨ãããã«ããã°ã©ã ã®åé¡ç¹ã«æ°ã¥ãããï¼
å®æçã«åç©«ç©ãä¸ã®ãã§ã¹ãã«ããããããã®ã ãã©ã
ãã®ã¨ãã«å°éã®éª¨ç²ããããããã¦ãã¾ããã ã
- åç©«ç©ç¨ãã§ã¹ãã«éª¨ç²ãæ··ããã®ãæ°æã¡æªã
- è²´éãªéª¨ç²ãç¡é§ã«ããããªãã使ãåããã
ã¨ããæå³ã§ãä»åã¯ãããä¿®æ£ãããã¨æãã
åå ã¨å¯¾ç
ãã®åå ã¯ãææã¡ã®éª¨ç²ã2ï½3åæ®ã£ã¦ããç¶æ
ã§
çä¸ã®ãã§ã¹ããã1ã¹ã¿ãã¯åã£ã¦ãã¦ãã¾ããã¨ã ããã
64åãè¶
ãã¦ãã¾ã£ã¦ãå¾ã®ã»ãã®ã¹ãããã«éª¨ç²ãã¯ã¿åºãã¦ãã¾ãã
ã§ã¯ã©ãããã°ããã®ãã
ä¸çªã®æ£æ»æ³ã¯ã骨ç²ã0åã«ãªã£ãã®ã確èªãã¦ãã骨ç²ãåã£ã¦ããã°ããããã
ããã¾ã§ã¯ã骨ç²ãæ¯ãæããã¨ãã«ãturtle.place()ãé£ç¶3åã¾ã¨ãã¦ãã£ã¦ããããã©ã
æ¯åæ¯ãæããåã«èªåã®éª¨ç²ã®åæ°ã確èªããã°ããã
0ãªã骨ç²ãåãã«ããããã
ããã¦å®è£
ããã®ã以ä¸ã®ããã°ã©ã
ä¿ææ ½å¹ããã°ã©ã ã¯ããã§ä¸å¿å®æã®ã¤ããã ãã
ããã°ã©ã
- ã³ããç¨ãhttp://pastebin.com/MTxUiV2f
-- ######################## -- cultivate <n> -- version 0.4 -- http://hevohevo.hatenablog.com/ -- ######################## -- ############# -- config ARGS = {...} MAX = ARGS[1] SEED_SLOT = 1 MEAL_SLOT = 2 -- ################## -- define functions function plantSeed() turtle.select(SEED_SLOT) if turtle.place() then return true else print('failed: plantSeed') return false end end function dropItems(begin_slot, end_slot) print('drop items: slots ',begin_slot,'-',end_slot) for i=begin_slot, end_slot do turtle.select(i) turtle.dropDown() end turtle.select(1) end function useOneMeal() if (turtle.getItemCount(MEAL_SLOT) ==0) and (turtle.suckUp()==false) then print('failed: suckUp, and meal = 0') return false else turtle.select(MEAL_SLOT) turtle.place() return true end end function useMeals() local flag = true for i=1,3 do if useOneMeal() == false then flag = false break end end return flag end function harvest() turtle.select(SEED_SLOT) turtle.dig() end -- ################## -- Main turtle.dig() for i=1,MAX do print(i,'/',MAX) if plantSeed() == false then break end if useMeals() == false then break end harvest() if i%50==0 then dropItems(3,16) end end dropItems(3,16)
ããã°ã©ã ã®è§£èª¬
- 以åãã£ãã getMeals()é¢æ°ã¯å ¨åé¤ã ãã代ããã« useOneMeal()é¢æ°ãæ°ããä½ã£ã¦ããã®ä¸ã§éª¨ç²è£çµ¦ãããªãã¦ããã
- useOneMeal()ã¯ãå®è¡åã«éª¨ç²ã®åæ°ã調ã¹ã0ãªãè£çµ¦ãããã¨è©¦ã¿ãããè£çµ¦ã«å¤±æãããã¨ã©ã¼ãè¿ããã ã
- ããã«ä¼´ããuseMeals()é¢æ°ãå ¨é¢çã«æ¸ãæãã¦ããããuseOneMeal()ã3åé£ç¶æåï¼trueãè¿ãï¼ãªããã®ã¾ã¾åç©«ä½æ¥ãç¶ããéä¸1åã§ãè£çµ¦ã«å¤±æãï¼falseãè¿ãï¼ããããã«ã«ã¼ããæãã¦ãçµäºãããã ã
ã¾ã¨ã
ååãããããã°ã©ã ã®æéã¯æ¸ã£ã¦ããããï¼
3åæ¯ãããã¨ãã大éæãªä½æ¥åä½ãããã1åæ¯ãããã¨ããããã«ç´°ããä½æ¥åä½ã«ã¢ã¸ã¥ã¼ã«åããã»ãããããã°ã©ã å
¨ä½ã§ãããããããªã£ã¦ããã
ã¨ããããåãããã°ã©ã ãä½ã£ã¦åããã¦ãã¿ã¼ãã«ããã£ãã観å¯ãããåé¡ãçºè¦ããããããããä½æ¥ãã©ãã©ãç´°ããåãã¦ã¢ã¸ã¥ã¼ã«åãããã¨ã§æ©è½ãä¿®æ£ã»è¿½å ãã¦ããã
ãã®ãããªè¡ãå½ããã°ã£ããã®ããã°ã©ãã³ã°æ¹æ³ã¯ãåããããã«è¦ãã¦åé¡ç¹ãç®ã«è¦ãã¦ãããã¨ããã¿ã¼ãã«ãªãã§ã¯ã ããã
ãã®ãããªãã®ãã®ããã°ã©ãã³ã°ã«ãã試è¡é¯èª¤ã¨ãæçµçã«æã£ãã¨ããã«åãã¿ã¼ãã«ã®ãããããããããåãComputerCraftã«æããé
åãªãã ã
ããããããããªæãã§è¡ãå½ããã°ã£ããã§Blogãç¶ãã¦ããã¤ããã ãã