ã¯ããã«
ç§ã¯æè¿ãèè ãã²ãŒã World of Warcraftã®ãªãŒã¯ã·ã§ã³ã§ååŒãããããã«ã€ããŠèªã£ãæçš¿ãèªã¿ãŸããã 圌ã®ãã£ã©ã¯ã¿ãŒã¯çè·é¢ãåŸåŸ©ããå¶åŸ¡ããã°ã©ã ã§å³å¯ã«æå®ãããç¹å®ã®ã¢ã¯ã·ã§ã³ãå®è¡ããŸããã 圌ã®ã¢ã€ãã¢ã䜿çšããŠãç§ã¯ããå°ãå ã«é²ãããšã«ããŸããïŒãã£ã©ã¯ã¿ãŒãå°ãªããšã5åéç¶ãã«ãŒãã«æ²¿ã£ãŠèµ°ãããšãã§ããããã«ããŸãããå¶åŸ¡ããã°ã©ã èªäœãå€æŽããããšãªããã«ãŒããšå€éšããå®è¡ãããã¢ã¯ã·ã§ã³ãèšé²ã§ããããã«ããå¿ èŠããããŸãã ç§ã説æããã®ã¯ãå ã®æçš¿ã®éçºã§ããããã®èªæžãå¿ é ã§ã¯ãªãããšã確èªããããšããŸããã
æçš¿ã§èª¬æããŸã
- LuaèšèªWoWãŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹çšã®ç°¡åãªã¢ããªã³ãäœæããããã»ã¹
- ã·ã¹ãã ã®éšåéã§äŒéããããã®ããŒã¿ã®ã·ãªã¢ã«å
- ãã¯ã»ã«ã«ã©ãŒã¬ã³ããªã³ã°
- AutoItãã£ã©ã¯ã¿ãŒç®¡çããã»ã¹
- ã¢ã¯ã·ã§ã³ãèšé²ããããã®ããã°ã©ã
- ãã¬ã€ããããã°ã©ã
- 移åæ¹åã®ãããèšç®
- ããã»ã¹ã¡ã¢ãªã®èªã¿åã/æžã蟌ã¿ã«é Œãã¹ãã§ã¯ãªãçç±
- éããã°ã©ããŒãç解ã§ããã³ãã³ããåãã管çããã°ã©ã ïŒroïŒããã
èŠå
ãããã®äœ¿çšã¯ããªã¶ãŒãã©ã€ã»ã³ã¹å¥çŽã«ãã£ãŠçŠæ¢ãããŠããããšãç解ããŠããŸãã ããã«ãããã¢ã«ãŠã³ããæ°žä¹ ã«çŠæ¢ãããå¯èœæ§ããããŸãã ãã®æçš¿ã®çŽ æã䜿çšããŠã誰ããçŸéãç²åŸãå§ããã²ãŒã ã®çµæžãæªåãããä»ã®ãã¬ã€ã€ãŒã®äžæ¿èªãåŒãèµ·ãããããšãç¥ããç§ã¯æã£ãŠããŸãã§ãããã ãããŠãã¯ããç§ã¯èªåãããããšãäžæ£ã§ããããšãç解ããŠããŸãã
ãã®æçš¿ã®ç®çã¯ãç§ã®çµéšã«ã€ããŠè©±ããç§ãééããå°é£ã説æããããªãããäœãããè¯ãã§ããããç¥ãããšã§ãã
èæ¯
ã°ããº
ã²ãŒã æ¥çããé ãé¢ãã人ã ã¯ãå å ¥èŠ³ãªããã®ã»ã¯ã·ã§ã³ãã¹ãããã§ããŸãã ã²ãŒã WoWã«ã¯ããã®ãããªåŽé¢ããããŸã-åéã numismatics / philatelyã®ããã«ãäŸãã°ããŠã³ããããåç©ãå€ãã»ã©ãããªãã¯ããå¿«é©ã«ãªããŸãã ååŸããã»ã¹ãåæ§ã«éèŠã§ãã ããã€ãã®ãã©ãŽã³ã¯ããããæãéããããã«æ°åã®ã¿ã¹ã¯ïŒãææãïŒãå¿ èŠãšããããã€ãã¯ãã£ã©ã¯ã¿ãŒã³ã³ãããŒã«ã¹ãã«ïŒã¢ãªãŒãã§ã®æŠéïŒã§äžçã®ãã¬ã€ã€ãŒã®äžäœ2ïŒ ã«å ¥ãããã«ãã©ãã°ããŸãããã®åŸ-åºã§ã®æ¬åœã®ãéã®ããã«ã 詳现ã¯å¥ã®ãœãŒã¹ã§èªãããšãã§ããŸãããããã¯ããã«ã€ããŠã§ã¯ãããŸããã ãã®ãããåéå¯èœãªã¢ã€ãã ã®äžéšã¯ãçŽ0.5ïŒ ã®ç¢ºçã§ãã³ãžã§ã³ã«èœã¡ãŸãã ãã¬ãŒã€ãŒã«è»¢åã®å¯èœæ§ã1æ¥1åïŒå Žåã«ãã£ãŠã¯1é±éïŒããäžããããªãå Žåãã¬ãŒã¹ã®å¹Žã«å¹æµããæéãå¿ èŠã«ãªããŸãã ãããŠã倧åãªèŠãã¿ãåãããªããžã§ã¯ããåãåããã®ç¬éã®ããã«ãã¹ãŠã ã¢ã€ãã ã®ã èŸ²æ¥ ãã«è²»ãããæéãšåŽåãå€ããªãã°ãªãã»ã©ãæçµçã«ã¯ããå¿«é©ã«ãªããŸãã ç§ã®çµéšã§ã¯ãåã³ã¯ãšãŠãã€ãã®éã§ãã
è©Šè¡åæ°ã«äŸåããå¯èœæ§ã®äŸåæ§
å°ããªäœè«ã ã6ãã6ã€ã®ãµã€ã³ãã§èœãšããã確çã¯ã©ã®ãããã§ããïŒ æããã«ã ã ã€ãŸãããã®ã€ãã³ãã¯ã6åãã¹ãŠã®è©Šè¡ã§ã6ãã倱æããããšã®å察ã®ã€ãã³ãã§ãã
2çªç®ã®æ³šç®ãã¹ãå¶éã䜿çšãããšã ã
ãããŠã100åã®è©Šè¡ã§1ïŒ ã®ãããããã£ã³ã¹ãæã€éŠ¬ãåŸããã確çã¯çŽ63ïŒ ã§ãã
300åã®è©Šè¡ãè¡ã£ãäžéšã®ãã¬ãŒã€ãŒã¯ã圌ãã幞éã«ãªãããšããŠãããšä¿¡ããŠããŸã-ãã®ãããªå€æ°ã®è©Šè¡ã«å¯ŸããäŸµå ¥ã®å¯èœæ§ã¯å°ããããã§ãã 圌ãã¯å€±æããã ããããªããªãã次ã®100幎ã§åã³å¹žéã«ãªãã®ã¯ããã63ïŒ ã ããã ã ãããŠãå€ãäœåã¯äœãäžããŸããã
ææŠãã
ãã³ãžã§ã³ããããŸãã ããã«æ²¿ã£ãŠé çªã«å®è¡ããéäžã§ããã€ãã®ç°¡åãªã¿ã¹ã¯ãå®è¡ããå¿ èŠããããŸãã æçµãã¹ãåããæŠå©åã調éããŸãã åŸæ©ã§åºå£ãŸã§èµ°ããªãããã«ãæå¯ãã®æã«ãã¬ããŒãããå ¥å£ãŸã§é£ãã§ãã ããã 5åç¹°ãè¿ããŸãã
ãã³ãžã§ã³ã®å°å³ãšã«ãŒãïŒ
ææŠã¯æ倧ã§ãã æã¡äžãããã30åæŸçœ®ãããŸããã ãã®ããã»ã¹ã¯å®å šã«èªååãããŠããŸãã
æå°ã¿ã¹ã¯ã ã©ã³ãã³ã°ããŠã®ã¿ãŒã®é£ã«åº§ã£ãŠãã®ã¿ãŒãèªãã ããæŒå¥ããããã¢ãã¿ãŒãèŠãªããã å¿ èŠã«å¿ããŠããã£ã©ã¯ã¿ãŒãäºæãã¬ç¶æ³ããæãåºãã®ãæã å©ããŸãã
ã³ãŒãã«å ¥ããã«ãå¥ã®ãã³ãžã§ã³ã®ã«ãŒãããªãã·ã§ã³ã§èª¬æã§ããããšãéèŠã§ãã
ã¢ãããŒã
移åãšäœçœ®æ±ºã
ããŒã¹ãããŒã¯ãšãªãªãŒã¹ããŒãäœçœ®ãããŠã¹ã¯ãªãã¯ãèšé²ããã ãã§ã¯æ©èœããŸããã ããæ£ç¢ºã«ã¯ã次ã®çç±ã«ãããäºæ³ãããšããã«åçãããªãå Žåã«ã®ã¿èšé²ãããŸãã
- ãã£ã©ã¯ã¿ãŒã®åæäœçœ®ãšåœŒã®èŠç·ã®æ¹åãåçŸããå¿ èŠããããŸãã èªåã¬ãŒã¹ã®åã«å察æ¹åã«ãããã«æ²ãããšãæ²ãã£ãŠèµ°ããé ããæ©ããå£ã«ã¶ã€ãããŸã
- æ£ç¢ºãªåº§æšãšè§åºŠãæžãçãããšãããã«ãã£ã©ã¯ã¿ãŒãé 眮ããããšã«å€±æããŸãã ãã«ããŒã¶ãŒã®ãããªãã¿ã³ã«åå¿ããåãããã«å転ããŸãã ãããŠã100ã¡ãŒãã«ã®1床ã®èª€å·®ã§ãã ã¡ãŒã¿ãŒïŒæžå£å¹ ïŒ
- ãã¿ã³ãæŒããŠé¢ãæéãçæ³ããã¯ã»ã©é ãã ç®ãéããŠã¢ããŒããæ©ãåããããªãã®ã§ãã 6æ©å ãå³å¯ã«å³åŽã«ããããã«èŠããŸãããå®éã«ã¯ããã€ã¬ã®ä»£ããã«ãç§ãã¡ã¯ãã€ã¬ã«ããŸãã ãŸãããã³ãã«ãæããã«ç®ãéããŠãã¢ãéããããã«ããŠãã ããã
ãããã®çç±ããã座æšã䜿çšããŠäžçã«èªåèªèº«ãé 眮ããå¿ èŠããããŸãã åæã«ãäœçœ®ã確èªãã100ããªç§ããšã«å®æçã«èª¿æŽããå¿ èŠããããŸãã
移å40.644 20.417 1.537 移å40.526 20.411 1.537 移å40.246 20.408 1.592 移å39.974 20.414 1.592 移å39.691 20.411 1.537 移å39.417 20.388 1.510
ããã¯ããããã移åã³ãã³ãã®ãªã¹ãããã®æç²ã§ãã x ã y座æšãããã³ã©ãžã¢ã³åäœã®ç©ºéå ã®å転è§åºŠã瀺ãããŸãã
ããŒãšã³ãã³ã
éäžã§ããã¿ã³ãæŒããŠããŠã¹ã§ã¯ãªãã¯ãããã¢ãéãå¿ èŠããããŸãã ãã¹ãŠãæäœæ¥ã§æžããããããŸããã ãããŠã座æšïŒäžèšã®äŸïŒã§ããŒã ã®äžãèŠãŠãã©ãã«å ¥åãããã¯ããŸãæ°ã«å ¥ããªãã ãã®ããããã¿ã³ã1åã¯ãªãã¯ããŠã¯ãªãã¯ããã ãã§ã座æšã®èšé²ãšäžŠè¡ããŠèšè¿°ããŸãã
ããã-0.89ããŠã¹å³942 498äžæåæ¢10000移å39.417 20.388 1.510ã㌠`äžæåæ¢1000ããŒ{ã¹ããŒã¹}移å39.142 20.364 1.510ããŒ{TAB}ããŒ3ããŒ3ããŠã¹å³963622移å38.864 20.340 1.510移å38.653 20.321 1.510
åå¥ã«ãããããïŒåŸé ïŒã«èšåããŸãã ãã£ã©ã¯ã¿ãŒãå°å¹³ç·ãèŠãŠããå Žåãããã¯ãŒãã§ãã èã®äžã®å ŽåãåŸé ã¯è² ã§ãã ãããŠç©ºã«-ããžãã£ãã ã©ãžã¢ã³ã§æž¬å®ã ãã£ã©ã¯ã¿ãŒãé£ã¶ãšããã«åœŒãè¿œå ããå¿ èŠããããŸããã
ã¢ãžã¥ãŒã«
ãããã£ãŠããããã®
- WoWã€ã³ã¿ãŒãã§ãŒã¹çšã®ã¢ããªã³ãäœæãããã£ã©ã¯ã¿ãŒã®äœçœ®ãæ¹äœè§ãåŸãã決å®ããŸãã ã²ãŒã ã¢ããªã³ã®ã«ãŒã«ã¯çŠæ¢ãããŠããŸãããæå®ãããæ å ±ã¯ãã¢ããªã³å ã®ã²ãŒã APIããå ¥æã§ããŸãã 圌ã¯ããããã¹ãŠç»é¢ã«æããŸãã ã¢ããªã³èªäœã¯Luaèšèªã§èšè¿°ãããŠããŸããããã¯ãã²ãŒã ã®éçºè ã決å®ããããã§ãã
- ã¢ããªã³ã§ã¯ãäœããå®çŸ©ããããæç»ãããã§ããŸããããã£ã©ã¯ã¿ãŒãåããããšã¯ã§ããŸããã ã¢ããªã³ã§ãããã¡ã€ã«ã«æžã蟌ãããšã¯ã§ããŸãããå£ã®å Žæãæµã®å ŽæããããŠãŸã ã§ããªãããšãã²ãŒã ã«å°ããããšã¯ã§ããŸããã ãããã£ãŠã å€éšå¶åŸ¡ã¢ããªã±ãŒã·ã§ã³ãäœæããå¿
èŠããããŸã ã ç§ã¯ãªãªãžãã«ã«ãªããã AutoItã䜿çšããŸããã 匷ãåä»ããããèšèªã§ã®ããã°ã©ãã³ã°ã«æ
£ããŠããç§ã«ãšã£ãŠã¯ãå°ãã¯ã€ã«ãã§ãããæ¬åœã«é«éã§äŸ¿å©ã§ã ã
- ã¢ããªã±ãŒã·ã§ã³ã¯èªåã®ã¢ã¯ã·ã§ã³ãèšé²ã§ããã¯ãã§ãã ãã®æ©èœã¬ã³ãŒããŒãåŒã³åºã
- ã¢ããªã±ãŒã·ã§ã³ã¯èšé²ãåçã§ããå¿ èŠããããŸãã ãã¬ã€ã€ãŒãåŒã³åºã
- èšé²ãããã¢ã¯ã·ã§ã³ãšåº§æšã¯ãè¡ããšã«ããã¹ããã¡ã€ã«ã«ä¿åãããŸãã ãããã¯æåã§ç·šéã§ããŸãããç·šéããå¿ èŠããããŸãã æŸèæãè¿œå ãããã¿ãåãé€ããŸãã ãããæãé£ãããšããã«èšããŸãã
Luaã®WoWã®ã¢ããªã³
WoWã®ã¢ããªã³ã¯ã Luaèšèªã®ã¹ã¯ãªããã§ã ã ãã®èšèªã¯ãå®å šã§æè»æ§ããããå¹æçã§ãã ãã®ã·ã¹ãã ã§ã¯äœãã§ããŸããã ã²ãŒã ã§ãã¹ãŠãå®è¡ã§ããŸãããã²ãŒã ãæäŸããAPIã®ãã¬ãŒã ã¯ãŒã¯å ã§ã®ã¿å¯èœã§ãã Blizzardã¯ãã¬ã€ã€ãŒãèµ·æ¥å®¶ãããããæžãããšãæãã§ããªããããããçŠæ¢ããŠãããããäžèšã®åº§æšã«å ããŠAPIã¯ã»ãšãã©æçšãªãã®ãæäŸããŸããã ãã¡ãããç§ãã¡ã®ããŒãºã«åœ¹ç«ã¡ãŸãã Luaã®èª¬æãå«ãã¢ããªã³ãããã«äœæããããã®åªããã¬ã€ãã¯ã ããã«ãããŸã ã ããŠããªãã·ã§ã³ã«ã€ããŠèª¬æããŸãã
ãããã§ã¹ããšGUI
詳现ãšãœãŒã¹ ã World of Warcraft \ Interface \ AddOns \ãã©ã«ããŒã§ã HelloWorldãã©ã«ããŒãäœæããŸãã HelloWorld.tocãã³ã³ãã³ããšãšãã«å ¥ããŸã
##ã€ã³ã¿ãŒãã§ãŒã¹ïŒ50001 ##ã¿ã€ãã«ïŒHelloãWorldïŒ ##泚ïŒæåã®ã¢ããªã³ HelloWorld.lua
ã·ã§ã€ããšãã¿ã³ãæç»ãããå ŽåïŒããã«ã¯éåžžã¢ããªã³ãå¿ èŠã§ãïŒããããã®ãã¿ã³ã®èª¬æãæåŸã®è¡ãšããŠHelloWorld.xmlãå ¥åããŸãã AddOn Studioã¯ããã®ãããªGUIã¢ããªã³ã®èšèšãšäœæãæ¯æŽããŸãã MS Visual Studioã«åºã¥ã匷åãªããŒã«ã
ããããç§ã¯ããããªã¹ããªã®ã§ãä»åã¯æããŸããã ããã«ãããã«ããããã¶ã€ããŒã䜿çšããã«ã¹ã¯ãªããèªäœãããã©ãŒã ãåçã«äœæã§ããããšã瀺ãæ©äŒãäžããããŸãã HelloWorld.luaãæ€èšããŠãã ããã ã¡ã¢åž³++ã§ç·šéããŸããã ã²ãŒã ã§HelloWorld.tocã«å€æŽãçµã¿èŸŒãã«ã¯ãå®å šã«åèµ·åããå¿ èŠããããŸãã ãã ããã³ã³ãœãŒã«ã§/ reloadã³ãã³ããèšè¿°ããããšã«ããã HelloWorld.luaã®å€æŽããã£ããã§ããŸãã ãããã£ãŠãããã°ã©ãã³ã°ãšãããã°ã®ããã»ã¹ã¯ããã»ã©èŠçã§ã¯ãããŸããã
ã¹ã©ãã·ã¥ã³ãã³ã
ãšããã§ããããã°ã«ã€ããŠã ããã«ã¹ã©ãã·ã¥ã³ãã³ããã³ãã©ãŒãè¿œå ããããšããå§ãããŸãã
SLASH_HELLO_WORLD1 = '/helloworld'; function SlashCmdList.HELLO_WORLD(msg, editbox) local facing = GetPlayerFacing(); local pitch = GetUnitPitch("player"); local x, y = GetPlayerMapPosition("player"); print(format("HelloWorld %.2f %.2f %.2f %.2f", x*100, y*100, facing, pitch)); end
ãããè¡ãã«ã¯ã SLASH_IMnã®åœ¢åŒã®å€æ°ãå®çŸ©ããŸãã NAMEã¯ãã¹ãŠã®ã¢ããªã³ã§äžæã§ããã nã¯ç©ºãŸãã¯1ããã®åºæ°ã§ãããããŠã NAMEãšããååã®é¢æ°ããªããžã§ã¯ãã«è¿œå ããŸãã C ++ããã°ã©ããŒã«ãšã£ãŠããã®ãã³ãã©ãŒé¢æ°ãã©ãã«ãæ瀺çã«ç»é²ããŠããªãã®ã¯å¥åŠã«æãããããããŸããã ã¯ããå€æ°ã®ååã ãã§æååå€æ°ã«é¢é£ä»ããŸãã ããããããã«ããã®ã¯ãLuaã®åãšéæ³ã§ãã
ããã§ãWoWã³ã³ãœãŒã«/ helloworldã®ããŒã ãå¿ èŠãªã¢ã¯ã·ã§ã³ãå®è¡ããŸãããããã°æ å ±ã衚瀺ã§ããããã«ãªããŸããå®éãæãåçŽãªã¢ããªã³ã«ã€ããŠã¯ãäœæãããã¹ãŠã®æäœãå®è¡ããŸãã
ããã§ã¯ãå¿ èŠãªæ å ±ãåŒãåºãWoW APIã玹ä»ããŸããã
ã€ãã³ããã³ãã©ãŒ
ã¢ããªã³ã§GUIãæäœããããã®ã·ã¹ãã ã¯ãã¡ãã»ãŒãžãšãã®åŠçã®ç¹ã§Windowsã®åäœã«äŒŒãŠããŸãã
local EventFrame = CreateFrame("Frame") function EventFrame:OnEvent(event, ...) print("HelloWorld:", event) self[event](self, ...) end EventFrame:SetScript("OnEvent", EventFrame.OnEvent) EventFrame:RegisterEvent("PLAYER_LOGIN") function EventFrame:PLAYER_LOGIN() -- end function EventFrame:OnUpdate() -- end EventFrame:SetScript("OnUpdate", EventFrame.OnUpdate)
ã Frame ãã¿ã€ãã®ãã¬ãŒã ãäœæããã³ãã³ãã§ã OnEvent ãããã³ã OnUpdate ãã¢ã¯ã·ã§ã³ã«æ¥ç¶ããŸã
EventFrame:SetScript("OnEvent", EventFrame.OnEvent) EventFrame:SetScript("OnUpdate", EventFrame.OnUpdate)
OnUpdateãã³ãã©ãŒã¯åãã¬ãŒã ã®åŸã«åŒã³åºãããŸã-座æšãæŽæ°ããããã«å¿ èŠãªãã®ã OnEventã¯ãä»ã®å¿ èŠãªã€ãã³ãã§åŒã³åºãããŸãã ãããã察å¿ããé¢æ°ãåŒãåºããŸãïŒ
self[event](self, ...)
Luaã§ããã«äŸ¿å©ãªã®ã¯ããã®èšèšã䜿çšãããšããã©ãŒã ã®äžæã®ãã³ãã©ãŒãåŒã³åºããããšã§ãã
function EventFrame:PLAYER_LOGIN()
ããã§ã PLAYER_LOGINã¯ãã¯ãŒã«ãã«å ¥ã£ãŠãã¹ãŠã®ãã¬ãŒã ããŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹ãåèµ·åãããšãã«éä¿¡ãããã€ãã³ãã§ãã ãã®ä»ã®ã€ãã³ãïŒ PLAYER_LEAVE_COMBAT ã QUEST_FINISHED ã PLAYER_EQUIPMENT_CHANGED ã PLAYER_DEADãªã©ã å®å šãªãªã¹ãã¯ããã«ãããŸã ã ã³ãã³ãã§åŠçãããã€ãã³ããç»é²ããŸã
EventFrame:RegisterEvent("PLAYER_LOGIN")
æ å ±äŒé
ã¢ããªã³ã®ã·ã¹ãã ã§ã¯äœãã§ããªãããããã¯ã»ã«ã®è²ãå€æŽããŠWoWãããããã®å¥ã®éšåã«æ å ±ãéä¿¡ããŸãã rednaxiã圌ã®ãã¹ãã§ããããã«ã ãã ãã1ããã以äžã®æ å ±ãã«ã©ãŒã§éä¿¡ããã ãã§ãããããŒã¿ãã·ãªã¢ã«åããŠããã«éä¿¡ããŸãã
æç»
æç»ã«ã¯ãã¬ãŒã ãå¿ èŠãªã®ã§ããã¬ãŒã ãäœæããŸã
local HelloWorld1 = CreateFrame("Frame", nil, UIParent) local HelloWorld2 = CreateFrame("Frame", nil, UIParent) function EventFrame:PLAYER_LOGIN() HelloWorld1:SetFrameStrata("BACKGROUND") HelloWorld1:SetWidth(10) HelloWorld1:SetHeight(10) HelloWorld1.texture = HelloWorld1:CreateTexture(nil,"BACKGROUND") HelloWorld1.texture:SetAllPoints(HelloWorld1) HelloWorld1:SetPoint("TOPLEFT",0,0) HelloWorld1:Show() HelloWorld2:SetFrameStrata("BACKGROUND") HelloWorld2:SetWidth(10) HelloWorld2:SetHeight(10) HelloWorld2.texture = HelloWorld2:CreateTexture(nil,"BACKGROUND") HelloWorld2.texture:SetAllPoints(HelloWorld2) HelloWorld2:SetPoint("TOPLEFT",10,0) HelloWorld2:Show() end
ããã§ãã¹ãŠãã³ã¡ã³ããªãã§æ確ã ãšæããŸãã åã¡ãœããã®è©³çŽ°ãèªåã§æ¢ããŠãã ããã
é£èŒ
2ã€ã®åº§æšãš2ã€ã®è§åºŠããããŸãã ãã¹ãŠæµ®åå°æ°ç¹æ°ã§ãã ã¢ããªã³å ã®ãã¯ã»ã«ã®è²ã®ã³ã³ããŒãã³ããæµ®åå°æ°ç¹æ°ã§ããã 0.0ã1.0ã§ãã ããã«ãè²æåã¯1ãã€ãã®ãŸãŸã§ããããšãç¥ãããŠããŸãã æåã«ãå座æšã1ã€ã®ã«ã©ãŒã³ã³ããŒãã³ãã«ä¿åããŸããã ãã®çµæããã®å Žæã§ã®æž¬äœç²ŸåºŠã¯å°å³ã®ãµã€ãºã®1/255ã§ããã GPSã®ããã«ãªããŸããïŒåº§æšãããããã«èŠããŸãããããã²ãŒã¿ãŒãéãéè·¯ã§ãã·ã³ïŒäººãªãã§ã³ã³ãã¥ãŒã¿ãŒãå¶åŸ¡ïŒã§è»ãé転ããããšã¯ã§ããŸããã ã ããç§ã¯2ãã€ããäžããªããã°ãªããŸããã§ããã 1ã€ã®å°æ°ã2ãã€ãã§ä¿æããæ¹ãè¯ãã§ããããïŒ ç§ã¯ããããŸãã
local x1, x2 = math.modf(x*255)
modfé¢æ°ã¯ãã³ã³ãã§åºåãããæ°å€ã®æŽæ°éšãšå°æ°éšãè¿ããŸãã ããã§ã¯äžŠåå²ãåœãŠã䜿çšãããŸã-ãã1ã€ã®äŸ¿å©ãªLuaæ©èœã§ãã
ãã®ã¢ãããŒãã§ã¯ã座æšãæ ŒçŽããã2ãã€ãã®ããããã®åãæ倧éã«æŽ»çšããŸãã ããŠãæ¹äœè§ãšåŸæè§ã¯ãããããéé0.0-1.0ã«åãŸãå Žåã«éããããã»ã©æ£ç¢ºã§ã¯ãããŸããã 次ã®ããã«ãªããŸãã
local math = getfenv(0).math function EventFrame:OnUpdate() local facing = GetPlayerFacing(); local pitch = GetUnitPitch("player"); local x, y = GetPlayerMapPosition("player"); local x1, x2 = math.modf(x*255) local y1, y2 = math.modf(y*255) HelloWorld1.texture:SetTexture(x1/255, x2, facing/7) HelloWorld2.texture:SetTexture(y1/255, y2, pitch/4+0.5) end
çŸåšãå·Šäžé ã§äžçäžã移åãããšã2ã€ã®10 x 10ã®æ£æ¹åœ¢ãã©ã³ãã ã«è²ãå€ããŸãã
å
šæHelloWorld.lua
local math = getfenv(0).math SLASH_HELLO_WORLD1 = '/helloworld'; local EventFrame = CreateFrame("Frame") local HelloWorld1 = CreateFrame("Frame", nil, UIParent) local HelloWorld2 = CreateFrame("Frame", nil, UIParent) function EventFrame:OnEvent(event, ...) print("HelloWorld:", event) self[event](self, ...) end EventFrame:SetScript("OnEvent", EventFrame.OnEvent) EventFrame:RegisterEvent("PLAYER_LOGIN") function EventFrame:PLAYER_LOGIN() HelloWorld1:SetFrameStrata("BACKGROUND") HelloWorld1:SetWidth(10) HelloWorld1:SetHeight(10) HelloWorld1.texture = HelloWorld1:CreateTexture(nil,"BACKGROUND") HelloWorld1.texture:SetAllPoints(HelloWorld1) HelloWorld1:SetPoint("TOPLEFT",0,0) HelloWorld1:Show() HelloWorld2:SetFrameStrata("BACKGROUND") HelloWorld2:SetWidth(10) HelloWorld2:SetHeight(10) HelloWorld2.texture = HelloWorld2:CreateTexture(nil,"BACKGROUND") HelloWorld2.texture:SetAllPoints(HelloWorld2) HelloWorld2:SetPoint("TOPLEFT",10,0) HelloWorld2:Show() end function EventFrame:OnUpdate() local facing = GetPlayerFacing(); local pitch = GetUnitPitch("player"); local x, y = GetPlayerMapPosition("player"); local x1, x2 = math.modf(x*255) local y1, y2 = math.modf(y*255) HelloWorld1.texture:SetTexture(x1/255, x2, facing/7) HelloWorld2.texture:SetTexture(y1/255, y2, pitch/4+0.5) end EventFrame:SetScript("OnUpdate", EventFrame.OnUpdate) function SlashCmdList.HELLO_WORLD(msg, editbox) local facing = GetPlayerFacing(); local pitch = GetUnitPitch("player"); local x, y = GetPlayerMapPosition("player"); print(format("HelloWorld %.2f %.2f %.2f %.2f", x*100, y*100, facing, pitch)); end
ååã®ãŸãšã
è°è«ãããããšãç¹°ãè¿ããŸã
- å€æ°ã®è©Šè¡ã«å¯ŸããŠã¢ã€ãã ãååŸãã確çãèšç®ããŸãã
- åé¡ã®æŠèŠã説æãããœãªã¥ãŒã·ã§ã³ãžã®ã¢ãããŒããéçºããã¢ãžã¥ãŒã«ã«åå²ãã
- Luaã§æãåçŽãªWoWã¢ããªã³ã³ãŒãã確èªããŸãã
- è²ã䜿çšããŠåº§æšãéä¿¡ããããšãåŠã³ãŸãã
- æç»ãåŠã³ãã€ãã³ããåŠçãã
- ã¹ã©ãã·ã¥ã³ãã³ãã®åŠçãåŠã³ãŸãã
ããã§ãã¢ããªã³ãäœæããæºåãæŽããŸããã
äœããéçºããŠããŠãèªåããŠãŒã¶ãŒãåå ã§ããããã«ãããå Žåã¯ãAPIã䜿çšããŠèªåçšã«ãœãããŠã§ã¢ãæè»ã«ã«ã¹ã¿ãã€ãºããŸãïŒããšãã°ã察æŠçžæã®äººå·¥ç¥èœãäœæãããããŒã«ãŒãåŒçšã«åºã¥ããŠããžã·ã§ã³ãé 眮ã§ããããã«ãã管çè ãçµæã«åºã¥ããŠã¢ã¯ã·ã§ã³ãå®è¡ã§ããããã«ããŸãïŒãŠãŒã¶ãŒã·ã¹ãã ã®ã€ã³ãã³ããªãªã©ïŒãLuaã¯éåžžã«æè»ã§çµ±åãéåžžã«ç°¡åã§ãã ãã®ãããªæ©äŒãèæ ®ããŠãã ããã
ããŠã 次ã®éšåã§è©±ããŸã
- AutoItã§ããŒãšåº§æšã®ã¬ã³ãŒããŒãæžã
- ãããã®Player'aåœä»€ãæžã
- æ°åŠ2Dãã³ãµã€ã³å®çãªãã§ãã«ã«ã座æšç³»ãããã²ãŒãããæ¹æ³
- ã»ã³ãµãŒãäžååãªããããå¶åŸ¡
- ããããžã®å¯Ÿç
08/14ããã®å€æŽ
2çªç®ã®éšåãžã®ãªã³ã¯ãè¿œå ããŸããã