Hornete Posted May 3, 2019 Share Posted May 3, 2019 (edited) Hello! again forums... hehe I come here too often, Anyhow i'm trying to port Wheeler over and I'm having trouble with the slots that pop up when holding the pew matic horn or navigadget. Quote [00:02:08]: [string "scripts/widgets/image.lua"]:8: assertion failed! LUA ERROR stack traceback: =[C]:-1 in (global) assert (C) <-1--1> scripts/widgets/image.lua:8 in (field) _ctor (Lua) <3-15> self = enabled = true focus_target = false shown = true can_fade_alpha = true focus_flow_args = table: 7DE867A0 inst = 113629 - (valid:true) focus = false focus_flow = table: 7DE86B10 name = Image children = table: 7DE85F30 callbacks = table: 7DE85E40 atlas = nil tex = inv_slot.tex default_tex = nil scripts/class.lua:181 in (upvalue) Image (Lua) <171-184> class_tbl = table: 16E86EB0 arg = nil obj = Image - : scripts/widgets/itemslot.lua:8 in (field) _ctor (Lua) <5-13> self = enabled = true focus_target = false shown = true owner = 113615 - trusty_shooter(LIMBO) (valid:true) can_fade_alpha = true focus_flow_args = table: 7DE86110 inst = 113628 - (valid:true) focus = false focus_flow = table: 7DE85800 name = ItemSlot children = table: 7DE855D0 callbacks = table: 7DE85788 atlas = nil bgim = inv_slot.tex owner = 113615 - trusty_shooter(LIMBO) (valid:true) ../mods/Wheeler/scripts/widgets/specialslot.lua:5 in (field) _ctor (Lua) <4-12> self = enabled = true focus_target = false shown = true owner = 113615 - trusty_shooter(LIMBO) (valid:true) can_fade_alpha = true focus_flow_args = table: 7DE86110 inst = 113628 - (valid:true) focus = false focus_flow = table: 7DE85800 name = ItemSlot children = table: 7DE855D0 callbacks = table: 7DE85788 atlas = nil bgim = inv_slot.tex owner = 113615 - trusty_shooter(LIMBO) (valid:true) scripts/class.lua:181 in (upvalue) SpecialSlot (Lua) <171-184> class_tbl = table: 804648C0 arg = nil obj = ItemSlot ../mods/Wheeler/modmain.lua:104 in (method) AddSpecialSlot (Lua) <103-111> self = hudcompass = Hud Compass shown = true actionstringtitle = Text - controller_build = false GetSpecialSlot = function - ../mods/Wheeler/modmain.lua:97 repeat_time = 0 bg = Image - images/hud.xml:inventory_bg.tex enabled = true in_pos = (0.00, 102.00, 0.00) actionstringtime = -0.013494437560439 root = root bgcover = Image - images/hud.xml:inventory_bg_cover.tex inspectcontrol = BUTTON inv = table: 1710BC28 name = Inventory focus_flow = table: 84C76048 toprow = toprow AddSpecialSlot = function - ../mods/Wheeler/modmain.lua:103 out_pos = (0.00, 68.00, 0.00) autoanchor = WorldResetTimer callbacks = table: 84C75A58 reps = 0 parent = bottom_scale_root openhint = Text - inst = 112182 - (valid:true) focus = false equip = table: 1710B930 bottomrow = toprow children = table: 84C759E0 current_list = table: 1710BC28 focus_flow_args = table: 84C75F30 focus_target = false SetSpecialSlotFn = function - ../mods/Wheeler/modmain.lua:113 selected_scale = 0.8 equipslotinfo = table: 84C76520 owner = 111955 - wheeler (valid:true) actionstring = actionstring can_fade_alpha = true force_single_drop = false special_slots = table: 80464F28 base_scale = 0.6 active_slot = ItemSlot backpackinv = table: 1710B958 hint_update_check = 0.73331528529525 actionstringbody = Text - slotkey = trusty_shooter owner = 113615 - trusty_shooter(LIMBO) (valid:true) ../mods/Wheeler/scripts/prefabs/trusty_shooter.lua:88 in (upvalue) CheckSpecialSlotStatus (Lua) <86-91> inst = 113615 - trusty_shooter(LIMBO) (valid:true) player = 111955 - wheeler (valid:true) ../mods/Wheeler/scripts/prefabs/trusty_shooter.lua:101 in (field) fn (Lua) <100-107> scripts/scheduler.lua:177 in (method) OnTick (Lua) <155-207> self = running = table: 3EDEA808 waitingfortick = table: 3EDEA880 tasks = table: 3EDEA600 waking = table: local ItemSlot = require "widgets/itemslot" local ItemTile = require "widgets/itemtile" local SpecialSlot = Class(ItemSlot, function(self, atlas, bgim, owner) ItemSlot._ctor(self, atlas, bgim, owner) self.owner = owner self.highlight = false self.bg = self:AddChild(Image("images/hud.xml", "inventory_bg_cover.tex")) --inventory_bg_single --self.bg:SetScale(0.9) self.bg:MoveToBack() end) function SpecialSlot:Click() if self.onclickfn then self.onclickfn(self) end self:OnControl(CONTROL_ACCEPT, true) end function SpecialSlot:OnControl(control, down) if self.oncontrolfn then self.oncontrolfn(self, control, down) else print ("NO CONTROLFN FOUND ON SPECIAL SLOT") end end function SpecialSlot:OnItemGet(item) if not item then print ("ERROR! SOMEHOW THE ITEM RECEIVED BECAME NIL, PLEASE REPORT") print (debugstack()) return end if self.onitemgetfn then self.onitemgetfn(self, item) end local tile = ItemTile(item) self:SetTile(tile) tile:Show() end function SpecialSlot:OnItemLose() if self.onitemlosefn then self.onitemlosefn(self) end self:SetTile(nil) end return SpecialSlot This is one of my widgets. AddClassPostConstruct("widgets/inventorybar", function(self) local SpecialSlot = require "widgets/specialslot" self.special_slots = {} function self:GetSpecialSlot(slotkey) if self.special_slots[slotkey] then return self.special_slots[slotkey].inst end end function self:AddSpecialSlot(slotkey, owner) self.special_slots[slotkey] = {inst = self.toprow:AddChild(SpecialSlot(HUD_ATLAS, "inv_slot.tex", owner)), owner = owner } --self.special_slot = self.toprow:AddChild(SpecialSlot(HUD_ATLAS, "inv_slot.tex", self.owner)) local pos = self.equip[EQUIPSLOTS.HANDS]:GetPosition() self.special_slots[slotkey].inst:SetPosition(pos.x, pos.y + 95, pos.z) self.special_slots[slotkey].inst:MoveToBack() end function self:SetSpecialSlotFn(slotkey, clickfn, oncontrolfn, onitemgetfn, onitemlosefn) if not self.special_slots[slotkey] then print ("ERROR! TRYING TO SET UP A NON EXISTENT SPECIAL SLOT") return end self.special_slots[slotkey].clickfn = clickfn self.special_slots[slotkey].inst.clickfn = clickfn self.special_slots[slotkey].oncontrolfn = oncontrolfn self.special_slots[slotkey].inst.oncontrolfn = oncontrolfn self.special_slots[slotkey].onitemgetfn = onitemgetfn self.special_slots[slotkey].inst.onitemgetfn = onitemgetfn self.special_slots[slotkey].onitemlosefn = onitemlosefn self.special_slots[slotkey].inst.onitemlosefn = onitemlosefn end end) And this is the Classpostconstruct I have, my pew matic horn calls the AddSpecialSlot but then crashes because the assertion failed. Thanks for reading! Literally just figured this out minutes after I posted this, @ImDaMisterL Feel free to delete/hide this. Edited May 3, 2019 by Omaremad74 Link to comment https://forums.kleientertainment.com/forums/topic/105651-assertion-failedsolved/ Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now