How to: Create a shop

Discuss Chaos Strikes Back for Windows and Linux, an unofficial port of Chaos Strikes Back to PC by Paul Stevens, as well as CSBuild, an associated dungeon editor.

Moderator: Zyx

Forum rules
Please read the Forum rules and policies before posting.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

It seems DSAs can do a number of things already

Add and subtract items of any kind from the hand or into the dungeon, store and compare numbers, and of course generate consequences .

So, as you cycle a 'select' function liek the DM2 shop, an item can appear in the alcove. You are currently in looking mode and it lets you cycle. Perhaps opposite can be a shopkeeper wall object you are across from. If you start tryign to touch him with objects, the DSA can remove them from you and give you credit. If you generate enogh credit, you can simply walk off with an item later.

Otherwise, if you take the item out of the alcove, the DSA is in a try but buy state at this point. So you could pick it up, just not walk out of the store with it. The cycle button now no longer works - you must first give more money. If you instead go beyond a certain point, then nasty thigns will happen like Golems or fireballs.

I imagien once you take an item chance appears in another alcover or by your feet - generated from the different in credit and cost.

I imagine you could 'haggle' by touching the shopkeeper with an empty hand first. There is slight wiggle room in the price each time your credit and the cost is compared. However, there is also a random chance of the haggle function being locked out until you buy something.



goes into a try or buyOr, if you touch a coin slot of shopkeeper wall item (thinklord librasulus) with the correct item, it can be made to vanish and the DSA update it's 'credit' rating.
User avatar
TyGuy6
Craftsman
Posts: 140
Joined: Mon Aug 01, 2005 8:20 pm
Location: U.S.

Post by TyGuy6 »

A few comments in response to beowuuf's:
-no need to disable the cycle button when the player picks up an item, since he can't leave until he pays or puts the item back.
-I don't know about a cycle at all. I would rather have the items sitting around the room in different places/alcoves.
-Paul said there's no way to do change... if there were, I'd rather have the player have a button to get his extra money back, rather than automatic change-making.
-haggle? I'd rather go simple and forget it.

I'm gonna come back and give Paul answers to all his questions after I take a break for food.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Things like 'haggle' are complicated not only for
the person writing the program but also for the
poor dungeon designer who must configure the
thing. I would like something very straight-forward
from the dungeon designer's viewpoint.

I would like all objects of a single type to be treated
equally. All apples are identical.

I would like the objects to be sold to be sitting in
an alcove at the start of the game. If you have
seven daggers to sell, you could put them all in
a single alcove or one in each of seven alcoves
or anything in-between.

I would like anything put into an alcove that
does not belong there to be totally ignored by
the engine.

I would like not to make change. When would it
be done? As the player leaves the shop?

I would like the buying and selling prices to be
equal.

EDIT
=========
I would like there to be only one shop in the
dungeon with several branches. That is - only
one pool of money.

I would like 'returns' to be made by simply placing
the object back in the appropriate alcove.
As if you had picked it up to examine it and put
it back without buying it.
User avatar
TyGuy6
Craftsman
Posts: 140
Joined: Mon Aug 01, 2005 8:20 pm
Location: U.S.

Post by TyGuy6 »

Returns:
I would like returns of the same type of item to yield the same amount
of credit--the item's "store worth." This means that players finding more
of a shop item around the dungeon could "sell" it for credit.

Shop item alcove assignment:
I would like the dungeon designer (the 'DM') to be able to assign to a
shop alcove one or more item types to both buy from and sell to that
alcove. In other words each alcove could detect placement and
removal of all and only the item types the DM assigns.

Some items might be placed there by the DM to be bought, while
others would only be found elsewhere, and could be sold to the
alcove and later bought back.

I would therefore like provision for selling 'infinite' items to the same
alcove, and buying as many as there are to be bought (a finite
number).

Multiple Shops/Slots:
I would like provision for multiple shop branches and payment slots
around the dungeon, but only one pool of shop credit.

Player credit/debt report:
I would like a way for the DM to trigger a report to display somehow.
A button or pressure pad might display the report on a wall or in the
text box at the bottom of the screen, for example. The report would
tell the player how much he owes, or, if he has paid extra, how much
credit he has. This might be too much to ask, though.

DM extensibility:
The DM should have a means to do other things at various credit/debt
levels. For example, if the player has paid at least the price of the
apple, a teleporter turns off and allows him to go pick up the apple
that he wasn't trusted with before. Or picking up ten coinworth of
items he hasn't paid for might make the shopkeeper say, "You are
going to pay for that, aren't you?" Just examples of what the DM
should be able to do if he thinks of it.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

http://www.dianneandpaul.net/CSBwin/DSA ... esign.html

None of this is implemented. I am building a
demo dungeon and will try to make all of this
work.
Last edited by Paul Stevens on Fri Jul 27, 2007 8:39 pm, edited 1 time in total.
User avatar
TyGuy6
Craftsman
Posts: 140
Joined: Mon Aug 01, 2005 8:20 pm
Location: U.S.

Post by TyGuy6 »

Whoo! Looks great! :D

Hey, I noticed that the 'Returns/Trade-in' window wasn't listed under
the sections titled, "A shop consists of:" or "Setting things up.
Placing actuators." I assume that this window would send items to
the 'Garbage Disposals,' but it isn't clear.

Thanks a lot for taking this thing far!
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

The 'Display Window' serves as a 'Returns/Tradeins'
window. See its description and you will see how to
accomplish that. Placing something in a window that
does not accept it will send it to a window or garbage
disposal that does accept it (and accounts for its
value) or to the lost and found where it has no value.

The webpage is updated. Now I have to
start implementation.
User avatar
TyGuy6
Craftsman
Posts: 140
Joined: Mon Aug 01, 2005 8:20 pm
Location: U.S.

Post by TyGuy6 »

I understand now. And I'd like to say, it's all looking very snazzy. You have put in a lot of work Paul. I've already tried the demonstration, but it wasn't finished yet. Why don't you sell the firestaff so we can take out those pesky screamers with ease?
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

The documentation and demo are updated.
The demo actually works a little bit already.
User avatar
TyGuy6
Craftsman
Posts: 140
Joined: Mon Aug 01, 2005 8:20 pm
Location: U.S.

Post by TyGuy6 »

Upper floor:
Can step on pad. Clicks and does nothing.
Can insert copper, gold, and gem, but no differences if I do.
Can take Hardcleaves. If I take them out before stepping on lower floor exit pad, then putting them back afterward grants me credit (I can take them again or the DiamondEdge. If I step on lower floor exit pad and then take them out, they don't prevent me from leaving the upper floor shop.

Lower floor:
Stepping on exit pad has effects:
-first time, sets teleporter no matter what. Sets starting shop total, as evidenced by Hardcleave thing mentioned above.
-after first time, sets teleporter if less weapons are in alcoves than were in alcoves when I first stepped on the pad, even if I have paid in slices (tried 6 once), coins, or gems. Doesn't set teleporter if at least as many weps are in alcoves (besides the lost and found, where weps are unrecognized) than were in alcoves when first pressed pad.
-moves shop items to their places, takes screamer slices, and puts other items in the lost and found. Does this for items in the three display windows but not in the lost and found.

Conclusions:
Top exit pad doesn't work, which probably has to do with the 'inter level relay' not connecting with the 'lost and found' properly.
Shops work as expected in all other ways except that payments don't grant credit.

Nonessential mistakes:
-there are no silver coins. The DiamondEdge alcove should say two coppers, the Hardcleave alcove should say three coppers, and the screamer alcove should say a slice for a copper.
-the fountain should either accept coppers instead of the gold coins it now accepts, or it should say "a gold is three for me"

I'm going to check out the dungeon.dat from the provided CSBuild to see if I can find the sources of the problems.

Hope that helps, and thx again. :D
Last edited by TyGuy6 on Fri Jul 27, 2007 8:06 am, edited 1 time in total.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

The demo has been updated. I switched to the
CSB graphics.dat so some of the names will
be right.

It is working well enough that I will leave it to
you to test and provide feedback. I'm sure there
are still lots of things wrong. But I want to start
to create some documentation for the various DSAs.
User avatar
TyGuy6
Craftsman
Posts: 140
Joined: Mon Aug 01, 2005 8:20 pm
Location: U.S.

Post by TyGuy6 »

Ok, I'm only seeing that one difference, namely, the graphics.dat. I'm gonna edit my last post to be more accurate, and then you can get to the problems when you get to them. Good docs are important too.
User avatar
TyGuy6
Craftsman
Posts: 140
Joined: Mon Aug 01, 2005 8:20 pm
Location: U.S.

Post by TyGuy6 »

Fixed one problem. The upper exit pad pointed to the South of the inter level relay, which pointed to the South of the lost and found. Make these point to North. That makes the upper shop work just as well as the lower shop.
Still can't see what's the problem with the money not granting credit. Must be a DSA thing, eh? Probably not counting it or something. Oh, but I did notice that the garbage disposal didn't have a more parameters DSA under it. Adding one didn't change anything, but it might cause problems when the money gets working if you don't fix it now.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

I think there has been some confusion somewhere.
Download it again and make sure you are
using version 0.5. Enter the prison and choose
'Help/Game Version'.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

OK. Version 0.5 of the demo and the current
documentation are ready. I am going to drop
the project except for bug reports, feature
requests, and questions. It is now in your hands.
User avatar
TyGuy6
Craftsman
Posts: 140
Joined: Mon Aug 01, 2005 8:20 pm
Location: U.S.

Post by TyGuy6 »

Will do, when your site is up again. The one I was using has no Game Version info. I guess that means it isn't v0.5
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

I have updated the link (above).
User avatar
TyGuy6
Craftsman
Posts: 140
Joined: Mon Aug 01, 2005 8:20 pm
Location: U.S.

Post by TyGuy6 »

Works like a charm! But I still don't understand why you use silvers as the monetary unit, and then don't include any silver coins. Get back to you if I have any problems with the implementation, but for now, over and out!
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Oh, all right. I changed the text to
use a GOR as the monetary unit.
Version 0.61
User avatar
TyGuy6
Craftsman
Posts: 140
Joined: Mon Aug 01, 2005 8:20 pm
Location: U.S.

Re: How to: Create a shop

Post by TyGuy6 »

You probably don't remember these DSA's all that well, Paul, since it has been a while. I'm trying now to make a shop, but I keep getting these errors when I first step on the exit pad.

"Warning:
Unknown DSA command code
DSA at 0(12,27)
Row=15;Col=1"

"Warning:
Unknown DSA command code
DSA at 0(18,28)
Row=15;Col=0"

"Error:
System Error 56535
DSA stack underflow
DSA at 0(18,28)
Row=1;Col=0"

0(12,27) is my Lost and Found DSA.
0(18,28) is the Display Window DSA first pointed to in the DSA loop. (There are 2 Display Window DSAs.)

I have tried many different things, and I keep comparing my dungeon with your shop demo dungeon, which works fine. I can't find the crucial difference. I also read through your instructions on how to set up a shop, at http://www.dianneandpaul.net/CSBwin/DSA ... esign.html.
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Re: How to: Create a shop

Post by Zyx »

"Unknown DSA command code": looks like your CSBwin.exe is obsolete.
I'm not sure which is the current version, but you could try this one: http://www.dianneandpaul.net/CSBwin/CSBwin10_102.7z
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: How to: Create a shop

Post by Paul Stevens »

If you are using the latest version and you still have
problems, don't give up. We'll make it work.
User avatar
TyGuy6
Craftsman
Posts: 140
Joined: Mon Aug 01, 2005 8:20 pm
Location: U.S.

Re: How to: Create a shop

Post by TyGuy6 »

Thanks, I'll try upgrading my version. I was using 9.8v72, whereas the demo that worked was 10.010. That might be the only problem. I'll let you know in maybe 15 hours. I hope the newer version I use is backwards compatible enough. My CSBuild is 2.51; it could probably use an upgrade as well.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: How to: Create a shop

Post by beowuuf »

For what it's worth, your eror sounds ike you hae one to few parameters in that line for the DSA command there.

Also the warnings sound like they know what DSAs are, but don't know the command you used at that stagte (col) and row - i think. So it shouldn't be a backwards compatibility issue I don't recall any superseded commands! Check those lines, and make sure you have got all the requisite & and L in place!
User avatar
zoom
Grand Master
Posts: 1819
Joined: Tue Sep 23, 2003 1:27 am
Location: far away but close enough

Re: How to: Create a shop

Post by zoom »

This is so cool. Reviving this thread makes me wanting to start with a shop, too!
User avatar
TyGuy6
Craftsman
Posts: 140
Joined: Mon Aug 01, 2005 8:20 pm
Location: U.S.

Re: How to: Create a shop

Post by TyGuy6 »

Well, the shop works fine when I use the later version of CSBwin! Hooray!

But I am curious a bit to know what went wrong. beowuuf said to check the state and row specified in the error. Well, state 1 has plenty of stuff in its rows, but I don't see a row 15. There are only SCT 1-4 = 12 rows.

Hey wait! It could be State 15 Row 1. I didn't think State 15 had anything, but it does:

S0 = GV14@
C0 = GV14!

Looks like it is what accesses global variable 14. I had to go into Edit:Global Info: Edit Database and Write a Record of size 16 into Global variable numbers 0-15 before my shop would work. (Of course, it still didn't, but that was a compatibility issue apparently.)

So why does accessing global 14 give warnings?

Here's the suspect line in State 1 of my Display Window DSA, the line that threw the error:

S0 = GS1 LA &* G15 &+ G15C0

I'm not that familiar with DSA code. What does this do? Why would it throw a DSA stack underflow system error? Why doesn't it throw the error in the newer version of CSBwin?
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: How to: Create a shop

Post by beowuuf »

GS1 does a gosub to S1. If line S1 has something wrong, it would generate an error? It then would take the output of that gosub and multiply it by the contents of LA - did you have a value in the first parameter of the DSA?

It would then take this answer, and add the answer from gosub of state 15. It would then gosub to state 15 C0. And then that would be it.


I reckon the DSA must stack underflow because S1 or state 15 S0 does not generate an answer. It probably does not generate an answer because it cannot use a newer command to generate an answer, and so ignored the command.
User avatar
TyGuy6
Craftsman
Posts: 140
Joined: Mon Aug 01, 2005 8:20 pm
Location: U.S.

Re: How to: Create a shop

Post by TyGuy6 »

Well, this all makes sense considering that the Display Window DSA has the same state 15 as the Lost and Found DSA: S0 = GV14@ C0 = GV14!

These commands must not be working properly in the older version of CSBwin. I wouldn't know where to start on that, and anyway, it's already fixed in the later version(s). So I'm happy.

Just FYI, I figured out what the command does for the shop, based on your "translation". it seems that GS1 gets the number of items in the Window (that match the Window's item type), which is multiplied by the value of the items and added to the global "shop value" variable. The gosub gets a bit intense but if you want I'll post it. Like I said, it probably isn't the problem.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: How to: Create a shop

Post by Paul Stevens »

I became a little bit lost in all of this explanation.
But . . . . . .
1) I don't discuss problems in older versions of CSBwin.
2) I welcome any problems with the latest version.
3) I'd be happy to try and explain any details of the shop demo.

The shop is complicated. If you can figure it out you can
consider yourself a graduate-level DSAer.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: How to: Create a shop

Post by beowuuf »

oh, and GV was a newer command/prameter, so would not work in older csbwins :)

back in the day zyx used giggler health!
Post Reply

Return to “Chaos Strikes Back for Windows & Linux (CSBWin) / CSBuild”