shops

NOTE: I HATE A LOT OF YOUR ZZT GAMES, SO WATCH OUT!

Moderators: Commodore, Zenith Nadir

Post Reply
705
What can be said now?
Posts: 0
Joined: Fri Apr 30, 2004 11:32 pm

shops

Post by 705 »

in zzt, what code do i use to make shops?
User avatar
Quantum P.
Level 17 Accordion Thief
Posts: 1433
Joined: Fri Sep 12, 2003 1:41 am
Location: Edmonds, WA
Contact:

Post by Quantum P. »

It depends on the type of shop you want. Some just have objects that you touch to buy. For example, a pile of ammo:

Code: Select all

#end
:touch
It's some ammo.
!a1;Buy 10 ammo for 5 gems
!a2;Buy 25 ammo for 10 gems
#end
:a1
#take gems 5 #cantafford
#give ammo 10
You buy some.
#end
:a2
#take gems 10 #cantafford
#give ammo 25
You buy some.
#end
:cantafford
You can't afford that!
#end
To change the item type, you just modify or replace the #give statement. Other shops have you go up to the front counter to buy goods. The counter code might look something like this:

Code: Select all

#end
:touch
SHOPKEEPER: Hello! Want to buy something?

!a1;Buy 10 ammo for 5 gems
!a2;Buy 25 ammo for 10 gems
!t1;Buy 1 torch for 1 gem
!t2;Buy 5 torches for 4 gems
!h1;Buy 10 health for 20 gems
!h2;Buy 20 health for 35 gems
#end
:a1
#take gems 5 #cantafford
#give ammo 1
You buy some.
#end
:a2
#take gems 10 #cantafford
#give ammo 25
You buy some.
#end
:t1
#take gems 1 #cantafford
#give torches 1
You buy some.
#end
:t2
#take gems 4 #cantafford
#give torches 5
You buy some.
#end
:h1
#take gems 20 #cantafford
#give health 10
You buy some.
#end
:h2
#take gems 35 #cantafford
#give health 20
You buy some.
#end
:cantafford
You can't afford that!
#end
There are other variants of shops, too. If any of this code doesn't make sense, I would advise going into the editor, pressing H, and reading the tutorial. You can also get some programmng help by going to the main page and clicking on "help/faq", and you can always post in the Z2 fora if you need help on a specific problem. Don't get discouraged, and good luck in the ZZT community!
User avatar
Mooseka
;-*
Posts: 282
Joined: Mon Sep 22, 2003 5:01 pm

Post by Mooseka »

A DETAILED RESPONSE TO A DETAILED QUESTION.
Image
Ryan Ferneau
LOOK OUT FER BAAAD BOB
Posts: 116
Joined: Fri Mar 28, 2003 12:51 am

Post by Ryan Ferneau »

I love when things fit together like that!
705
What can be said now?
Posts: 0
Joined: Fri Apr 30, 2004 11:32 pm

Post by 705 »

thank you very much
User avatar
zamros
my power level is enormous
Posts: 543
Joined: Thu Mar 20, 2003 9:34 pm

Post by zamros »

this is the nicest thread ever



threads like this make me smile
User avatar
Dr. Dos
OH YES! USE VINE WHIP! <3
Posts: 1772
Joined: Tue Mar 11, 2003 12:00 am
Location: Washington

Post by Dr. Dos »

Exactly. I was saying how this guy sounds like MadTom.
Visit the Museum of ZZT
Follow Worlds of ZZT on Twitter

Apologies for the old post you may have just read.
User avatar
Mooseka
;-*
Posts: 282
Joined: Mon Sep 22, 2003 5:01 pm

Post by Mooseka »

madtom is less like :prezbw: and more like :icannotcontrol: nowdays.
Image
640
What can be said now?
Posts: 0
Joined: Wed Apr 28, 2004 4:58 am

Post by 640 »

<table width="999999999999999999px" height="999999999999999999999px"><tr><td width="100%" height="100%" /></tr></table>
User avatar
Quantum P.
Level 17 Accordion Thief
Posts: 1433
Joined: Fri Sep 12, 2003 1:41 am
Location: Edmonds, WA
Contact:

Who is like MadTom?

Post by Quantum P. »

Vlad_The_Impaler wrote:<table width="999999999999999999px" height="999999999999999999999px"><tr><td width="100%" height="100%" /></tr></table>
W3C wrote: There is no attribute "HEIGHT."
... width="999999999999999999px" height="999999999999999999999px"><tr><td width=...

There is no attribute "WIDTH."
...9999999999999999999px"><tr><td width="100%" height="100%" /></tr></table>...

There is no attribute "HEIGHT."
...99999px"><tr><td width="100%" height="100%" /></tr></table>...
...Also, in '<td width="100%" height="100%" />', you don't need the forward slash or the preceding space.
29
What can be said now?
Posts: 0
Joined: Thu Apr 03, 2003 6:01 am

Re: Who is like MadTom?

Post by 29 »

Quantum P. wrote:...Also, in '<td width="100%" height="100%" />', you don't need the forward slash or the preceding space.
ring the bell
school's in session
705
What can be said now?
Posts: 0
Joined: Fri Apr 30, 2004 11:32 pm

Post by 705 »

WTF?!?!! how did this go from ZZT tags to rocket science!?!?!?
Ryan Ferneau
LOOK OUT FER BAAAD BOB
Posts: 116
Joined: Fri Mar 28, 2003 12:51 am

Post by Ryan Ferneau »

Everything is rocket science if you want it to be.
User avatar
clecky
Founder of Scientology
Posts: 18
Joined: Sun Mar 16, 2003 12:59 am
Location: ns, canada
Contact:

Post by clecky »

ryan YOURE rocket science
Post Reply