- Jan 1, 2023
- 33
- 4
i have the list edible items
$ Eat = {
"item_spizza": 3,
"item_sandw": 2,
"itemburger": 1
this button
textbutton ("EAT"):
action [ eat_item(selected_item), Function(whichitem.toss, amount), SetVariable("selected_item", None), Hide("buying") ]
stats
init python:
global hunger
hunger_increase = 0
hunger = 10 if 10 >= 0 and 10 <= 100 else 0
def eat_item(item):
global hunger
if item in Eat:
hunger_increase = Eat[item]
hunger = min(100, hunger + hunger_increase)
now it is the case that when i move the mouse over the button it counts up with 1.
the problem i have is that i can't get it to take the items from the list with their values. i tried it with label and just $ hunger but i want the selected item to be eaten. but it just doesn't work
$ Eat = {
"item_spizza": 3,
"item_sandw": 2,
"itemburger": 1
this button
textbutton ("EAT"):
action [ eat_item(selected_item), Function(whichitem.toss, amount), SetVariable("selected_item", None), Hide("buying") ]
stats
init python:
global hunger
hunger_increase = 0
hunger = 10 if 10 >= 0 and 10 <= 100 else 0
def eat_item(item):
global hunger
if item in Eat:
hunger_increase = Eat[item]
hunger = min(100, hunger + hunger_increase)
now it is the case that when i move the mouse over the button it counts up with 1.
the problem i have is that i can't get it to take the items from the list with their values. i tried it with label and just $ hunger but i want the selected item to be eaten. but it just doesn't work