Lua接口/服务端/AddGlobalCountNews:修订间差异

来自雪舞天龙知识库
跳到导航跳到搜索
Waylee​(留言 | 贡献)
维护服务端 Lua 接口:核对参数、返回值、边界条件与调用示例
Waylee​(留言 | 贡献)
维护服务端 Lua 接口:核对参数、返回值、边界条件与调用示例
 
(未显示同一用户的1个中间版本)
第10行: 第10行:
<pre>AddGlobalCountNews(sceneId, newstr)</pre>
<pre>AddGlobalCountNews(sceneId, newstr)</pre>


服务端脚本中共出现 77 处调用,实参个数出现过:2 个(77 处)。
服务端脚本中共出现 79 处调用,实参个数出现过:2 个(79 处)。


实现位于 <code>LuaFnTbl_Misc.h</code>。
实现位于 <code>LuaFnTbl_Misc.h</code>。
第22行: 第22行:
| 1
| 1
| <code>sceneId</code><br /><span class="lua-muted"><code>number</code></span>
| <code>sceneId</code><br /><span class="lua-muted"><code>number</code></span>
| 当前调用所在的场景 ID。<br /><span class="lua-muted">脚本中的实参:<code>sceneId</code>(77 处)</span>
| 当前调用所在的场景 ID。<br /><span class="lua-muted">脚本中的实参:<code>sceneId</code>(79 处)</span>
|-
|-
| 2
| 2
| <code>newstr</code><br /><span class="lua-muted"><code>string</code></span>
| <code>newstr</code><br /><span class="lua-muted"><code>string</code></span>
| 公告内容,字符串指针类型<br /><span class="lua-muted">脚本中的实参:<code>str</code>(27 处)、<code>message</code>(19 处)、<code>szMsg</code>(7 处)</span>
| 公告内容,字符串指针类型<br /><span class="lua-muted">脚本中的实参:<code>str</code>(26 处)、<code>message</code>(20 处)、<code>szMsg</code>(7 处)</span>
|}
|}


第36行: 第36行:
没有测试
没有测试


== 脚本中的调用 ==
== 调用示例 ==
以下是服务端脚本里的真实调用点,按实参形态去重后列出 8 条。这些调用取自随包发布的脚本,可用于确认参数顺序与实际传入的值;它们不代表该写法在当前版本仍然有效。
以下取自随包服务端脚本的真实调用,可对照上方参数表确认参数顺序:
<pre>-- city0_building12.lua
<pre>-- city0_building12.lua
AddGlobalCountNews(sceneId, strText)
AddGlobalCountNews(sceneId, strText)
-- event/city/protect_guild_generate.lua
-- event/city/protect_guild_generate.lua
AddGlobalCountNews(sceneId, "@*;SrvMsg;SCA:#P"..cityDefaultName.."告急!帮会城市"..)
AddGlobalCountNews(sceneId, "@*;SrvMsg;SCA:#P"..cityDefaultName.."告急!帮会城市"..)
-- event/equip/equip_bind.lua
-- event/equip/equip_bind.lua
AddGlobalCountNews(sceneId, szMsg)
AddGlobalCountNews(sceneId, szMsg)</pre>
 
-- event/EventScript/client_GiveRose.lua
AddGlobalCountNews(sceneId, message)
 
-- event/festival/christmas07/nightwatchgift.lua
AddGlobalCountNews(sceneId, "#&#123;SDSY_081212_01&#125;")
 
-- event/huashan/ehuashan_1.lua
AddGlobalCountNews(sceneId, str)
 
-- event/huashan/ehuashan_1.lua
AddGlobalCountNews(sceneId, szStr)
 
-- event/huodong/edataosha_callback.lua
AddGlobalCountNews(sceneId, Msg)</pre>


</div>
</div>

2026年10月27日 (二) 12:33的最新版本

首页 · 服务端接口 · 通用与活动 · 调用约定

向全组服务器发送新闻公告,公告发送指定次数

同一接口的其他调用名称:LuaFnAddGlobalCountNews。

Lua 调用

AddGlobalCountNews(sceneId, newstr)

服务端脚本中共出现 79 处调用,实参个数出现过:2 个(79 处)。

实现位于 LuaFnTbl_Misc.h。

参数

序号 参数 / 类型 说明
1 sceneId
number
当前调用所在的场景 ID。
脚本中的实参:sceneId(79 处)
2 newstr
string
公告内容,字符串指针类型
脚本中的实参:str(26 处)、message(20 处)、szMsg(7 处)

返回值

无返回值。赋值接收时得到 nil;这与返回数字 0 不同。

用法补充

向全组服务器发送新闻公告,公告发送指定次数
没有测试

调用示例

以下取自随包服务端脚本的真实调用,可对照上方参数表确认参数顺序:

-- city0_building12.lua
AddGlobalCountNews(sceneId, strText)
-- event/city/protect_guild_generate.lua
AddGlobalCountNews(sceneId, "@*;SrvMsg;SCA:#P"..cityDefaultName.."告急!帮会城市"..)
-- event/equip/equip_bind.lua
AddGlobalCountNews(sceneId, szMsg)