Spell Pack

by OwnlyMe

New useful abilities

Utilities
3 years ago
0.16 - 0.18
18

b Mod fails to load + GUI related crash

4 years ago

Mod cannot load certain icons because of case mismatch in file extension, i.e. mod tries to find * .png but file is *.PNG or other way around. Easily fixed locally by making everything lowercase.

For the GUI I urge you NOT to use absurdly large margins as hacks for anything like "moving" the GUI to the top right. By pressing ctrl+f5 and ctrl+f6 to toggle GUI debug and style view it becomes much more obvious what your GUI really looks like.

The problem is that you're not really moving the GUI anywhere with this, you're only making the GUI very BIG by adding unused space, as left_margin adds unused space to the left. Even if it may look good, this unused space still belongs to your GUI as part of your whole GUI and this causes problems for any GUI that comes AFTER (e.g. autoresearch GUI) because of the horizontal_flow style. And since yours uses up almost all of the remaining horizontal screen resolution that GUI will look incredibly ugly and will almost certainly not fit which causes an even uglier scroll bar to appear out of nowhere, crashing your mod on the very next on_nth_tick.

Don't patch your hack, you'll go insane. You're manually calculating how much empty space there is in a GUI that is different for everyone, to use for manually "positioning" your GUI using a method that doesn't in any way change the actual position. These things need to happen automatically, you're relying on countless assumptions otherwise. Have you already tried a progressbar for mana and spirit like the one used for health and personal shield? I'm no modder myself but it seems very appropriate to me. Maybe the exact mana/max mana can be displayed inside the progress bar printed ontop. If that doesn't look good just printing those values anywhere without being fancy seems good enough. Seems nice to know what your max mana is, but maybe it's fine even without.

Really love your mod by the way, really improves the QoL in the early parts of the game in a very interesting and fun way without blatant cheating. Thank you very much!

4 years ago
(updated 4 years ago)

i see, something with auto-research screws up my width calculation..
It's impossible to use the health/shield bar for my mana/spirit
The only alternative would be to draw it into the game like under the character.
Or to put it on the left side gui...
But both alternatives wouldn't look very good.
The gui constantly refreshes to make sure it's the last gui on the top and positioned as close to the center as possible.
Maybe i could make the bars thicker to print the values inside
i'll change the filenames but that error is really weird, i never had that problem...
i'm glad you enjoy the mod, i spent a lot of time on it

edit: it doesn't look like the auto research gui is meant to be active all the time since it pushes the left side gui down by a lot
i set a fixed value for the auto research gui so your manabars should be perfectly centered now.

4 years ago
(updated 4 years ago)

new version is online, everything should be fixed now.
edit: hmm i think i'll upload another version in 1 hour, i'll also change the appearance of the bars and rebalance the fireball

4 years ago

It fails to load because, among others, it couldn't find the icon for blink inside \graphics\icons, because there is only "blink.PNG" and in SPELLS.lua you specified "blink.png". (line 15: icon = "blink.png",) To make it load all I did was rename the file inside the archive. That actually should have been the only one that failed because I made the assumption they all should have been lowercase and ended up editing the .lua to make it work again instead of renaming the files back to uppercase. Sorry for forgetting I did that myself, oops.

The mod that yours crashes on is Auto Research by canidae (https://mods.factorio.com/mod/auto-research)
When you toggle the GUI (default shortcut = Shift+T) it gets added to 'top' and ends up behind yours where it doesn't fit on the screen, creating a scrollbar. Your code seems to assume no scrollbar and crashes trying to reposition the GUI.

To prevent the crash from happening I replaced all lines inside estimate_width(gui) with "return 5". My GUI isn't quite 5 pixels wide, but it shrunk the massive left_margin of your GUI to something sane. Now everything works and it also no longer overlaps with the framerate counter as well. When I open the Autoresearch GUI now it doesn't crash anymore, and instead it instantly moves elsewhere at some point within a time certain interval. Very annoying because usually I open the thing because I need something from it. Personally I'd take something that works over something that looks slightly better. Bugs are ugly anyway so right now to me no left_margin or a tiny one looks much better.

4 years ago
(updated 4 years ago)

yeah on windows the case doesnt matter :D
you could change line 205 (on 1800th tick) to something more responsive, just not 10, 15 or 30.
for example 16.
The crash was due to my mod looking for the direction of child elements, which crashes when the element is no frame or flow. that scrollbar which appears does not cause any crashes..

4 years ago

there you go, new bars with the values inside^^

4 years ago

Seems I was wrong about blink.png being the only one, sorry. :(
"File not found: spell-pack/graphicsicons/red30.PNG"
This time I made sure that I only renamed the file instead of editing the lua, and the mod loaded with just that rename. Yeah I'm getting the hang of this :p

The new bars look pretty nice and also they stand out a bit more. Good improvement imo, maybe now I won't forget to cast spells as much anymore. The large margin is still there, but now it longer overlaps with the FPS/UPS counter and the Auto Research fits without ugly scrollbars. And it seems to work without crashing even when I use another mod to make the bar appear again, or on my machine at least... (which is running windows too btw) ... and for now. :p

Gonna go and cast some spells now if you'll excuse me.

Thanks for updating!

4 years ago
(updated 4 years ago)

Ahhh i see.. missed one ;)

4 years ago

I added an event for when you toggle the auto-research gui.
it should now reposition immediately.

New response