I've been struggling with the GUI modding code. Everytime I use the position field when adding a new element I receive the below error upon opening a game.
Unknown position: ontherightofthegoal
What am I doing wrong? According to the wiki this is the only supported position at the moment.
GUI - Unknown Position Error
GUI - Unknown Position Error
Factorio Modder
Solar Expansion
Solar Expansion
Re: GUI - Unknown Position Error
Oups, I'm sorry I didn't update this part of wiki.
From 0.4 version, it works differently, there is always gui.top, gui.left, gui.center.
These are flows and you can add to it/ remove from it, the position is not needed.
https://forums.factorio.com/wiki/index.php/Lua/Gui
https://forums.factorio.com/wiki/inde ... lement#add
From 0.4 version, it works differently, there is always gui.top, gui.left, gui.center.
These are flows and you can add to it/ remove from it, the position is not needed.
https://forums.factorio.com/wiki/index.php/Lua/Gui
https://forums.factorio.com/wiki/inde ... lement#add
Re: GUI - Unknown Position Error
Thanks! The wiki is extremely limited and vague so it forces a lot of trial and error to get things working.
Also, I cannot seem to get my frame looking decent. How can I format the text to be centered in the frame?
Also, I cannot seem to get my frame looking decent. How can I format the text to be centered in the frame?
Code: Select all
game.oninit(function()
game.player.gui.top.add{type="frame", name="coordioFrame", caption="Coordinates", direction="vertical"}
game.player.gui.top.coordioFrame.add{type="label", name="coordinates"}
end)
game.onevent(defines.events, function(event)
if event.name == defines.events.ontick then
x = math.floor(game.player.character.position.x)
y = math.floor(game.player.character.position.y)
game.player.gui.top.coordioFrame.coordinates.caption = x .. ", " .. y
end
end)
Factorio Modder
Solar Expansion
Solar Expansion
Re: GUI - Unknown Position Error
And how do I make the frame longer???
My text gets cut off.
My text gets cut off.
Factorio Modder
Solar Expansion
Solar Expansion
Re: GUI - Unknown Position Error
Also... unsure if this is a bug...
When I create a new game the size of the frame is super skinny and doesn't allow all the text to be displayed. When I save and close the frame reformats to the correct size. And then... if I change the code of the mod, such as what the caption of the actual frame is that is not updated in the saved game when I load it.
When I create a new game the size of the frame is super skinny and doesn't allow all the text to be displayed. When I save and close the frame reformats to the correct size. And then... if I change the code of the mod, such as what the caption of the actual frame is that is not updated in the saved game when I load it.
Factorio Modder
Solar Expansion
Solar Expansion
Re: GUI - Unknown Position Error
This seems like buggy behavior, I will take a look at it.