Project1
标题:
如何用脚本批量控制开关与变数?
[打印本页]
作者:
so_aries
时间:
2015-2-27 16:26
标题:
如何用脚本批量控制开关与变数?
搜寻半天,还是找不到。
这事件脚本没人有需求吗?
例如:我想开起1~10开关 关闭5开关 变数1~10代入1 变数5+1
$game_switches[1]=true
$game_switches[2]=true
:
$game_switches[10]=true
$game_switches[5]=false
$game_variables[1]=1
$game_variables[2]=1
:
$game_variables[10]=1
$game_variables[5]=+1
只能一个一个写吗?
我知道有批量控制的选项,但我有用破限脚本,超过5000个就没法子用。
$game_switches[1..10]=true <===貌似错误?只有开关1开启其他无效?
$game_switches[1,2,3,4,6,7,8,9,10]=true <==还是错误?
那么,除了一个一个设定开关与变数外,有批量的脚本可以解吗?
作者:
三途亚梦
时间:
2015-2-27 16:33
本帖最后由 三途亚梦 于 2015-2-27 16:44 编辑
写一个循环……
(1..10).each do {|i| $game_switches[i] = true}
复制代码
类似这样。
作者:
howhow1314
时间:
2015-2-27 16:41
RUBY 代码
复制
for
i
in
1
..
10
$game_switches
[
i
]
=
true
end
for
i
in
1
..
10
$game_switches
[
i
]
=
true
end
這樣
作者:
喵呜喵5
时间:
2015-2-27 16:50
插入下面的脚本,
class Game_Variables
alias m5_20150227_set []=
def []=(variable_id, value)
if variable_id.is_a?(Range)
variable_id.each{ |v| m5_20150227_set(v,value) }
else
m5_20150227_set(variable_id,value)
end
end
end
class Game_Switches
alias m5_20150227_set []=
def []=(switch_id, value)
if switch_id.is_a?(Range)
switch_id.each{ |s| m5_20150227_set(s,value) }
else
m5_20150227_set(switch_id,value)
end
end
end
复制代码
然后
$game_switches[1..10] = true
$game_variables[1..10] = 1
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1