So I'm implementing a store with my own version of a Tooltip with some extended functionality. I have a screen that I created that will show the stats that an item has when the player moves his mouse over a textbutton that I have created. So I have the screen change its values whenever a hovered event occurs, but it will only update whenever I call an interact function which can only happen at the end because otherwise the game will crash (you can't interact in an interact, or so I'm told.)
Some source code:
Code: Select all
def showIngredientScreen(ingredient):
#have to do this cause currentIngredient = ingredient doesn't work
currentIngredient.name = ingredient.name
currentIngredient.cost = ingredient.cost
currentIngredient.healthiness = ingredient.healthiness
currentIngredient.taste = ingredient.taste
currentIngredient.speed = ingredient.speed
currentIngredient.creativity = ingredient.creativity
currentIngredient.quality = ingredient.quality
renpy.show_screen("ingredientScreen");
....
if(storeType == "Buy"):
ui.at(Move((1.0, 0.0, .5,.0), (0.0, 0.0,.0,.0), 0.5))
ui.frame()
ui.text("{size=+18}Please select an item::{/size}")
ui.at(Move((1.0, 0.7, .5,1.0), (0.0, 0.7,.0,1.0), 0.5))
ui.side(['c', 'b', 'r'], spacing=5)
vp = ui.viewport(xmaximum=400, ymaximum=400, mousewheel = True)
ui.vbox()
for element in paulStoreItems:
ui.textbutton(element.name, clicked=ui.returns(element),hovered=showIngredientScreen(element), xminimum = 400)
ui.textbutton("Nevermind", clicked=ui.returns("goback"))
ui.close()
ui.bar(adjustment=vp.xadjustment, style='scrollbar')
ui.bar(adjustment=vp.yadjustment, style='vscrollbar')
ui.close()
result = ui.interact()