Hello, I'm new to MIT App Inventor and I need help with something, my problem is that whenever I press upgrade it doesn't do anything. It should take away the points, change the upgrade price... but it just isn't doing this. Earlier it worked but then I added some more things to saved between screens using TinyDB and now it doesn't work. When I got to Screen2 (Upgrades) then the points do transfer properly from Screen 1 to Screen 2 but I can't upgrade, Can somebody please help me?
Screen1:
Pressing the Upgrade button only changes the contents of the tinydb tags, it doesn't change anything you can see in the app - e.g. textboxes or labels that hold the information. So it will seem like nothing changes until you get to Screen "Upgrades" when you will see the Points textbox/label set to tinydb tag Points.
Thanks for the reply, so what do I have to change to make this work, cause from what you said i can't really tell what do I have to change, sorry i'm a newbie.
Please explain again, in more detail, exactly what you expect to happen when you press the Upgrade button, then perhaps I will understand what it is you want....
When I press it I want it to change the points to points - price (50) then change the price to 2.7 the previous price, and add 1 to the workers upgrades owned text.
But i want it to happen after i click the button and if the number of points is the same or higher than the price of the upgrade. It worked fine earlier but after i saved the variables data between screens with tinydb it doesnt wanna work.
That's what my problem is about, it doesn't work at all. When I click it nothing happens when I was trying to see what is wrong with it, im pretty sure it is something with the if statement cause its not able to get pass through it and do the "then", its just stuck at the "if" statement for no reason. Cause the points label shows the correct number and when its over 50 then it should work but it doesnt for some reason
Ah, now we are getting somewhere, you have explained
Try this instead....
Note, it will only change things if it meets the condition. You may need to add the else section to do something if it doesn't meet the condition, otherwise nothing happens.....
I added this to see if it even detects that the number of points is higher than the upgrade price variable but it doesnt chnage the text to "worked" so it doesnt work. I don't know why cause last time I was doing the same thing but to show the price and it showed the correct price so upgrade price variable is set to 50 so I really dont know whats wrong with it.
In menu Projects, click "Export selected project (aia) to my compuuter."
And such a small note for beginners. Before you start building complex applications, start learning from simple projects, and most importantly from learning the appinventor interface, because that's the basics.
The problem is that you load the data from tinyDb into a variable, but you do math on the labels. Do math operations on variables and use labels only to display the results.