Redstone APIã使ã£ã¦ã¬ããã¹ãã¼ã³ä¿¡å·ãåºãã
ä»åã®å 容
redstone API説æãã¦ã¯ã©ããã£ã¿ã¼ãã«ããã°ã©ã ã®å®æçãåºããã¨æã£ããã
å
容ãå¤ããã¦ããã¾ã§ãããªãã£ãã»ã»ã»ãããã°ã©ã ã¯æ¬¡åããªã
ä»åã¯ã以ä¸ã®å 容ã§ãã¥ã¼ããªã¢ã«ãé²ãã¾ãããã
- CCã®Luaã¤ã³ã¿ããªã³ã¿ã®èª¬æ
- CCã§ã¯ã¬ããã¹ãã¼ã³ä¿¡å·ãã©ããã£ã¦æ±ãã®ã
- MFR2ã®Rednet Cable便å©ãããã®ã§ãã®åãæ±ã説æ
- CCã¨Rednet Cableã®é£æº
Luaã¤ã³ã¿ããªã³ã¿
ãä»ããã¬ããã¹ãã¼ã³ä¿¡å·ONã«ãããããããã¦ããã«ä¿¡å·OFFã«ãããããã¡ãã£ã¨ã¿ã¼ãã«ã®åããå¤ãããããçä¸ã«1ãããã¯åã ã移åããããããªã©ãªã©ã
ããããå®ç¾ããããã«ã¯ãã¯ãããããç¨æãããAPIã使ããªãã¦ã¯ãªãã¾ããã
ããããå°ãã ãAPI使ãããã ããªã®ã«ãããã°ã©ã æ¸ãã¦ããã¡ã¤ã«ãä¿åãã¦ãå®è¡ãã¦ã¨æ¯åç¹°ãè¿ãã®ã¯é¢åã§ããããããã®ã§ãã
ãã®ãããªã¨ãã«ã¯ããLuaã¤ã³ã¿ããªã³ã¿ããå©ç¨ãã¦ã¿ã¾ãããã
Luaã¤ã³ã¿ããªã³ã¿ãèµ·åãã¦ããLuaã¤ã³ã¿ã©ã¯ãã£ãã¢ã¼ããã«ãããã¨ã§ããå°ãã ãAPIã使ãããã¨ãæ軽ã«ã§ãã¾ãã
Luaã¤ã³ã¿ã©ã¯ãã£ãã¢ã¼ã
- ã³ã³ãã¥ã¼ã¿ï¼ã¿ã¼ãã«ï¼ã®ç»é¢ã§ããluaãï¼ã¨ã«ã¦ã¼ã¨ã¼ï¼ã¨æã¡è¾¼ã¿ãLuaã¤ã³ã¿ããªã³ã¿ãèµ·åã
- Luaã¤ã³ã¿ã©ã¯ãã£ãã¢ã¼ãã«åãæ¿ãã£ããã1è¡ããã°ã©ã ãæ¸ãã¦ã¨ã³ã¿ã¼ãã¼ãæ¼ãããLuaã¤ã³ã¿ããªã³ã¿ããããé次å®è¡ãã¦ãããã
- ã¤ã¾ãããã¯ãã1è¡ã®Luaããã°ã©ã ãå ¥åâã³ã³ãã¥ã¼ã¿ããããå®è¡ãã¨ããã¤ã³ã¿ã©ã¯ãã£ããªLuaããã°ã©ã å®è¡ç°å¢ã
- ãã¨ãã°ããã§ããturtle.turnRight()ãã¨æã¡è¾¼ãã¨ãã¿ã¼ãã«ãå³ãåãã
- ãªããLuaã¤ã³ã¿ããªã³ã¿ãçµäºããã«ã¯ããexit()ãã¨æã¡è¾¼ãã°ããã
ããã§ã¯ãLuaã¤ã³ã¿ããªã³ã¿ã使ã£ã¦ãã¬ããã¹ãã¼ã³ä¿¡å·ãåºãã¦ã¿ã¾ãããã
ã¬ããã¹ãã¼ã³ä¿¡å·ãåºã
- å³ã®ããã«ãã¿ã¼ãã«ã®å·¦å´ã«ã¬ããã¹ãã¼ã³ãæ·ãã¦ããã
- ã¿ã¼ãã«ã®ç»é¢ã§ãLuaã¤ã³ã¿ããªã³ã¿èµ·åã以ä¸ãå ¥åããã¨ã¬ããã¹ãã¼ã³ä¿¡å·ãONã«ãªãã
> rs.setOutput("left", true)
- OFFã«ããã«ã¯ã以ä¸ãå ¥åã
> rs.setOutput("left", false)
ããã§ãä»»æã®ã¿ã¤ãã³ã°ã§ã¬ããã¹ãã¼ã³ä¿¡å·ãåºããã¨ãã§ãã¾ãã
ãã¨ãã°ãã¬ããã¹ãã¼ã³ã®å
ã«æãããã°ã好ããªã¿ã¤ãã³ã°ã§ééã§ããããã«ã
ãããããã§èãã¦ã¿ã¾ããããã¬ããã¹ãã¼ã³ã¯ãRSä¿¡å·ä¼éæ段ã¨ãã¦ã¯å¶éãå¤ããã使ãã«ãããªãã§ããï¼
ãããã¯ã®ä¸ã«ããè¨ç½®ã§ããªããé£ãåãã¨ç¹ãã£ã¦ãã¾ãããè¤æ°åæã§ä½¿ãåããã«ã¯ééã空ããããã¦å·¥å¤«ããªãã¦ã¯ãªããªããé«ä½å·®ãããå ´æãç¹ãã®ã«è¦å´ãããä¿¡å·ãæ¸è¡°ããã®ã§ãªãã¼ã¿ãå
¥ããªãã¦ã¯ãããªãããªã©ãªã©ã
次ã«ç´¹ä»ããMineFactoryReloaded2ï¼MFR2ï¼ã®RednetCableãã«ã¯ãã®ãããªå¶éãããã¾ããã
RednetCableã使ã
ç¹å¾´ã¨åºæ¬ç¥è
MFR2ã®RednetCableã¯ã以ä¸ã®ãããªç¹å¾´ãããã¾ãã
- ã¬ããã¹ãã¼ã³ã¨éããç«ä½çã«è¨ç½®ã§ãããé«ãã¨ããã«ä¼éããã®ãã¨ã¦ã楽ã«ï¼
- ã±ã¼ãã«ã16è²ã«è²åãã§ããåè²ãã¨ã«ä¿¡å·ãå ¥åºåã§ããã
- ä¿¡å·ãæ¸è¡°ããªãã
ç¾èã¯ä¸è¦ã«ããããã¾ãã¯åç´ã«é ç·ãã¦ã¿ã¾ãããã
ãStandard Connection Modeã
- ã¿ã¼ãã«ã®å·¦å´ã«RednetCableã3æ¬å¼ããã¨ã§ãã¿ã¼ãã«ã¨ã¬ããã¹ãã¼ã³ã©ã³ããç¹ãã
- 赤丸ã«æ³¨ç®ããã®ç¶æ ã¯ãStandard Connection Modeãã¨å¼ã°ãããã¿ã¼ãã«âã©ã³ããã¨ããä¸æ¹éè¡ã®ä¿¡å·ä¼éã«ãªãã
ãã¦æ¬¡ã«ãRednetCableã®ä¸å¤®ã«ãã赤ãé¨åããMFR2ã®Precision-Sledge-Hammerãªã©ã§å³ã¯ãªãã¯ãã¾ãããã次ã®ãããªå½¢ç¶ã«å¤ãããã¢ã¼ããåãæ¿ããã¾ãã
ãForced connection modeã
- ãã®ã¢ã¼ãã¯ãã¿ã¼ãã«âã©ã³ãã ãã§ã¯ãªããã©ã³ãâã¿ã¼ãã«ã¨ããåæ¹åã®ä¿¡å·ãä¼ãããã¨ãã§ããã
- ãã¨ãã°ã©ã³ãã«ç´æ¥ã¬ãã¼ãè²¼ãä»ãã¦ONã«ããã¨ãã¿ã¼ãã«å´ã«ãONä¿¡å·ãä¼ããã
- ã¾ãããã¯ç½ã±ã¼ãã«ãªã®ã§ãä»ã®ç½ã±ã¼ãã«ã«ãä¿¡å·ãä¼éã§ããï¼ã±ã¼ãã«ã®è²ã«ã¤ãã¦ã¯å¾è¿°ï¼ã
ããã¦ãããã«RednetCableãå³ã¯ãªãã¯ããã¨ã以ä¸ã®ã¢ã¼ãã«åãæ¿ããã¾ãã
ãcable-only connection modeã
- ã±ã¼ãã«ã¨ããç¹ãã£ã¦ããããé£æ¥ãããããã¯ã«ã¯ä¿¡å·ãä¼ããªãã
è²åããã¤ã¤é ç·ããã
ä¸å³ãè¦ã¦ãã ããã注ç®ãã¦ã»ããã®ã¯èµ¤ä¸¸é¨åã§ããå·¦ããé ã«é»è²ã»éã»ç½ã¨ãªã£ã¦ãã¾ãã
è²ã®ã¤ããé¨åãå³ã¯ãªãã¯ãããã¨ã§è¨16è²ã次ã
ã¨å¤æ´ã§ãã¾ãã
ããã§ã¯ãéè²ã±ã¼ãã«ã«ã ãã¬ããã¹ãã¼ã³ä¿¡å·ãåºãã¾ããã
ä¾ã«ãã£ã¦ãã¿ã¼ãã«ã§Luaã¤ã³ã¿ããªã³ã¿ãèµ·åãã¦ã次ã®ãããªããã°ã©ã ãæã¡è¾¼ãã¨ãä¸å³ã®ããã«éã±ã¼ãã«ã®å
ã«ããã©ã³ããç¹ç¯ãã¾ãã
> rs.setBundledOutput("left", colors.blue)
ããã§æ³¨æç¹ã
RednetCableã¯ãåè¿°ã®rs.setOutputç³»ã®é¢æ°ã使ãã¾ããã
ãã©ã®è²ã®ã±ã¼ãã«ã«åºåããããã¨ããé¨åãéè¦ã«ãªãã®ã§ãRedstone APIã®ä¸ã§ããBundledãç³»ã®é¢æ°ããå©ç¨ã§ãã¾ããã
ã¾ãrs.setBundledOutputã¯ãä½ããã®è²ãæå®ããããã®ä»ã®è²ã¯OFFã¨ãªãã¾ãã
ããã¦å
¨è²OFFã«ããããã«ã¯ãè²ãæå®ããç®æã«ã0ãï¼ã¼ãï¼ãå
¥ãã¾ãã
ãã®è²åãã®ãããã§ã次ã®ãããªé¢ç½ããã¨ãã§ãã¾ãã
ä¸åº¦ã«è¤æ°ã®è²ã±ã¼ãã«ãæå®ããæ¹æ³
ï¼2014.1.14追è¨ï¼
colors.whiteã¯å®æ°ã§ããã®å®æ
ã¯æ°å¤ã§ãã
> print(colors.white) 1
ããã¦è¤æ°ã®è²ãæå®ãããã¨ãã«ã¯ãããæ°å¤ã®å*1ãæå®ãããã¨ã«ãªã£ã¦ãã¾ãã
ã¤ã¾ããç½ï¼1ï¼ã¨ãªã¬ã³ã¸ï¼2ï¼ã®2è²ãåæã«æå®ããããªãã°ãåã§ããã3ããæå®ãã¾ãã
ããã¯æ¬¡ã®ããã«è¨è¿°ã§ãã¾ãã
-- ç½ã¨ãªã¬ã³ã¸ã±ã¼ãã«ã«RSä¿¡å·ãéãï¼éæ¨å¥¨ï¼ > rs.setBundledOutput("left", colors.white + colors.orange)
ãã ããã®ãããªåç´ã«åï¼+ï¼ãåãæ¹æ³ã ã¨ã次ã®ãããªã¨ãã«åé¡ãåºã¾ãã
-- ç½(1)ã¨ç½(1)ã足ãã¦ã»ã»ã»ã»ã»ãªã¬ã³ã¸(2)ï¼ããï¼ï½ > rs.setBundledOutput("left", colors.white + colors.white)
ãã®ãããªãã©ãã«ãé¿ããããã«ãColors APIã«å°ç¨ã®é¢æ°ãcolors.combine()ããããã®ã§ããã¡ããç©æ¥µçã«ä½¿ãã¾ãããã
-- ç½ã¨ãªã¬ã³ã¸ã±ã¼ãã«ã«RSä¿¡å·ãéãï¼ãã¡ããæ¨å¥¨ï¼ > color_set = colors.combine(colors.white, colors.orange) > rs.setBundledOutput("left", color_set)
-- åç´ãªåï¼+ï¼ã§ã¯ãªãå é¨ã§ãããè«çåï¼borï¼ãè¡ããã¨ã§ãã¾ãã§éåæ¼ç®ã®ããã«æ¯ãèãã -- ãã®ããã次ã®ãããªãããããªè¨è¿°ã«ãæ£å¸¸å¯¾å¿å¯ > color_set = colors.combine(colors.white, colors.white) > print(color_set) 1 -- ã¤ã¾ãcolors.white
(åèè³æ)
http://computercraft.info/wiki/Colors_(API)
http://www50.atwiki.jp/mccc/pages/16.html#id_81ad7043
ï¼è¿½è¨ããã¾ã§ï¼
ã¾ã¨ã
ä»åã¯ãMFR2ã®RednetCableã®ä¾¿å©ãã¢ãã¼ã«ã¨ãCCã¨ã®é£æºã«ã¤ãã¦è§£èª¬ãã¦ã¿ã¾ããã
次åããã¯ã¯ã©ããã£ããã°ã©ã ãã¾ã¨ãããã¨æãã¾ãã
以ä¸ã«ãéå
¬å¼CC Wikiã®APIãã¼ã¸ã¸ã®ãªã³ã¯ãã¾ã¨ãã¦ããã®ã§ã
çèªãã¦ãRedstone APIããã¹ã¿ã¼ãã¦ãã ããã
*1:æ£ç¢ºã«ã¯æ°å¤ã2é²æ°è¡¨ç¾ããã¨ãã®ãããæ¼ç®è«çå(bor)ããããæ¼ç®ãªãã¦ããããªããï¼ã¨ããåå¿è ã®æ¹ã®ããã«Colors APIã«å°ç¨ã®é¢æ°ãç¨æããã¦ããã®ã§å¤§ä¸å¤«ã