Code:

round(ʟGMST(10)/25→X
Output(1,1"Buy Potion(s)
Output(3,1,"You can buy,
Output(3,13,X
Output(3,16,"potions!
Output(4,1,"[<]
Output(4,4,P
Output(4,7,"[>]
Output(5,1,"1: Buy!
Output(6,1,"If you don't want to buy
Output(7,1,"any potions 'buy' [0]!
Repeat max(Ans={92,24,26})
getkey
End

That's my routine so far.
My question is:
Can I use the following block inside the repeat routine to increase/decrease the amount of potions? I want to restrict the input bounds to 0 to max (X potions)


Code:

P-(Ans=24)+(Ans=26→P
P-(P≤0)+(P≥X→P
I imagine that you could, but you would also have to make sure to draw the new P to the screen. Smile Also, one line could also work:


Code:
P-(Ans=24 and P)+(Ans=26 and P<X->P
Can you explain that last code segment you added in your edit? It's been a few years since I last saw any code haha
Oh sure! Smile Haha, it's actually been a while since I've really coded in basic too, so that above code is actually incorrect. Razz Whoops! I was thinking of doing something along the lines of 24-25 is -1 and 26-25 is 1, but it would just be easier to do the first bit. Sorry about that! Smile

This might be a way to set it up:

Code:
Repeat max(K={92,24,26
getkey->K
If Ans:P-(Ans=24 and P)+(Ans=26 and P<X->P
End
kek I'm not sure why I didn't think of that.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement