|
Lua Runtime errors.. please help
By Mcdougall 2019-06-24 17:13:40
Everytime i load my lua's i get this error
gearwap: lua runtime error: gearswap/refresh.lua:173: gearswap: file failed to load: .........windoweraddons/libs/funcitons.lua:7:
Gearswap: cannot find the include file string.lua.
Everything appears to be working.. but this is getting annoying... Any help please...
refresh.lua 169-177 Code -- Verify that funct contains functions.
local status, plugin = pcall(funct)
if not status then
error('GearSwap: File failed to load: \n'..plugin)
gearswap_disabled = true
sets = nil
return nil
end
Functions.lua line 7
Code local string, math, table, coroutine = require('string'), require('math'), require('table'), require('coroutine')
and yes there's a strings.lua inside my lib folder
Server: Asura
Game: FFXI
Posts: 496
By Asura.Elizabet 2019-06-29 06:42:05
Is the typo in your path just a typo in your above post or?
Bismarck.Xurion
Server: Bismarck
Game: FFXI
Posts: 694
By Bismarck.Xurion 2019-06-29 09:49:31
First, check if you have that file (addons/libs/strings.lua). If not, take a new copy from their github: https://github.com/Windower/Lua/blob/dev/addons/libs/strings.lua
By Mcdougall 2019-07-01 21:45:00
Is the typo in your path just a typo in your above post or?
I double checked it says this exactly.
By Mcdougall 2019-07-01 21:45:44
I'll try just deleting my old strings and adding this one. Thank you.
Bismarck.Xurion
Server: Bismarck
Game: FFXI
Posts: 694
By Bismarck.Xurion 2019-07-02 07:52:01
It sounds like you already have a strings.lua so I don't think that's gonna fix your issue.
I took a quick look at the GearSwap files on GitHub and noticed that your line numbers are off by one in refresh.lua. I'd suggest reverting that file also: https://github.com/Windower/Lua/blob/dev/addons/GearSwap/refresh.lua
Cerberus.Hokuten
Server: Cerberus
Game: FFXI
Posts: 73
By Cerberus.Hokuten 2019-07-02 08:30:28
gearwap: lua runtime error: gearswap/refresh.lua:173: gearswap: file failed to load: .........windoweraddons/libs/funcitons.lua:7:
Looks like functions might be misspelled. Maybe pastebin the whole file.
By Mcdougall 2019-07-03 09:32:07
I replaced all the files with the default windower ones... I dont know if that fixed it or made it worse... I am now getting
Gearswap Lua runtime error: Gearswap/flow.lua:346
Gearswap has detected an error in the user function aftercast:
...ktopwindower/addons/gearswap/data/user-globals.lua:30: "lower" is not defined for numbers.
In these spoilers is the entire code....
gearswap flow
Code --Copyright (c) 2013~2016, Byrthnoth
--All rights reserved.
--Redistribution and use in source and binary forms, with or without
--modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of <addon name> nor the
-- names of its contributors may be used to endorse or promote products
-- derived from this software without specific prior written permission.
--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
--ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
--WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
--DISCLAIMED. IN NO EVENT SHALL <your name> BE LIABLE FOR ANY
--DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
--(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
--LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
--ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
--SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------------
--Name: equip_sets(swap_type,ts,val1,val2)
--Desc: General purpose equipment pipeline / user function caller.
--Args:
---- swap_type - Determines equip_sets' behavior in terms of which user function it
-- attempts to call
---- ts - index of command_registry or nil for pretarget/commands
---- val1 - First argument to be passed to the user function
---- val2 - Second argument to be passed to the user function
-----------------------------------------------------------------------------------
--Return (varies by swap type):
---- pretarget : empty string to blank packet or full string
---- Everything else : nil
-----------------------------------------------------------------------------------
function equip_sets(swap_type,ts,...)
local results
local var_inps = {...}
local val1 = var_inps[1]
local val2 = var_inps[2]
table.reassign(_global,command_registry[ts] or {pretarget_cast_delay = 0,precast_cast_delay=0,cancel_spell = false, new_target=false,target_arrow={x=0,y=0,z=0}})
_global.current_event = tostring(swap_type)
if _global.current_event == 'precast' and val1 and val1.english and val1.english:find('Geo-') then
_global.target_arrow = initialize_arrow_offset(val1.target)
end
windower.debug(tostring(swap_type)..' enter')
if showphase or debugging.general then msg.debugging(8,windower.to_shift_jis(tostring(swap_type))..' enter') end
local cur_equip = table.reassign({},update_equipment())
table.reassign(equip_list,{})
table.reassign(player.equipment,to_names_set(cur_equip))
for i,v in pairs(slot_map) do
if not player.equipment[i] then
player.equipment[i] = player.equipment[toslotname(v)]
end
end
logit('\n\n'..tostring(os.clock)..'(15) equip_sets: '..tostring(swap_type))
if val1 then
if type(val1) == 'table' and val1.english then
logit(' : '..val1.english)
else
logit(' : Unknown type val1- '..tostring(val1))
end
else
logit(' : nil-or-false')
end
if val2 then
if type(val2) == 'table' and val2.type then logit(' : '..val2.type)
else
logit(' : Unknown type val2- '..tostring(val2))
end
else
logit(' : nil-or-false')
end
if type(swap_type) == 'string' then
msg.debugging("Entering "..swap_type)
else
msg.debugging("Entering User Event "..tostring(swap_type))
end
if not val1 then val1 = {}
if debugging.general then
msg.debugging(8,'val1 error')
end
end
if type(swap_type) == 'function' then
results = { pcall(swap_type,...) }
if not table.remove(results,1) then error('\nUser Event Error: '..results[1]) end
elseif swap_type == 'equip_command' then
equip(val1)
else
user_pcall(swap_type,...)
end
--[[ local c
if type(swap_type) == 'function' then
c = coroutine.create(swap_type)
elseif swap_type == 'equip_command' then
equip(val1)
elseif type(swap_type) == 'string' and user_env[swap_type] and type(user_env[swap_type]) == 'function' then
c = coroutine.create(user_env[swap_type])
elseif type(swap_type) == 'string' and user_env[swap_type] then
msg.addon_msg(123,windower.to_shift_jis(tostring(str))..'() exists but is not a function')
end
if c then
while coroutine.status(c) == 'suspended' do
local err, typ, val = coroutine.resume(c,unpack(var_inputs))
if not err then
error('\nGearSwap has detected an error in the user function '..tostring(swap_type)..':\n'..typ)
elseif typ then
if typ == 'sleep' and type(val) == 'number' and val >= 0 then
-- coroutine slept
err, typ, val = coroutine.schedule(c,val)
else
-- Someone yielded or slept with a nonsensical argument.
err, typ, val = coroutine.resume(c)
end
else
-- coroutine finished
end
end
end]]
if type(swap_type) == 'string' and (swap_type == 'pretarget' or swap_type == 'filtered_action') then -- Target may just have been changed, so make the ind now.
ts = command_registry:new_entry(val1)
-- elseif type(swap_type) == 'string' and swap_type == 'precast' and not command_registry[ts] and debugging.command_registry then
-- print_set(spell,'precast nil error') -- spell's scope changed to local
end
if player.race ~= 'Precomposed NPC' then
-- Short circuits the routine and gets out before equip processing
-- if there's no swapping to be done because the user is a monster.
for v,i in pairs(default_slot_map) do
if equip_list[i] and encumbrance_table[v] then
not_sent_out_equip[i] = equip_list[i]
equip_list[i] = nil
msg.debugging(i..' slot was not equipped because you are encumbered.')
end
end
table.update(equip_list_history,equip_list)
-- Attempts to identify the player-specified item in inventory
-- Starts with (i=slot name, v=item name)
-- Ends with (i=slot id and v={bag_id=bag_id, slot=inventory slot}).
local equip_next,priorities = unpack_equip_list(equip_list,cur_equip)
if (_settings.show_swaps and table.length(equip_next) > 0) or _settings.demo_mode then --and table.length(equip_next)>0 then
local tempset = to_names_set(equip_next)
print_set(tempset,tostring(swap_type))
end
if (buffactive.charm or player.charmed) or (player.status == 2 or player.status == 3) then -- dead or engaged dead statuses
local failure_reason
if (buffactive.charm or player.charmed) then
failure_reason = 'Charmed'
elseif player.status == 2 or player.status == 3 then
failure_reason = 'KOed'
end
msg.debugging("Cannot change gear right now: "..tostring(failure_reason))
logit('\n\n'..tostring(os.clock)..'(69) failure_reason: '..tostring(failure_reason))
else
local chunk_table = L{}
for eq_slot_id,priority in priorities:it() do
if equip_next[eq_slot_id] and not encumbrance_table[eq_slot_id] and not _settings.demo_mode then
local minichunk = equip_piece(eq_slot_id,equip_next[eq_slot_id].bag_id,equip_next[eq_slot_id].slot)
chunk_table:append(minichunk)
end
end
if swap_type == 'midcast' and command_registry[ts] and command_registry[ts].proposed_packet and not _settings.demo_mode then
windower.packets.inject_outgoing(command_registry[ts].proposed_packet:byte(1),command_registry[ts].proposed_packet)
end
if chunk_table.n >= 3 then
local big_chunk = string.char(0x51,0x24,0,0,chunk_table.n,0,0,0)
for i=1,chunk_table.n do
big_chunk = big_chunk..chunk_table[i]
end
while string.len(big_chunk) < 0x48 do big_chunk = big_chunk..string.char(0) end
windower.packets.inject_outgoing(0x51,big_chunk)
elseif chunk_table.n > 0 then
for i=1,chunk_table.n do
local chunk = string.char(0x50,4,0,0)..chunk_table[i]
windower.packets.inject_outgoing(0x50,chunk)
end
end
end
end
windower.debug(tostring(swap_type)..' exit')
if type(swap_type) == 'function' then
return unpack(results)
end
return equip_sets_exit(swap_type,ts,val1)
end
-----------------------------------------------------------------------------------
--Name: equip_sets_exit(swap_type,ind,val1)
--Desc: Cleans up the global table and leaves equip_sets properly.
--Args:
---- swap_type - Current swap type for equip_sets
---- ts - Current index of command_registry
---- val1 - First argument of equip_sets
-----------------------------------------------------------------------------------
--Returns:
---- none
-----------------------------------------------------------------------------------
function equip_sets_exit(swap_type,ts,val1)
if command_registry[ts] then
table.update(command_registry[ts],_global)
end
if type(swap_type) == 'string' then
if swap_type == 'pretarget' then
if command_registry[ts].cancel_spell then
msg.debugging("Action canceled ("..storedcommand..' '..val1.target.raw..")")
storedcommand = nil
command_registry:delete_entry(ts)
return true
elseif not ts or not command_registry[ts] or not storedcommand then
msg.debugging('This case should not be hittable - 1')
return true
end
if command_registry[ts].new_target then
val1.target = command_registry[ts].new_target -- Switch target, if it is requested.
end
-- Compose a proposed packet for the given action (this should be possible after pretarget)
command_registry[ts].spell = val1
if val1.target and val1.target.id and val1.target.index and val1.prefix and unify_prefix[val1.prefix] then
if val1.prefix == '/item' then
-- Item use packet handling here
if bit.band(val1.target.spawn_type, 2) == 2 and find_inventory_item(val1.id) then
-- 0x36 packet
command_registry[ts].proposed_packet = assemble_menu_item_packet(val1.target.id,val1.target.index,val1.id)
elseif find_usable_item(val1.id) then
-- 0x37 packet
command_registry[ts].proposed_packet = assemble_use_item_packet(val1.target.id,val1.target.index,val1.id)
end
if not command_registry[ts].proposed_packet then
command_registry:delete_entry(ts)
end
elseif outgoing_action_category_table[unify_prefix[val1.prefix]] then
if filter_precast(val1) then
command_registry[ts].proposed_packet = assemble_action_packet(val1.target.id,val1.target.index,outgoing_action_category_table[unify_prefix[val1.prefix]],val1.id,command_registry[ts].target_arrow)
if not command_registry[ts].proposed_packet then
command_registry:delete_entry(ts)
msg.debugging("Unable to create a packet for this command because the target is still invalid after pretarget ("..storedcommand..' '..val1.target.raw..")")
storedcommand = nil
return storedcommand..' '..val1.target.raw
end
end
else
msg.debugging(8,"Hark, what weird prefix through yonder window breaks? "..tostring(val1.prefix))
end
end
if ts and command_registry[ts] and val1.target then
if st_targs[val1.target.raw] then
-- st targets
st_flag = true
elseif not val1.target.name then
-- Spells with invalid pass_through_targs, like using <t> without a target
command_registry:delete_entry(ts)
msg.debugging("Change target was used to pick an invalid target ("..storedcommand..' '..val1.target.raw..")")
local ret = storedcommand..' '..val1.target.raw
storedcommand = nil
return ret
else
-- Spells with complete target information
-- command_registry[ts] is deleted for cancelled spells
if command_registry[ts].pretarget_cast_delay == 0 then
equip_sets('precast',ts,val1)
else
windower.send_command('@wait '..command_registry[ts].pretarget_cast_delay..';lua i '.._addon.name..' pretarget_delayed_cast '..ts)
end
return true
end
elseif not ts or not command_registry[ts] then
msg.debugging('This case should not be hittable - 2')
return true
end
elseif swap_type == 'precast' then
-- Update the target_arrow
if val1.prefix ~= '/item' then
command_registry[ts].proposed_packet = assemble_action_packet(val1.target.id,val1.target.index,outgoing_action_category_table[unify_prefix[val1.prefix]],val1.id,command_registry[ts].target_arrow)
end
return precast_send_check(ts)
elseif swap_type == 'filtered_action' and command_registry[ts] and command_registry[ts].cancel_spell then
storedcommand = nil
command_registry:delete_entry(ts)
return true
elseif swap_type == 'midcast' and _settings.demo_mode then
command_registry[ts].midaction = false
equip_sets('aftercast',ts,val1)
elseif swap_type == 'aftercast' then
if ts then
command_registry:delete_entry(ts)
end
elseif swap_type == 'pet_aftercast' then
if ts then
command_registry:delete_entry(ts)
end
end
end
end
-----------------------------------------------------------------------------------
--Name: user_pcall(str,val1,val2,exit_funct)
--Desc: Calls a user function, if it exists. If not, throws an error.
--Args:
---- str - Function's key in user_env.
-----------------------------------------------------------------------------------
--Returns:
---- none
-----------------------------------------------------------------------------------
function user_pcall(str,...)
if user_env then
if type(user_env[str]) == 'function' then
bool,err = pcall(user_env[str],...)
if not bool then error('\nGearSwap has detected an error in the user function '..str..':\n'..err) end
elseif user_env[str] then
msg.addon_msg(123,windower.to_shift_jis(tostring(str))..'() exists but is not a function')
end
end
end
-----------------------------------------------------------------------------------
--Name: pretarget_delayed_cast(ts)
--Desc: Triggers an outgoing action packet (if the passed key is valid).
--Args:
---- ts - Timestamp argument to precast_delayed_cast
-----------------------------------------------------------------------------------
--Returns:
---- none
-----------------------------------------------------------------------------------
function pretarget_delayed_cast(ts)
ts = tonumber(ts)
if ts then
equip_sets('precast',ts,command_registry[ts].spell)
else
msg.debugging("Bad index passed to pretarget_delayed_cast")
end
end
-----------------------------------------------------------------------------------
--Name: precast_send_check(ts)
--Desc: Determines whether or not to send the current packet.
-- Cancels if _global.cancel_spell is true
-- If command_registry[ts].precast_cast_delay is not 0, cues precast_delayed_cast with the proper
-- delay instead of sending immediately.
--Args:
---- ts - key of command_registry
-----------------------------------------------------------------------------------
--Returns:
---- true (to block) or the outgoing packet
-----------------------------------------------------------------------------------
function precast_send_check(ts)
if ts and command_registry[ts] then
if command_registry[ts].cancel_spell then
command_registry:delete_entry(ts)
else
if command_registry[ts].precast_cast_delay == 0 then
send_action(ts)
return
else
windower.send_command('@wait '..command_registry[ts].precast_cast_delay..';lua i '.._addon.name..' precast_delayed_cast '..ts)
end
end
end
return true
end
-----------------------------------------------------------------------------------
--Name: precast_delayed_cast(ts)
--Desc: Triggers an outgoing action packet (if the passed key is valid).
--Args:
---- ts - Timestamp argument to precast_delayed_cast
-----------------------------------------------------------------------------------
--Returns:
---- none
-----------------------------------------------------------------------------------
function precast_delayed_cast(ts)
ts = tonumber(ts)
if ts then
send_action(ts)
else
msg.debugging("Bad index passed to precast_delayed_cast")
end
end
-----------------------------------------------------------------------------------
--Name: send_action(ts)
--Desc: Sends the cued action packet, if it exists.
--Args:
---- ts - index for a command_registry entry that includes an action packet (hopefully)
-----------------------------------------------------------------------------------
--Returns:
---- none
-----------------------------------------------------------------------------------
function send_action(ts)
command_registry[ts].midaction = true
equip_sets('midcast',ts,command_registry[ts].spell)
end
Here is the user-global
Code Rings = S{'Capacity Ring', 'Warp Ring', 'Trizek Ring', 'Expertise Ring', 'Emperor Band', 'Caliber Ring', 'Echad Ring', 'Facility Ring'}
sets.reive = {neck="Ygnas's Resolve +1"}
sets.crafting = { body="Alchemist's Apron", sub="Brewer's Scutum", head="Midras's Helm +1", main="Caduceus", neck="Alchemist's Torque", ring1="Craftmaster's ring", ring2="Orvail Ring" }
equip_lock = S{
"Warp Ring",
"Capacity Ring",
"Vocation Ring",
"Trizek Ring",
"Endorsement Ring"
}
function user_handle_equipping_gear(status, eventArgs)
if equip_lock:contains(player.equipment.right_ring) then
disable('ring2')
else
enable('ring2')
end
end
function user_post_precast(spell, action, spellMap, eventArgs)
-- reive mark
if spell.type:lower() == 'weaponskill' then
if buffactive['Reive Mark'] then
equip(sets.reive)
end
end
end
function user_post_aftercast(spell, action, spellMap, eventArgs)
if spell.type:lower() == 'weaponskill' then
send_command('wait 1; input /echo ---------------- TP <tp> ----------------')
end
end
function user_customize_melee_set(meleeSet)
if buffactive['Reive Mark'] then
meleeSet = set_combine(meleeSet, sets.reive)
end
return meleeSet
end
function user_customize_idle_set(idleSet)
if buffactive['Reive Mark'] then
idleSet = set_combine(idleSet, sets.reive)
end
return idleSet
end
function user_buff_change(buff, gain, eventArgs)
-- Sick and tired of rings being unequip when you have 10,000 buffs being gain/lost?
if not gain then
if Rings:contains(player.equipment.ring1) or Rings:contains(player.equipment.ring2) then
eventArgs.handled = true
end
end
end
function is_sc_element_today(spell)
if spell.type ~= 'WeaponSkill' then
return
end
local weaponskill_elements = S{}:
union(skillchain_elements[spell.skillchain_a]):
union(skillchain_elements[spell.skillchain_b]):
union(skillchain_elements[spell.skillchain_c])
if weaponskill_elements:contains(world.day_element) then
return true
else
return false
end
end
Necro Bump Detected!
[67 days between previous and next post]
By Mcdougall 2019-09-08 00:08:04
Still getting the above error... any help please.. everything appears to be working just anoying that it keeps popping up on the screen
By Mcdougall 2019-09-08 06:14:23
I dont know if this will help.. it seems everytime i use a food it does it.. or any item rings etc.
Ragnarok.Flippant
Server: Ragnarok
Game: FFXI
Posts: 660
By Ragnarok.Flippant 2019-09-08 12:12:48
You could change the checks on lines 22 and 30 to
Code if type(spell.type)=="string" and spell.type:lower() == 'weaponskill' then
Everytime i load my lua's i get this error
gearwap: lua runtime error: gearswap/refresh.lua:173: gearswap: file failed to load: .........windoweraddons/libs/funcitons.lua:7:
Gearswap: cannot find the include file string.lua.
Everything appears to be working.. but this is getting annoying... Any help please...
refresh.lua 169-177 Code -- Verify that funct contains functions.
local status, plugin = pcall(funct)
if not status then
error('GearSwap: File failed to load: \n'..plugin)
gearswap_disabled = true
sets = nil
return nil
end
Functions.lua line 7
Code local string, math, table, coroutine = require('string'), require('math'), require('table'), require('coroutine')
and yes there's a strings.lua inside my lib folder
|
|