数组:修订间差异

添加的内容 删除的内容
标签移动版编辑 移动版网页编辑
无编辑摘要
标签移动版编辑 移动版网页编辑 可视化编辑
第48行: 第48行:


<code>单位引用.readUnitMemory('名称',type='类型',index='下标')</code>
<code>单位引用.readUnitMemory('名称',type='类型',index='下标')</code>
<br>self.customTarget1.readUnitMemory('a',type='number',index=114)

在[action]中,可以通过<code>setUnitMemory</code>来直接修改内存的值,格式为<code>setUnitMemory:名称[下标]=值</code> 。
在[action]中,可以通过<code>setUnitMemory</code>来直接修改内存的值,格式为<code>setUnitMemory:名称[下标]=值</code> 。
===修改数组===
===修改数组===
第62行: 第64行:
readUnitMemory('名称',type='类型')[('数学运算下标')]
readUnitMemory('名称',type='类型')[('数学运算下标')]


readUnitMemory('名称',type='类型').get('下标'){{折叠|readUnitMemory例子|<pre>
readUnitMemory('名称',type='类型').get('下标')

self.customTarget1.readUnitMemory('a',type='number',index=114)
</pre>
}}
警告:截止1.15版,跨单位读数组,由于游戏bug,单位参考将被重定向。
警告:截止1.15版,跨单位读数组,由于游戏bug,单位参考将被重定向。
{{折叠|例子|<pre>
<pre>
代码:
代码:
customTarget1.readUnitMemory("obj",type="unit[]").get(memory.index)
customTarget1.readUnitMemory("obj",type="unit[]").get(memory.index)
第80行: 第80行:
customTarget1.memory.obj.get(customTarget1.memory.unit.memory.index)
customTarget1.memory.obj.get(customTarget1.memory.unit.memory.index)
</pre>}}
</pre>
thisActionIndex/index方法不受此影响。
thisActionIndex/index方法不受此影响。


第86行: 第86行:


eventData("get",type="float[]")=[]
eventData("get",type="float[]")=[]

可用的方案:


{{折叠|复制数组|<pre>
{{折叠|复制数组|<pre>
第100行: 第98行:
[hiddenAction_set]
[hiddenAction_set]


setUnitMemory:buffer[index]=thisActionTarget.readUnitMemory("obj",type="unit[]").get(index)
setUnitMemory:buffer[index]=thisActionTarget.readUnitMemory("obj",type="unit[]").get(index)</pre>
</pre>}}
警告:使用接受消息时复制数组,如果这涉及了跨队伍且队伍不为0,会导致复制的所有项为空,你可以使用alsoTriggerOrQueueActionWithTarget:eventSource和thisActionTarget避免它,但是如果你添加了条件这也会复制空,需要使用shrinkArrays:obj修复它
警告:使用接受消息时复制数组,如果这涉及了跨队伍且队伍不为0,会导致复制的所有项为空,你可以使用alsoTriggerOrQueueActionWithTarget:eventSource和thisActionTarget避免它,但是如果你添加了条件这也会复制空,需要使用shrinkArrays:obj修复它


第109行: 第106行:


clipboard/data/floatTypes.ini
clipboard/data/floatTypes.ini
}}


2.修改内存单位数据
{{折叠|修改内存单位数据|


详细请见
详细请见
第135行: 第133行:


[action_0n]
[action_0n]
}}

下载链接:
下载链接:


https://cra.lanzouj.com/b0agtlmih
[https://cra.lanzouj.com/b0agtlmih 蓝奏云] 密码00
===重定向到自己===

三重定向到自己的内存,需要内存单位持有自己。(如列3,这里不提供代码实现)
密码00

3.三重定向到自己的内存,需要内存单位持有自己。(如列3,这里不提供代码实现)


== 专用用法 ==
== 专用用法 ==