Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修正 script_cleararray_pc 无法清空单元素数组的问题 #724

Merged
merged 5 commits into from
Jul 20, 2023

Conversation

CairoLee
Copy link
Contributor

@CairoLee CairoLee commented Jul 14, 2023

测试脚本

  • 先清空自己背包(和装备)使得执行 @itemlist 返回没有道具
  • 点击 NPC 然后观察地图服务器终端窗口
prontera,150,150,4	script	tester	123,{
	setarray @inventorylist_id[0],501;
	debugmes("---");
	debugmes(sprintf("@inventorylist_id[0] = %d", @inventorylist_id[0]));
	getinventorylist();
	debugmes(sprintf("getinventorylist 后数组长度: %d", getarraysize(@inventorylist_id)));
	debugmes(sprintf("getinventorylist 后 @inventorylist_id[0] = %d", @inventorylist_id[0]));
	end;
}

修正后预期

  • getinventorylist 后的第一个元素为 0
[调试]: 脚本诊断 (账号编号: 2000000 | NPC 编号: 110026897) : ---
[调试]: 脚本诊断 (账号编号: 2000000 | NPC 编号: 110026897) : @inventorylist_id[0] = 501
[调试]: 脚本诊断 (账号编号: 2000000 | NPC 编号: 110026897) : getinventorylist 后数组长度: 0
[调试]: 脚本诊断 (账号编号: 2000000 | NPC 编号: 110026897) : @inventorylist_id[0] = 0

修正前现状

  • getinventorylist 后第一个元素为 501
[调试]: 脚本诊断 (账号编号: 2000000 | NPC 编号: 110026897) : ---
[调试]: 脚本诊断 (账号编号: 2000000 | NPC 编号: 110026897) : @inventorylist_id[0] = 501
[调试]: 脚本诊断 (账号编号: 2000000 | NPC 编号: 110026897) : getinventorylist 后数组长度: 1
[调试]: 脚本诊断 (账号编号: 2000000 | NPC 编号: 110026897) : @inventorylist_id[0] = 501

测试注意

  • 改动的函数涉及到以下脚本指令(使用数组承接返回值)
    • getinventorylist
    • getareagid
    • preg_search

@CairoLee CairoLee merged commit 54d4916 into develop Jul 20, 2023
@CairoLee CairoLee deleted the bugfix/cleararray_logic branch July 20, 2023 01:03
@CairoLee CairoLee restored the bugfix/cleararray_logic branch October 27, 2024 13:19
@CairoLee CairoLee deleted the bugfix/cleararray_logic branch October 27, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants