function self_command(command)
if command == 'toggle TP set' then
if sets.aftercast.TP == sets.TP.DD then
sets.aftercast.TP = sets.TP.Solo
send_command('@input /echo SOLO SET')
elseif sets.aftercast.TP == sets.TP.Solo then
sets.aftercast.TP = sets.TP.DD
send_command('@input /echo DD SET')
end
elseif command == 'DT' then
equip(sets.DT)
end
end
function aftercast(spell)
if player.status =='Engaged' then
equip(sets.aftercast.TP)
else
equip(sets.aftercast.Idle)
end
end
こうなってるみたいだが、sets.aftercast.Idleはどうなってんの?
precastは以下に変更
-----ここから------
function precast(spell)
if sets.precast[spell.name] then
equip(sets.precast[spell.name])
elseif spell.type=="WeaponSkill" then
equip(sets.precast.WS)
elseif string.find(spell.name,'ワルツ') then
equip(sets.precast.Waltz)
end
end
-----ここまで------
aftercastとstatus_changeはそのまま
function self_commandは以下に差し替え
--マクロから使う場合は↓のような感じ
--/console gs c default
--/console gs c acc
--/console gs c cut
--それから//sc sの代わりにつかうなら
--//gs equip がつかえるよ(ただし日本語はつかえない)
--//gs equip sets.precast.WS
--//gs equip sets.group.default.TP
-----ここから------
function self_command(command)
if command == 'default' then
sets.precast['ビクトリースマイト'] = sets.group.default['ビクトリースマイト']
sets.precast['WS'] = sets.group.default['WS']
sets.aftercast['TP'] = sets.group.default['TP']
send_command(windower.to_shift_jis('@input /echo デフォルトに変更'))
elseif command == 'acc' then
sets.precast['ビクトリースマイト'] = sets.group.acc['ビクトリースマイト']
sets.precast['WS'] = sets.group.acc['WS']
sets.aftercast['TP'] = sets.group.acc['TP']
send_command(windower.to_shift_jis('@input /echo 命中装備に変更'))
elseif command == 'cut' then
sets.precast['ビクトリースマイト'] = sets.group.acc['ビクトリースマイト']
sets.precast['WS'] = sets.group.acc['WS']
sets.aftercast['TP'] = sets.group.acc['TP']
send_command(windower.to_shift_jis('@input /echo カット装備に変更'))
elseif command == 'DT' then
equip(sets.DT)
end
end
-----ここまで------
>>9
ナイトのサンプルみたら抜刀時、納刀時に装備変更してるのがあった
こんな感じでいけるんじゃないかな
function status_change(new,old)
if T{'Idle','Resting'}:contains(new) then
enable('main','sub')
elseif new == 'Engaged' then
equip(sets.aftercast.engage)
disable('main','sub')
end
end
buffactive['xxxx'] で判定するxxxxの部分って〜windower\res\buffs.luaをみれば書いてあったと思う
それから↓みたいなのでxxxxの部分がログにでるよ。弱体とかも全部でるけど
function buff_change(buff, gain)
windower.add_to_chat(123, buff..tostring(gain))
end
>38
36の人じゃないけど、こんな感じでいけるんじゃないだろうか(全角スペースはタブかスペースに変換してね)
if spell.name == 'スタン' then
if buffactive['疾風迅雷の章'] then
equip(sets.precast['スタン'], {feet="PDローファー+1",})
else
equip(sets.precast['スタン'])
end
end
下のスクリプトをつくって遠隔コマンドでprecastとmidcastの着替えが実行されることは確認した
ただしスナップ着替えじゃないんで、スナップ着替えの効果がちゃんと出るのかは未確認。
function get_sets()
set_language('japanese')
end
function precast(spell)
windower.add_to_chat(123,'precast')
equip({head="ブロンズキャップ",})
end
function midcast(spell)
windower.add_to_chat(123,'midcast')
equip({hands="ブロンズミトン",})
end
function aftercast(spell)
windower.add_to_chat(123,'aftercast')
equip({head=empty,hands=empty,})
end
function var_set (command)
hoge = {}
i = string.find(command, '=')
if i then
key = string.sub(command, 1, (i-1))
val = string.sub(command, (i+1), -1)
if tonumber(val) == nil then
hoge[key] = val
else
hoge[key] = tonumber(val)
end
end
end
こんな感じでやってる
チャットラインから //gs c foo=varで変数登録
一つ目の=で判断してるだけなので、適宜変更するといいかも
共通ファイル作ってincludeしとくと色んなジョブで使えて便利
>>66
↓みたいなコード書いて遠隔撃ったら着替えなかったっていってるのかな?
function get_sets()
set_language('japanese')
sets.precast = {}
sets.precast['遠隔攻撃'] = {head="ブロンズキャップ",}
end
function precast(spell)
windower.add_to_chat(123, 'name='..spell.name)
if sets.precast[spell.name] then
equip(sets.precast[spell.name])
end
end
これは当然動かないんだけど、もうちょっと具体的に書いて質問しないと
こいつ全然わかってないなって思われるんじゃないかな。
あとファイル保存するときの漢字コードとかは大丈夫だよね?
>>86
関数を分けるんじゃなくて、HP_handanの中で全部やってしまうのはどうだろう
↓みたいな感じで
function self_command(command)
if command == 'start' then
flag = true
send_command('gs c loop')
elseif command == 'stop' then
flag = false
elseif command == 'loop' then
local cmd = nil
local wait = 1
if player.hpp < 70 then
cmd = 'input /ma ケアルIII <me>'
wait=5
elseif player.hpp > 70 and player.hpp < 95
and not buffactive['リジェネ'] then
cmd = 'input /ma リジェネ <me>'
wait=6
end
if flag then
if cmd then
cmd = cmd..';wait '..tostring(wait)..';gs c loop'
else
cmd = '@wait 1;gs c loop'
end
end
if cmd then
send_command(cmd)
end
end
end
>>94
helper_functions.luaの447行目でエラーがでてるんだけど、
categoryが数値を期待してるのにnilになってるから落ちてるみたい。
↓みたいに落ちる直前でreturnするようにしたらエラーはでなくなった。特に問題はなさそうにみえるけど
なにか副作用があるかもしれない・・・。
if category == nil then
return
end
fn function - Function to be scheduled
time number - Integer time in seconds when fn is supposed to be run
Executes fn delayed by time seconds. Returns the scheduled coroutine.
↓ので4秒おきにストーン打つようになるし固まったりしないね。
function get_sets()
set_language('japanese')
end
function _co_f()
windower.add_to_chat(123,'function() start')
while flag do
my_send_command('input /ma ストーン <lastst>')
windower.add_to_chat(123,'function() 4秒停止')
coroutine.sleep(4)
end
windower.add_to_chat(123,'function() end')
end
function self_command(command)
if command == 'start' then
flag = true
windower.add_to_chat(8,'コルーチンスケジュール開始')
coroutine.schedule(_co_f, 5)
windower.add_to_chat(8,'コルーチンスケジュール完了')
end
if command == 'stop' then
flag = false
end
end
function my_send_command(cmd)
send_command(windower.to_shift_jis(cmd))
end