大更改,需要修正
小 (→专用用法) 标签:移动版编辑 移动版网页编辑 高级移动版编辑 |
(大更改,需要修正) |
||
第45行:
===跨单位引用===
要引用其他单位的内存,可以使用<code>readUnitMemory</code>
<code>单位引用.readUnitMemory('名称',type='类型',index='下标')</code>
'''警告:截止1.15正式版,跨单位数组引用在下标中包含逻辑时只会返回第0项,为游戏bug'''▼
{{折叠|readUnitMemory例子|<pre>▼
这是它的其他写法
readUnitMemory('名称',type='类型')['下标']
readUnitMemory('名称',type='类型')[('数学运算下标')]
▲readUnitMemory('名称',type='类型').get('下标'){{折叠|readUnitMemory例子|<pre>
self.customTarget1.readUnitMemory('a',type='number',index=114)
</pre>
}}
如:
customTarget1.readUnitMemory("obj",type="unit").get(memory.index)
customTarget1.readUnitMemory("obj",type="unit").get(self.hp)
customTarget1.readUnitMemory("obj",type="unit").get(memory.unit.readUnitMemory("index",type="float"))
实现运行(伪代码)
customTarget1.memory.obj.get(customTarget1.memory.index)
customTarget1.memory.obj.get(customTarget1.hp)
customTarget1.memory.obj.get(customTarget1.memory.unit.memory.index)
index/thisIndex方法不受此影响。
可用的方案:
1.复制数组
2.修改内存单位数据
clipboard.zip已使用改方案作为内核
3.三重定向到自己的内存,需要内存单位持有自己。
在[action]中,可以通过<code>setUnitMemory</code>来直接修改内存的值,格式为<code>setUnitMemory:名称[下标]=值</code> 。
|