This is kinda a symptom of me trying to call and jump to labels for changing the variables in my game, and a lot of my problems would be solved if i can change variables with button clicks.
Here is the current messy code:
Code: Select all
screen inventorybutton:
vbox:
xalign 0.0
yalign 0.5
spacing 4
textbutton "Inventory":
action ShowMenu("inventory_screen")
#action [Call ("inventoryactivation")]
label inventoryactivation:
show screen inventory_screen
hide screen inventorybutton
window hide### disables the dialogue
#pause###
style inventory_label:
xalign 0.2
label healthpotionuse:
$itemamounthealthpotion -= 1
$playerhealth += 30
window hide
pause
jump nothinguse
return
label manapotionuse:
$itemamountmanapotion -= 1
$playermana += 30
window hide
pause
jump nothinguse
return
label nothinguse:
return
screen inventory_screen:
default tooltiptext = Tooltip("")
default tooltipx = Tooltip(0)
default tooltipy = Tooltip(0)
vbox:
xmaximum 300
ymaximum 300
spacing 10
xalign 0.5
yalign 0.1
label "Items"
viewport id "vp":
child_size (500,300)
scrollbars True
draggable True
xpos 950
ypos 150
add "white"
vbox:
xmaximum 300
ymaximum 300
spacing 10
xalign 0.57
yalign 0.15
if itemamounthealthpotion > 0:
textbutton "Health Potions [itemamounthealthpotion]x":
action [Call ("healthpotionuse"),ShowMenu("inventory_screen")]
#action [SetVariable(itemamounthealthpotion, itemamounthealthpotion-1)]
hovered tooltiptext.Action("Health Potion: Restores 30 Health")
if itemamountmanapotion > 0:
textbutton "Mana Potions [itemamountmanapotion]x":
action [Call ("manapotionuse"),ShowMenu("inventory_screen")]
#action [SetVariable(itemamountmanapotion, itemamountmanapotion-1)]
hovered tooltiptext.Action("Mana Potion: Restores 30 Mana")
label "extra"
label "extra1"
label "extra2"
label "extra3"
label "extra4"
label "extra5"
textbutton "Return":
action [hide_inventory]
#action Return()
xalign 0.5
yalign 0.95
hovered tooltiptext.Action("Exit")