TIB: BIG FAVOR
[Prev][Next][Index][Thread]
TIB: BIG FAVOR
>I was wondering if anyone could make a complete
>code where you have 2 things-a shop and an item
>menu. At the shop you can get items, you don't
>need to buy them, just get them. Then after
>you get one or 2 you go to the item screen and
>it tells what you have and don't have.
See if this does what you need. Just mail if you have any questions. I
left in a couple unnecessary lines of code, so understand that when you
wonder why I'm displaying something. Just play around with it until you
form a program to suit your needs.
Prog:Buy
:200/->/U
:8/->/dimL I
:Fill(0,I
:"Item AItem BItem CItem DItem EItem FItem GItem H"/->/N
:{7,9,4,3,5,2,6,1/->/P
:{1,3,5/->/T
:Store
Prog:Store
:""
:While 1
:ClLCD
:Disp " Welcome to Store","1:","2:","3:",Ans,"Funds: $"
:For(X,1,dimL T
:Outpt(X+1,4,sub(N,6T(X)-5,6
:Outpt(X+1,12,P(X
:End
:Outpt(6,9,U
:Outpt(7,1,I
:1
:Menu(1,sub(N,6T(1)-5,6),A,1,sub(N,6T(2)-5,6),A,1,sub(N,6T(3)-5,6),A,4,"Inv",D,5,"Exit",E
:Lbl E:Return
:Lbl D:Inv:"":End
:Lbl C:Ans+1
:Lbl B:Ans+1
:Lbl A:Ans/->/A
:0<=U-P(A/->/B
:B+I(T(A/->/I(T(A
:U-B*P(A/->/U
:sub("Need more $Sold!",11B+1,5-6(B-1
:End
Prog:Inv
:ClLCD
:For(X,1,8
:Outpt(X,1,sub(N,6X-5,6)+":"
:Outpt(X,9,I(X
:End
:Pause
U = your money
I = your inventory list, amount of each item you have
N = name of all items
item names are 6 chars long, all stored in
one string sequentially
P = prices for all items
list of prices
T = type of items in shop
index list to P list
A = item number you want to purchase
index for T list
B = 1 if you can/did buy the item
0 if you can't/didn't buy the item
I hope this helps.
Sincerely,
The Unibomer
Jared Ivey
Unibomer@Juno.com
http://www.geocities.com/SiliconValley/Vista/7342
"Every person is wrong until they cry, and then they are right,
instantly." -- Unknown
Follow-Ups: