Jump to content

Search the Community

Showing results for tags 'widget'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Hot Lava
    • [Hot Lava] - General Discussion
    • [Hot Lava] - Suggestions and Feedback
    • [Hot Lava] - Bug Tracker
    • [Hot Lava] - Strats and Records
    • [Hot Lava] - Developer Log
    • Hot Lava Latest Update
  • Griftlands
    • [Griftlands] - General Discussion
    • [Griftlands] - Suggestions and Feedback
    • [Griftlands] - Mods and Tools
    • [Griftlands] - Localization
    • [Griftlands] - Bug Tracker
    • [Griftlands] - Developer log
  • Oxygen Not Included
    • Oxygen Not Included FAQ
    • [Oxygen Not Included] - Developer log
    • [Oxygen Not Included] - General Discussion
    • [Oxygen Not Included] - Bug Tracker
    • [Oxygen Not Included: Spaced Out!] - Bug Tracker
    • [Oxygen Not Included] - Mods and Tools
    • [Oxygen Not Included] - Suggestions and Feedback
    • [Oxygen Not Included] Art, Music & Lore
    • Community Challenges
    • [Oxygen Not Included] - Latest Content Update
    • [Oxygen Not Included] - Latest Animated Short
    • Oxygen Not Included DLC Alpha
  • Don't Starve Together
    • Don't Starve Together FAQ
    • [Don't Starve Together] Developer log
    • [Don't Starve Together] General Discussion
    • [Don't Starve Together] Beta Branch
    • [Don't Starve Together] PlayStation
    • [Don't Starve Together] Xbox One
    • [Don't Starve Together] Nintendo Switch
    • [Don't Starve Together] Bug Tracker
    • [Don't Starve Together] Trading
    • [Don't Starve Together] Server Bulletin
    • [Don't Starve Together] Dedicated Server Discussion
    • [Don't Starve Together] Mods and Tools
    • [Don't Starve Together] Tales of Life and Death
    • [DS + DST] Art, Music and Lore
    • [Don't Starve Together] Suggestions and Feedback
    • [Don't Starve Together] The Forge
    • [Don't Starve Together] The Gorge
    • [Archived Bugs]
  • Don't Starve
    • Don't Starve FAQ
    • [Don't Starve: Pocket Edition] iOS / Android
    • [Don't Starve] General Discussion
    • [Don't Starve] Mods and tools
    • [Don't Starve] Art, Music & Lore
    • [Don't Starve] Suggestions and Feedback
    • [Don't Starve] Videos
    • [Don't Starve] Bug Tracker
    • [Don't Starve] Trading
    • [Don't Starve] Testing Discussion (archive)
  • Klei Entertainment Games
    • Eets Munchies
    • [Invisible, Inc.] General Discussion and Strategies
    • Mark of the Ninja
    • Shank
  • Other Stuff
    • Other Klei Services

Categories

  • Don't Starve
    • Custom Characters
    • Game Modifications
    • Language Packs
    • Modding Tools, Tutorials & Examples
    • Custom Maps

Categories

  • Oxygen Not Included
  • Oxygen Not Included: Spaced Out!
  • Griftlands
  • Don't Starve: Hamlet
  • Don't Starve: Hamlet Early Access
  • Don't Starve Together
  • Don't Starve Together: Beta Branch
  • [Don't Starve Together] Nintendo Switch
  • [Don't Starve Together] PlayStation
  • Don't Starve Together: Return of Them
  • Don't Starve Together: The Gorge
  • Don't Starve Together: The Forge
  • Don't Starve Together: The Forge (Archive)
  • [Don't Starve Together] Xbox One
  • Don't Starve: Shipwrecked
  • Don't Starve: Shipwrecked [archive]
  • [Don't Starve Together] PS4 (archive)
  • [iOS] Don't Starve: Shipwrecked
  • Don't Starve: Hamlet Closed Beta (ARCHIVE)

Categories

  • Oxygen Not Included
  • Oxygen Not Included: Spaced Out!
  • Griftlands
  • Hot Lava
  • Don't Starve Together
  • [Nintendo Switch] Don't Starve Together
  • [PlayStation] Don't Starve Together
  • [Xbox One] Don't Starve Together
  • Don't Starve: Hamlet
  • Don't Starve: Shipwrecked

Categories

  • Hot Lava - Bug Reports

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Biography


Location


Interests


Occupation


Favorite Game


Modder


Chester Kickstarter


Chester Kickstarter


Chester Kickstarter


Chester Kickstarter


Chester Kickstarter


Klei Featured Artist


Early Supporter


Early Supporter


Don't Starve


Don't Starve Together


Oxygen Not Included

Found 10 results

  1. I'm trying to make the absolute simplest widget to start my project, all I want is to display the meatballs sprite on a corner of the screen - this will be part of a server-based mod if that matters. This is what I've copy-catted out of Food Memory modmain.lua local require = GLOBAL.require local CravingDisplay = require "widgets/cravingdisplay" local function AddCravingDisplay(controls) controls.top_root(CravingDisplay(inst)) end AddClassPostConstruct( "widgets/controls", AddCravingDisplay ) scripts/widgets/cravingdisplay.lua local Widget = require "widgets/widget" local Image = require "widgets/image" local CravingDisplay = Class(Widget,function(self, owner) Widget._ctor(self,"CravingDisplay") --this part is a background box self.cravingdisp = self:AddChild(Image("images/frontend.xml", "button_square_halfshadow.tex")) self.cravingdisp_icon:SetPosition(-6,1) self.cravingdisp:SetScale(1,2,2) self.cravingdisp:SetTint(10,10,10,.5) self.cravingdisp:MoveToBack() --for the actual meatballs sprite self.cravingdisp_icon = self.cravingdisp:AddChild(Image("images/inventoryimages.xml","meatballs.tex")) self.cravingdisp_icon:SetPosition(-6,1) self.cravingdisp_icon:SetScale(1,.5,.5) end) return CravingDisplay *this forum is being poopy and won't let me edit this code, my final settings for position are (-600, -40) on the box. EDIT: My problem was that the meatballs sprite wasn't showing up. In the mod I was copying from it had a static reference from inventoryimages1.xml (where someone just told me meatballs used to be) in the setup, but in runtime the mode uses a dynamic reference from the meatballs prefab, thus why it worked there and not in mine. I've adjusted it to where meatballs.tex has moved to (inventoryimages.xml) and it's working great.
  2. Hello, so I am trying to make a meter widget akin to Woodie's Wereness meter, except it only raises when my character eats any kind of meat. After it fills, he "transforms" into a feral state with modified stats and such and the meter slowly drains when he's not eating meat at a gradual rate, similar to Wigfrid's inspiration meter. The actual problem I'm having currently is getting the meter to even show up in-game. I am using graphics and code from the wetness meter as a placeholder until I get the code working, but even after setting up the files in the (seemingly) correct folders the meter just doesn't appear in-game. My widgets folder is under scripts/widgets/inhumanitymeter.lua, while the placeholder graphics were put under Garamonde/exported/inhumanity_meter. Here are also my .LUA files for the component and widget, if that helps. If anything else is needed, please let me know! inhumanitymeter.lua inhumanity.lua
  3. i create containers widgets all work fine but when i try eat food inside game crash [00:01:06]: [string "scripts/components/container_replica.lua"]:209: attempt to index field 'inventoryitem' (a nil value) writing crash with container replica but i use in script local function OnEntityReplicated(inst) if inst.replica.container ~= nil then inst.replica.container:WidgetSetup(inst.prefab) end end
  4. Feature: I was able to figure out a command that allows the player to say how many days are left for a WX's overcharge to run out. Proof of concept If it's just yourself, you can use this command to let an overcharged WX say how many days are left. ThePlayer.components.talker:Say(tostring(ThePlayer.charge_time/480 .. " days until overcharge runs out")) If it's another player, you can use these two commands to make that specific player say how many days are left for their overcharge. The first command is to get the player list, the second is to make them talk. --This command outputs the numbers associated with players in the in-game chat, since for me, c_listallplayers() does not produce an output if caves are enabled. for i, v in ipairs(AllPlayers) do TheNet:SystemMessage(tostring(i) .. ": " .. v.name, false) end --The overcharge information that the selected player will say, where # is replaced by that character's number. AllPlayers[#].components.talker:Say(tostring(AllPlayers[#].charge_time/480 .. " days until overcharge runs out")) Problem: The issue is that you need to be admin to run these commands, which is inconvenient and not always possible. What I would have liked to have done is to turn this concept into a client-side mod so that this information is displayed on a widget/badge instead it being limited to an admin command. However, when I looked at some other UI mods (nightmare phase indicator, Combined status mod, woodie's beaver timer), I could not wrap my head on how to implement this as I have only extremely basic coding skills. Hence why I'm making this mod request. Thanks! Inspiration for this came from *CarlZalph's post here about how long WX's overcharge lasts under its current recursive function as well as some Mosling shenanigans I was doing.
  5. Hi, I was wondering if it's possible to put a widget setup in its own file instead of putting it on modmain.lua? Here is the example I'm talking about: -------------------------------------------------------------------------- --[[ compost_box ]] -------------------------------------------------------------------------- _G = GLOBAL local params={} params.compost_box = { widget = { slotpos = {}, animbank = "ui_chest_3x3", animbuild = "ui_chest_3x3", pos = _G.Vector3(0, 200, 0), side_align_tip = 160, }, type = "chest", } for y = 2, 0, -1 do for x = 0, 2 do table.insert(params.compost_box.widget.slotpos, _G.Vector3(80 * x - 80 * 2 + 80, 80 * y - 80 * 2 + 80, 0)) end end function params.compost_box.itemtestfn(container, item, slot) return (item.components.edible and item.components.perishable) or item.prefab == "spoiled_food" or item.prefab == "rottenegg" or item.prefab == "guano" or item.prefab == "poop" or item:HasTag("fresh") or item:HasTag("stale") or item:HasTag("spoiled") end local containers = _G.require "containers" containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, params.compost_box.widget.slotpos ~= nil and #params.compost_box.widget.slotpos or 0) local old_widgetsetup = containers.widgetsetup function containers.widgetsetup(container, prefab, data) local pref = prefab or container.inst.prefab if pref == "compost_box" then local t = params[pref] if t ~= nil then for k, v in pairs(t) do container[k] = v end container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0) end else return old_widgetsetup(container, prefab) end end -------------------------------------------------------------------------- --[[ crate_wooden ]] -------------------------------------------------------------------------- params.crate_wooden = { widget = { slotpos = {}, animbank = "ui_chest_5x12", animbuild = "ui_chest_5x12", pos = _G.Vector3(90, 220, 0), side_align_tip = 160, }, type = "chest", } for y = 4, 0, -1 do for x = 0, 11 do table.insert(params.crate_wooden.widget.slotpos, _G.Vector3(80 * x - 346 * 2 + 98, 80 * y - 100 * 2 + 42, 0)) end end function params.crate_wooden.itemtestfn(container, item, slot) if item.prefab == "chester_eyebone" then return false end return true end local containers = _G.require "containers" containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, params.crate_wooden.widget.slotpos ~= nil and #params.crate_wooden.widget.slotpos or 0) local old_widgetsetup = containers.widgetsetup function containers.widgetsetup(container, prefab, data) local pref = prefab or container.inst.prefab if pref == "crate_wooden" then local t = params[pref] if t ~= nil then for k, v in pairs(t) do container[k] = v end container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0) end else return old_widgetsetup(container, prefab) end end Would it be possible to somehow put it in its own separate file, so that it doesn't take up space in the modmain.lua file? Maybe using modimport or something else? Also if you know of any way to shorten the code above so that it's more compact that would be appreciated. Thank you.
  6. EDIT: I have solved my problem by using code of the following mod: Pickle It Hello guys, I just started modding and to train up and get to know the environment my first goal was to mod a chest that is self sorting. I am an experienced programmer (even though i only worked with C#/Java/PL-SQL before), but I cant really get the hang of LUA and how the different files work together. So far I have read the pinned guides, but they couldnt help me. Enough chitchat here is my Problem: I have a prefab which is called "sorter". Its basically the same code as in a treasurechest. Now I want to add an button to the chests widget. The button should be called "sort" and call an action that is defined in the modmain.lua. So far so good. I followed this Thread to add an button to my prefab. But i cant get it to work. The mod itself works, the game doesnt crash, but there is no button. no matter what. I've been trying for the last few hours to produce the button, but no matter what i googled and searched in this Forum i wasnt able to find a solution. You can find my source_code in the attached ZIP. For those who are too lazy to download the zip ill add the code as quote below this post. I hope you can help me and that the description of my problem was sufficient. Thank you, Narmor sorter.lua: require "prefabutil" local assets= { Asset("ANIM", "anim/sorter.zip"), } local function onopen(inst) inst.SoundEmitter:PlaySound("dontstarve/wilson/chest_open") inst.AnimState:PlayAnimation("open") end local function onclose(inst) inst.AnimState:PlayAnimation("closed") inst.SoundEmitter:PlaySound("dontstarve/wilson/chest_close") end local function onhammered(inst, worker) inst.components.lootdropper:DropLoot() inst.components.container:DropEverything() inst.SoundEmitter:PlaySound("dontstarve/common/destroy_metal") inst:Remove() end local function onhit(inst, worker) inst.AnimState:PlayAnimation("closed") inst.components.container:DropEverything() inst.components.container:Close() end local function onbuilt(inst) inst.AnimState:PlayAnimation("place") inst.AnimState:PushAnimation("closed") end local function itemtest(inst, item, slot) return true end local function EditContainer(inst) local self if TheWorld.ismastersim then self = inst.components.container else self = inst.replica.container end self:WidgetSetup("sorter") local function sortfn(inst) if TheWorld.ismastersim then BufferedAction(inst.components.container.opener, inst, ACTIONS.SORT):Do() else SendRPCToServer(RPC.DoWidgetButtonAction, ACTIONS.SORT.code, inst, ACTIONS.SORT.mod_name) end end local sort_buttoninfo = { text = "Sort", position = Vector3(0, -195, 0), fn = sortfn, } -- One buttoninfo per button self.widget.sorter_buttons = { sort_buttoninfo, } end local function fn(Sim) local inst = CreateEntity() inst:AddTag("structure") inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddNetwork() local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon( "sorter.tex" ) inst.AnimState:SetBank("sorter") inst.AnimState:SetBuild("sorter") inst.AnimState:PlayAnimation("closed", true) inst.entity:SetPristine() if not TheWorld.ismastersim then local _OnEntityReplicated = inst.OnEntityReplicated inst.OnEntityReplicated = function(inst) if _OnEntityReplicated then _OnEntityReplicated(inst) end EditContainer(inst) end return inst end inst:AddComponent("inspectable") inst:AddComponent("container") inst.components.container.itemtestfn = itemtest inst.components.container.onopenfn = onopen inst.components.container.onclosefn = onclose EditContainer(inst) inst:AddComponent("lootdropper") inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.HAMMER) inst.components.workable:SetWorkLeft(5) inst.components.workable:SetOnFinishCallback(onhammered) inst.components.workable:SetOnWorkCallback(onhit) return inst end return Prefab( "common/sorter", fn, assets), MakePlacer("common/sorter_placer", "sorter", "sorter", "closed") modmain.lua: local Spot = GetModConfigData("Spot") PrefabFiles = { "sorter", } Assets = { Asset( "IMAGE", "minimap/sorter.tex" ), Asset( "ATLAS", "minimap/sorter.xml" ), Asset("ATLAS", "images/inventoryimages/ui_chest_3x4.xml"), Asset("ATLAS", "images/inventoryimages/sorter.xml"), } AddMinimapAtlas("minimap/sorter.xml") STRINGS = GLOBAL.STRINGS RECIPETABS = GLOBAL.RECIPETABS Recipe = GLOBAL.Recipe Ingredient = GLOBAL.Ingredient TECH = GLOBAL.TECH GLOBAL.STRINGS.NAMES.SORTER = "Chest sorter" STRINGS.RECIPE_DESC.SORTER = "Put in your problems and they will be sorted out" GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.SORTER = "I like it" local sorter = GLOBAL.Recipe("sorter",{ Ingredient("cutstone", 1)}, RECIPETABS.TOWN, TECH.NONE, "sorter_placer" ) sorter.atlas = "images/inventoryimages/sorter.xml" ----------------------------------------------------------------------------------------------------------------------------------- -- widgetsetup for my prefab -- Not too shure what it does exactly, found it in another mod and it seems to work fine. local sorter = { widget = { slotpos = {}, animbank = "ui_chest_3x3", animbuild = "ui_chest_3x3", pos = GLOBAL.Vector3(0, 200, 0), side_align_tip = 160, }, type = "chest", } for y = 2, 0, -1 do for x = 0, 2 do table.insert(sorter.widget.slotpos, GLOBAL.Vector3(80 * x - 80 * 2 + 80, 80 * y - 80 * 2 + 80, 0)) end end local containers = GLOBAL.require("containers") containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, sorter.widget.slotpos ~= nil and #sorter.widget.slotpos or 0) local _widgetsetup = containers.widgetsetup function containers.widgetsetup(container, prefab, data) local pref = prefab or container.inst.prefab if pref == "sorter" then for k, v in pairs(sorter) do container[k] = v end container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0) else return _widgetsetup(container, prefab, data) end end ----------------------------------------------------------------------------------------------------------------------------------- -- Method for sorting the Stuff in the Sorter local function SortFn(act) --Methods Stub to be implemented later end AddAction("SORT", "Sort", SortFn) Sorter-Chest.rar
  7. Hello, does anyone knows how to control the z-index of a widget? I'm trying to get mine to show above a modded compass widget, but so far I've had no luck. I've tried with: inv_widget:SetPosition(0,0,100) inv_widget:SetPosition(0,0,-100) inv_widget:MoveToFront() But none of them have worked. Is it because they're in different roots? The modded compass one is in controls.bottomright_root, while mine is in a invslot (controls.bottom_root.inv.toprow.inv[N])
  8. Hello. I am trying to understand how to create a mod which does the following: Given the wonders I see/subscribe on Steam Workshop, it seems to be a simple job. The thing is that, although I have done the art, I'm not skilled enough at Lua, so I would like to request some support on this task, if possible. I don't even need the code to be written if by any chance I find some other mod to use as basis, or a widget tutorial, etc... But at the moment, the only mod I found that seems to be the closest of what I want to do is Too Many Items DST. Unfortunatelly, I could not understand how to extract only the basics of what I need. Thanks in advance.
  9. Say a custom object like chest and such is done and it has more container slots. Where does one look or starts to make a custom widget container? I have tried around containers.lua, which seemed very straight forward but when attempting something always seem to be wrong, as the error says that the widget was not declared. I assume something is missing, but not quite sure what?
  10. I'm testing out a stamina system I made for one of my characters. The stamina stat works so now I want to try and create a visualization for it. WIDGETS... I have no idea where I should start. Trying to find the beginning for figuring these things out so I can understand how to create one in the future. Tried searching for a widget guide but can't really find what I'm looking for. From their outward appearance they look complicated, but I bet they might be easier than I'm making them out to be. At any rate, where should I start for figuring these things out? Did anyone make a guide for widgets that I just seemed to overlook? Edit: Looking at the mod Always-On Status, I think I got them figured out, at least some of the basic parts of it. I managed to get what I want to show up. Edit 2: This is what I managed to come up with out of looking at Always-On Status The if true then is just there for me to replace with a config boolean to replace it later. But I think I figured it out generally well. Edit 3: Okay I figured out basic widgets (sorta) though I am quite curious as to how the badges handle their meter graphic going up and down. A new question, how would I make a widget that act's as a bar that fills up or empties depending on the variable it's referencing? I'm going to dig at the healthbadge and badges a bit for this info, but if anyone who's worked with them knows what does what, some guidance would be helpful.
×
×
  • Create New...