Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Strive for Power

Fantasy Slave Management/RPG Erotic Game · By Strive4Power

Alchemy lab minor errors

A topic by Leonais created May 30, 2019 Views: 240 Replies: 1
Viewing posts 1 to 2
(1 edit)

When you re-enter the alchemy lab (just click the alchemy room tab at the bottom of the mansion) the variable potselected appears to be reset and the potion list hidden,  but the brew UI is still there and possibly enabled. If you click to brew or change the count you can get some errors. The following change seemed to work but I expect there's a much more elegant fix.

func _on_alchemy_pressed():
    potselected = null

func _on_brewcounter_value_changed( value ):
    if potselected != null && typeof(potselected) != 4:
        brewlistpressed(potselected)

I've no idea what that typeof clause is doing!

(1 edit)

Sometimes the default value is null and sometimes it's '' (empty string).  There is an issue with inconsistent usage of default values, but it shouldn't have caused error messages if the GUI was correct.

Adding this line to the end of _on_alchemy_pressed() will disable the "Brew" button until a new potion is selected and the ingredients are checked.
          get_node("MainScreen/mansion/alchemypanel/brewbutton").set_disabled(true)

typeof() returns the current type of the variable using the enum values found in this link:
https://docs.godotengine.org/en/3.1/classes/class_@globalscope.html#enum-globals...
Someone was lazy and left a 4 instead of TYPE_STRING. They are equivalent, but the latter is more clear.

Your changes to the default value usage are a valid way to stop the error messages. Though "&& typeof(potselected) != 4" could be removed as it was checking that potselected was not the default value of ''.

The faster way to fix the default value usage would be to change the first condition in _on_brewbutton_pressed() to compare against '' instead of null, but I prefer using a null default value as it is much more clear.