脚本示例
脚本展示
行会合一、天地合一、行会聊天、交易、私聊、群聊、组队等开关的完整脚本写法。
用途
通过 NPC 开关行会合一、天地合一、行会聊天、加入行会、交易、私聊、群聊与组队,脚本用 CompVal 判断当前开关值,再用 GMEXECUTE/专用命令切换。
参考脚本
[@允许行会合一]
#IF
CompVal <$AllowGuildRecall> = 1
#ACT
Gmexecute AllowGuildReCall
SendMsg 15 允许行会合一
GOTO @main
BREAK
#IF
CompVal <$AllowGuildRecall> = 0
#ACT
Gmexecute AllowGuildReCall
SendMsg 15 拒绝行会合一
GOTO @main
BREAK
[@允许天地合一]
#IF
CompVal <$AllowGroupRecall> = 1
#ACT
Gmexecute AllowGroupCall
SendMsg 15 允许天地合一
GOTO @main
BREAK
#IF
CompVal <$AllowGroupRecall> = 0
#ACT
Gmexecute AllowGroupCall
SendMsg 15 拒绝天地合一
GOTO @main
BREAK
[@允许行会聊天]
#IF
CompVal <$HearGuildChat> = 1
#ACT
Gmexecute BanGuildChat
SendMsg 15 允许行会聊天
GOTO @main
BREAK
#IF
CompVal <$HearGuildChat> = 0
#ACT
Gmexecute BanGuildChat
SendMsg 15 拒绝行会聊天
GOTO @main
BREAK
[@允许加入行会]
#IF
CompVal <$AllowGuild> = 1
#ACT
Gmexecute LetGuild
SendMsg 15 允许加入行会
GOTO @main
BREAK
#IF
CompVal <$AllowGuild> = 0
#ACT
Gmexecute LetGuild
SendMsg 15 拒绝加入行会
GOTO @main
BREAK
[@交易开关]
#IF
CompVal <$AllowDeal> = 1
#ACT
Gmexecute LetTrade
SendMsg 15 交易关闭
GOTO @main
BREAK
#IF
CompVal <$AllowDeal> = 0
#ACT
Gmexecute LetTrade
SendMsg 15 交易开启
GOTO @main
BREAK
[@私聊开关]
#IF
CompVal <$HearWhisper> = 1
#ACT
Gmexecute AllowMsg
SendMsg 15 私聊开关:<$HearWhisper>
GOTO @main
BREAK
#IF
CompVal <$HearWhisper> = 0
#ACT
Gmexecute AllowMsg
SendMsg 15 私聊开关:<$HearWhisper>
GOTO @main
BREAK
[@群聊开关]
#IF
CompVal <$BanShout> = 1
#ACT
Gmexecute LetShout
SendMsg 15 组队聊天已关闭!
GOTO @main
BREAK
#IF
CompVal <$AllowGroup> = 0
#ACT
Gmexecute LetShout
SendMsg 15 组队聊天已开启!
GOTO @main
BREAK
[@组队开关]
#IF
CompVal <$AllowGroup> = 1
#ACT
AllowGroup 0
SendMsg 15 当前组队:<$AllowGroup>
GOTO @main
BREAK
#IF
CompVal <$AllowGroup> = 0
#ACT
AllowGroup 1
SendMsg 15 当前组队:<$AllowGroup>
GOTO @main
BREAK
关键点
- 共八个开关:行会合一、天地合一、行会聊天、加入行会、交易、私聊、群聊、组队。
- 除组队开关外都是两段式写法:
CompVal 变量 = 1走关闭分支,= 0走开启分支,Gmexecute调用对应 GM 命令后SendMsg 15提示、GOTO @main、BREAK。 - 组队开关没有走
GMEXECUTE,而是直接写AllowGroup 0/AllowGroup 1,提示信息用<$AllowGroup>显示当前值。 - 源页面在
[@允许行会合一]与[@允许天地合一]的第二个分支处把GOTO @main、BREAK写全了,其余分支有的只写了GOTO @main。 CompVal用于比较变量值,见 变量比较 CompVal。
