我的世調(diào)用世界1.12版本中,函數(shù)與進(jìn)度系統(tǒng)的界函教程出現(xiàn),讓命令脫離命令方塊——這句曾經(jīng)說(shuō)過(guò)的數(shù)系珠海金灣小姐姐包夜vx《356+2895》提供外圍女上門(mén)服務(wù)快速選照片快速安排不收定金面到付款30分鐘可到達(dá)玩笑般的預(yù)言,正式成為可能。模塊命令下面99小編就給大家?guī)?lái)我的攻略世界函數(shù)系統(tǒng)的模塊調(diào)用攻略。

函數(shù)系統(tǒng)的模塊調(diào)用
對(duì)于一個(gè)完整的命令系統(tǒng)而言,模塊一般可以分為三類:對(duì)執(zhí)行順序先后有要求的函數(shù)高頻模塊、對(duì)執(zhí)行順序先后無(wú)要求的系統(tǒng)高頻模塊、非高頻模塊。世調(diào)用在函數(shù)系統(tǒng)中,界函教程我們同樣可以將模塊分成這三類。數(shù)系為了方便后續(xù)講解。模塊命令珠海金灣小姐姐包夜vx《356+2895》提供外圍女上門(mén)服務(wù)快速選照片快速安排不收定金面到付款30分鐘可到達(dá)我們作這樣的攻略設(shè)定:
將 system:_main設(shè)為 glf ,并稱之為主進(jìn)程或者主時(shí)鐘
對(duì)于上面講到的版本三類模塊,我們通過(guò)三種不同的函數(shù)方式去調(diào)用。
對(duì)執(zhí)行順序先后有要求的高頻模塊,在主進(jìn)程中按照需要的順序排列好來(lái)調(diào)用。對(duì)執(zhí)行順序先后沒(méi)有要求的高頻模塊,在主進(jìn)程中可以比較隨意放置位置,但是一般不會(huì)考慮優(yōu)先執(zhí)行。特別地,如果這個(gè)模塊是針對(duì)每一個(gè)玩家獨(dú)立執(zhí)行的,可以使用進(jìn)度系統(tǒng)中的"tick"觸發(fā)器來(lái)調(diào)用,而不需要放在主進(jìn)程中。僅在特定情況下觸發(fā)的非高頻模塊,在主進(jìn)程中調(diào)用,但是輔以execute、scoreboard和選擇器參數(shù)去控制其在合適的時(shí)候被調(diào)用,這里的選擇器,包括了在1.12 pre-4中新增的if/unless的部分。
非高頻模塊在特定條件下激活,也在很大程度上減少了模塊中大量重復(fù)出現(xiàn)execute的現(xiàn)象,并完全杜絕了超長(zhǎng)的Conditional鏈,因?yàn)閒unction中并不直接支持Conditional。不直接支持,說(shuō)明可以間接支持,對(duì)吧。我們來(lái)看一個(gè)例子。
假設(shè)有紅藍(lán)兩隊(duì),在開(kāi)始前考慮到互毆問(wèn)題不進(jìn)行分隊(duì),而是采用掛tag的方式。
紅隊(duì)以tag=redTeam為標(biāo)記,藍(lán)隊(duì)則以tag=blueTeam為標(biāo)記,準(zhǔn)備觀戰(zhàn)的玩家以tag=specTeam為標(biāo)記
當(dāng)玩家站在相應(yīng)區(qū)域(紅藍(lán)兩隊(duì)的所有玩家還需要選擇了職業(yè))添加Ready的標(biāo)記,視為準(zhǔn)備就緒。
如果玩家不在相應(yīng)區(qū)域時(shí)就移除Ready的標(biāo)記。
選擇了職業(yè)的玩家,其記分板項(xiàng)selectClass數(shù)值大于等于1
全部玩家準(zhǔn)備就緒后,游戲進(jìn)入倒計(jì)時(shí),倒計(jì)時(shí)結(jié)束時(shí)游戲開(kāi)始
倒計(jì)時(shí)未結(jié)束,有玩家脫離準(zhǔn)備就緒的狀態(tài),則倒計(jì)時(shí)中斷
條件比較多,我們先來(lái)看看怎么寫(xiě)這個(gè)模塊,再進(jìn)行分析。在這里,我們準(zhǔn)備了一個(gè)名為gameStat的aec實(shí)體作為標(biāo)記,所有游戲進(jìn)程會(huì)以tag或者score的形式掛載到該實(shí)體上。請(qǐng)看指令部分
execute @p[tag=redTeam,score_selectClass_min=1] ~ ~ ~ execute @p[tag=blueTeam,score_selectClass_min=1] ~ ~ ~ scoreboard players tag @e[type=area_effect_cloud,name=gameStat,tag=notGaming] add allReady
execute @p[tag=!Ready,m=2] ~ ~ ~ scoreboard players tag @e[name=gameStat,type=area_effect_cloud,tag=notGaming] remove allReady
execute @p[tag=!Ready,m=2] ~ ~ ~ execute @e[name=gameStat,type=area_effect_cloud,tag=notGaming] ~ ~ ~ execute @s[tag=!allReady,score_waitTime_min=1] ~ ~ ~ title @a clear
execute @p[tag=!Ready,m=2] ~ ~ ~ execute @e[name=gameStat,type=area_effect_cloud,tag=notGaming] ~ ~ ~ execute @s[tag=!allReady,score_waitTime_min=1] ~ ~ ~ title @a reset
execute @p[tag=!Ready,m=2] ~ ~ ~ execute @e[name=gameStat,type=area_effect_cloud,tag=notGaming] ~ ~ ~ scoreboard players reset @s[tag=!allReady] waitTime
scoreboard players add @e[name=gameStat,tag=allReady] waitTime 1
execute @e[name=gameStat,score_waitTime=1,score_waitTime_min=1] ~ ~ ~ title @a times 10 140 10
execute @e[name=gameStat,score_waitTime=1,score_waitTime_min=1] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"請(qǐng)玩家站在準(zhǔn)備區(qū)域不要離開(kāi)"}]
execute @e[name=gameStat,score_waitTime=1,score_waitTime_min=1] ~ ~ ~ title @a title [{ "color":"yellow","text":"游戲即將開(kāi)始"}]
execute @e[name=gameStat,score_waitTime=40,score_waitTime_min=40] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"3"}]
execute @e[name=gameStat,score_waitTime=40,score_waitTime_min=40] ~ ~ ~ execute @a ~ ~ ~ playsound block.note.pling voice @p ~ ~ ~ 1 0
execute @e[name=gameStat,score_waitTime=60,score_waitTime_min=60] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"2"}]
execute @e[name=gameStat,score_waitTime=60,score_waitTime_min=60] ~ ~ ~ execute @a ~ ~ ~ playsound block.note.pling voice @p ~ ~ ~ 1 0
execute @e[name=gameStat,score_waitTime=80,score_waitTime_min=80] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"1"}]
execute @e[name=gameStat,score_waitTime=80,score_waitTime_min=80] ~ ~ ~ execute @a ~ ~ ~ playsound block.note.pling voice @p ~ ~ ~ 1 0
execute @e[name=gameStat,score_waitTime_min=100] ~ ~ ~ title @a times 10 30 10
execute @e[name=gameStat,score_waitTime_min=100] ~ ~ ~ title @a title [{ "color":"gold","text":"游戲開(kāi)始"}]
scoreboard players set @e[name=gameStat,type=area_effect_cloud,score_waitTime_min=100] gameStat 1
scoreboard players reset @e[name=gameStat,score_gameStat_min=1,score_gameStat=1] waitTime
scoreboard players tag @e[name=gameStat,score_gameStat_min=1,score_gameStat=1] remove allReady
execute @e[type=area_effect_cloud,name=gameStat,score_gameStat_min=1,score_gameStat=1] ~ ~ ~ function system:StartGame
接下來(lái)我們來(lái)慢慢分析。
首先是開(kāi)始的條件。有紅藍(lán)兩隊(duì),那么這兩隊(duì)都肯定需要有人,才能夠開(kāi)始,考慮到同一選擇器中不能重復(fù)使用tag的參數(shù),我們保留了區(qū)分隊(duì)伍的參數(shù),而不是區(qū)分是否準(zhǔn)備就緒的參數(shù)。因此,第一條指令的意思是,當(dāng)存在選了職業(yè)并選紅隊(duì)的玩家以及選了職業(yè)并選藍(lán)隊(duì)的玩家,我們給中心實(shí)體加上allReady這個(gè)標(biāo)記,以表明可能滿足開(kāi)始條件。
至于滿足條件嗎?如果有未準(zhǔn)備就緒的玩家,就說(shuō)明不滿足,那我們就讓一個(gè)沒(méi)有準(zhǔn)備就緒的玩家來(lái)去掉allReady這個(gè)標(biāo)記好了。
對(duì)于3~5行,我們放后面點(diǎn)講。先看后面。滿足開(kāi)始條件以后,我們會(huì)給中心實(shí)體加分(使用waitTime這個(gè)記分板項(xiàng)),在第一刻加分后出現(xiàn)提示文字提示準(zhǔn)備開(kāi)始,然后進(jìn)入循環(huán)計(jì)時(shí),最后計(jì)時(shí)滿了,調(diào)用system:startgame這個(gè)函數(shù)來(lái)開(kāi)始游戲(這里不是例子的部分,不作說(shuō)明)。
那么回過(guò)頭來(lái)看3~5行,這里明顯是打斷的部分。打斷,就是要清掉提示文字、重置計(jì)時(shí)器。如果此時(shí)都還沒(méi)有進(jìn)行過(guò)加分,那么我們就不必進(jìn)行那三條指令,因此可以看到中間有個(gè)選擇器里有score_waitTime_min=1的參數(shù)加以限制。
重點(diǎn)來(lái)了,我們看到這3條指令前面相當(dāng)長(zhǎng)一串execute是重復(fù)的。因?yàn)樵谝郧坝胏b寫(xiě)的時(shí)候,這里使用了Conditional,而現(xiàn)在函數(shù)不直接支持Conditional,所以用了一大堆execute,但是這里我們可以稍作修改,對(duì)不對(duì)?請(qǐng)看下面
execute @p[tag=redTeam,score_selectClass_min=1] ~ ~ ~ execute @p[tag=blueTeam,score_selectClass_min=1] ~ ~ ~ scoreboard players tag @e[type=area_effect_cloud,name=gameStat,tag=notGaming] add allReady
execute @p[tag=!Ready,m=2] ~ ~ ~ scoreboard players tag @e[name=gameStat,type=area_effect_cloud,tag=notGaming] remove allReady
execute @p[tag=!Ready,m=2] ~ ~ ~ execute @e[name=gameStat,type=area_effect_cloud,tag=notGaming] ~ ~ ~ execute @s[tag=!allReady,score_waitTime_min=1] ~ ~ ~ function system:cond_breakstartcount
scoreboard players add @e[name=gameStat,tag=allReady] waitTime 1
execute @e[name=gameStat,score_waitTime=1,score_waitTime_min=1] ~ ~ ~ title @a times 10 140 10
execute @e[name=gameStat,score_waitTime=1,score_waitTime_min=1] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"請(qǐng)玩家站在準(zhǔn)備區(qū)域不要離開(kāi)"}]
execute @e[name=gameStat,score_waitTime=1,score_waitTime_min=1] ~ ~ ~ title @a title [{ "color":"yellow","text":"游戲即將開(kāi)始"}]
execute @e[name=gameStat,score_waitTime=40,score_waitTime_min=40] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"3"}]
execute @e[name=gameStat,score_waitTime=40,score_waitTime_min=40] ~ ~ ~ execute @a ~ ~ ~ playsound block.note.pling voice @p ~ ~ ~ 1 0
execute @e[name=gameStat,score_waitTime=60,score_waitTime_min=60] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"2"}]
execute @e[name=gameStat,score_waitTime=60,score_waitTime_min=60] ~ ~ ~ execute @a ~ ~ ~ playsound block.note.pling voice @p ~ ~ ~ 1 0
execute @e[name=gameStat,score_waitTime=80,score_waitTime_min=80] ~ ~ ~ title @a subtitle [{ "color":"aqua","text":"1"}]
execute @e[name=gameStat,score_waitTime=80,score_waitTime_min=80] ~ ~ ~ execute @a ~ ~ ~ playsound block.note.pling voice @p ~ ~ ~ 1 0
execute @e[name=gameStat,score_waitTime_min=100] ~ ~ ~ title @a times 10 30 10
execute @e[name=gameStat,score_waitTime_min=100] ~ ~ ~ title @a title [{ "color":"gold","text":"游戲開(kāi)始"}]
scoreboard players set @e[name=gameStat,type=area_effect_cloud,score_waitTime_min=100] gameStat 1
scoreboard players reset @e[name=gameStat,score_gameStat_min=1,score_gameStat=1] waitTime
scoreboard players tag @e[name=gameStat,score_gameStat_min=1,score_gameStat=1] remove allReady
execute @e[type=area_effect_cloud,name=gameStat,score_gameStat_min=1,score_gameStat=1] ~ ~ ~ function system:StartGame
system:cond_breakstartcount.mcfunction
title @a clear
title @a reset
scoreboard players reset @s waitTime
雖然這個(gè)獨(dú)立出來(lái)的子模塊只有3條指令,但是如果分離出來(lái)的是30條而不是3條呢?能夠節(jié)省多少功夫想必不需要解釋了吧?
以上是關(guān)于函數(shù)系統(tǒng)模塊調(diào)用的部分,當(dāng)中有提到使用進(jìn)度系統(tǒng)來(lái)調(diào)用部分獨(dú)立模塊,我們接下來(lái)來(lái)可以看看函數(shù)系統(tǒng)與進(jìn)度系統(tǒng)聯(lián)動(dòng)>>>。