找回密码
 点一下
查看: 4185|回复: 11

about code

[复制链接]
发表于 2008-8-4 02:45:49 | 显示全部楼层 |阅读模式
摘存wc3c上某段描述,有空试试
While we're on the subject, I2C can be used, with the correct integer, offset by a certain amount from the start of a function (from C2I), to jump to a line of code in a function. It can also jump to half way through a line, which may have varying results, from not accessing a variable (returning null), or crashing WC3.
发表于 2008-8-4 03:06:21 | 显示全部楼层
这样的话似乎可以用来检测脚本是否被修改过





只能异步执行的code,实在想不出它还能干嘛了
回复

使用道具 举报

发表于 2008-8-4 10:50:54 | 显示全部楼层
jump to a line of code in a function.
非常强大的说
等待试验结果
很想知道怎么做呢?
回复

使用道具 举报

发表于 2008-8-4 12:01:36 | 显示全部楼层
jass的虚拟机里每条代码的长度为8,而code就是这个地址的值

function name可得到函数的开始地址,每个定义语句会占用一条代码,赋值是2,四则运算是3 ,逻辑运算是4,函数结束要3条代码,函数开始不消耗代码 ,算好你要跳到的位置然后
I2C(C2I(function name)+8*line)
就可以得到这一行的code了




只是code应该是只能异步执行吧,这样跳来跳去似乎也没什么用

用来研究下jass内部机制还是不错的
回复

使用道具 举报

发表于 2008-8-5 02:06:38 | 显示全部楼层
收回上面的话,我错了
回复

使用道具 举报

 楼主| 发表于 2008-8-5 04:06:36 | 显示全部楼层
厄,有什么新发现了?
回复

使用道具 举报

发表于 2008-8-5 10:47:27 | 显示全部楼层
[codes=jass]
function RunCode takes code c returns nothing
    local boolexpr filter = Condition(c)
    call GroupEnumUnitsInRange(udg_RunCodeGroup, GetUnitX(udg_RunCodeUnit), GetUnitY(udg_RunCodeUnit), 0.00, filter)
    call DestroyBoolExpr(filter)
    set filter = null
endfunction
[/codes]

用这个函数可以做到和call一样的效果,这不是算不算个新发现呢



用code跳到函数中央还有一个问题,不能使用函数的局部变量,除非是跳到local那里,但这样又和直接调用函数一样了。 [s:186]
回复

使用道具 举报

发表于 2008-8-5 11:06:11 | 显示全部楼层
话说跳转这功能我之前就已经发现老~~当我发现function的handle间隔并不是定数而是跟内容长度有关的时候hmmm~~
回复

使用道具 举报

发表于 2008-8-5 11:16:44 | 显示全部楼层
其实我一直在想究竟能不能靠这个实现code的传参的~~不过我几乎都已经被里面的原理给搞混乱了~~理不出什么头绪来~~
回复

使用道具 举报

发表于 2008-8-23 19:15:03 | 显示全部楼层
这个功能貌似在去年偶刚接触Jass时在U9就看到有人发了相关的猜想了。
回复

使用道具 举报

发表于 2008-8-24 09:26:08 | 显示全部楼层
恩,又看到有人研究JASS虚拟机和code了,其实code值就是那样的地址,希望有人帮把我那没作完的jassdebug继续下去
回复

使用道具 举报

发表于 2008-8-28 14:09:41 | 显示全部楼层
code值是固定不变的么?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-5-8 14:20 , Processed in 0.068693 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表