需配合KA以前编写的“kdef转lua脚本的工具”。该工具可以将原版的指令转为lua脚本,一般来说可以有利于阅读理解,如果框架中有完整指令脚本支持,也能直接执行。但其中的50指令部分只是简单转换了,仍旧难以理解。
新增加的工具可以将这部分50指令转为正常的程序格式,制作者也可以自己修改源码和配置,应该能转成可以直接执行的格式。
源码在:https://github.com/scarsty/kys-t ... %99%A8/abcd/trans50
一个转换范例:
转换前的指令:
- if CheckRoleSexual(256) == true then goto label0 end;
- ::label2::
- instruct_50e(8, 0, 7236, 400, 0, 0, 0);
- instruct_50e(34, 0, 15, 60, 285, 25, 0);
- instruct_50e(33, 0, 400, 20, 65, 26211, 0);
- instruct_50e(0, 1, 7237, 0, 0, 0, 0);
- ::label1::
- instruct_50e(3, 0, 2, 1005, 1002, 100, 0);
- instruct_50e(3, 0, 0, 1005, 1005, 2000, 0);
- instruct_50e(32, 0, 1005, 4, 0, 0, 0);
- instruct_50e(8, 1, 1, 400, 0, 0, 0);
- instruct_50e(3, 0, 0, 1, 1, 1, 0);
- instruct_50e(3, 0, 0, 1002, 1002, 1, 0);
- instruct_50e(4, 0, 0, 1002, 4, 0, 0);
- if CheckRoleSexual(256) == true then goto label1 end;
- instruct_50e(34, 0, 80, 95, 150, 83, 0);
- instruct_50e(39, 0, 4, 1100, 100, 85, 100);
- instruct_50e(4, 0, 2, 100, 0, 0, 0);
- if CheckRoleSexual(256) == true then goto label2 end;
复制代码
转换后的指令:
- ::label2::
- x[400] = "你為什么會選擇進入這個世界?"; --instruct_50e(8, 0, 7236, 400, 0, 0, 0);
- DrawRect(15, 60, 285, 25); --instruct_50e(34, 0, 15, 60, 285, 25, 0);
- DrawString(x[400], 20, 65, 26211); --instruct_50e(33, 0, 400, 20, 65, 26211, 0);
- x[1] = 7237; --instruct_50e(0, 1, 7237, 0, 0, 0, 0);
- ::label1::
- x[1005] = x[1002] * 100; --instruct_50e(3, 0, 2, 1005, 1002, 100, 0);
- x[1005] = x[1005] + 2000; --instruct_50e(3, 0, 0, 1005, 1005, 2000, 0);
- temp = x[1005]; --instruct_50e(32, 0, 1005, 4, 0, 0, 0);
- x[temp] = talk(x[1]); --instruct_50e(8, 1, 1, 400, 0, 0, 0);
- x[1] = x[1] + 1; --instruct_50e(3, 0, 0, 1, 1, 1, 0);
- x[1002] = x[1002] + 1; --instruct_50e(3, 0, 0, 1002, 1002, 1, 0);
- if x[1002] < 4 then jump_flag = false; else jump_flag = true; end; --instruct_50e(4, 0, 0, 1002, 4, 0, 0);
- if jump_flag == true then goto label1 end;
- DrawRect(80, 95, 150, 83); --instruct_50e(34, 0, 80, 95, 150, 83, 0);
- strs = {};
- for i=1, 4 do
- strs[i] = x[x[1100] + i - 1];
- end
- x[100] = menu(strs, #strs, 85, 100); --instruct_50e(39, 0, 4, 1100, 100, 85, 100);
- if x[100] == 0 then jump_flag = false; else jump_flag = true; end; --instruct_50e(4, 0, 2, 100, 0, 0, 0);
- if jump_flag == true then goto label2 end;
复制代码
可以看出是执行了一个选菜单。
需注意转换结果中没有考虑x的变量空间连续。本垃圾分析这个连续的条件很少被用到,如遇到也可以手动修改。
|