Sample DSA and CSbuild bug report

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
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

Sample DSA and CSbuild bug report

Post by rain` »

I made a sample DSA today, trying to learn the power of DSA and see what i can come up with =].

This DSA when activated takes the contents of a cell, finds a specified object and replaces it with another object. Anotherwords put a green gem in an alcove, press the button, and you get a worm round.

Its a mini-money changer but its a start!

http://www.qwplayers.org/~rain/DSAItemSwap.zip


Bug report:
DSA stack operator &!= does not work (its not implemented?)
DSA help file shows &DEL to be of &DEL (location obj ...) format, but its actually (obj location ...)
DSA stack operator &< help file shows it to be (x y ... x<y) but its actually (x y ... y<x) for whatever reason (this may apply to most stack operators?

Using CSBuild v1.2 compiled 4/10/2004 (assuming this is the latest version, found off diannaandpaul.net)

-rain`
Guest

Post by Guest »

the &< operator actually does work correctly, i just misinterpreted my own writing (used a &swap before it to make it > instead of < oops).

also: &ADD and &DEL only work for misc items, either u forgot to implement the rest or noone asked for it =] I'm not asking for it just noting it.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

That's great! It works. There were no other items lying about
so I could not check to see what might happen if I put a
Flask in there (or something) or if more than one green gem
was present or if other items were with the green gem or the
gem was on the bottom or the top.

I'll check out those other two errors.
Using CSBuild v1.2 compiled 4/10/2004 (assuming this is the latest version
Not as of an hour ago. But it should make no difference to you.
rain

more DSA

Post by rain »

Doing more experimenting with pits i created another sample DSA which controls a 6x6 square matrix of pits by toggling entire columns or rows of pits in a 'wave' pattern randomly.

With the power of DSA's functionality I have a 3x4 room of 2 gigglers stepping on actuators which send commands to the DSA which handles all toggling of the pits. 36 pits total are controlled via only 13 actuators. Without DSA's this would require at least 72 actuators.

neat stuff =]
Guest

Post by Guest »

User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

I think all your problems are fixed with
CSBuild14.rar
and the CSBwin version Alpha1 in
OverlayDemo.rar
User avatar
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

another one! =]

Post by rain` »

Yeah so with this ADD and DEL feature of adding objects, moving objects, and deleting objects on the fly you can do alot of neat new stuff. Here i made a little DSA that changes the stats of an unressurected champion randomly (by use of giggler, actuator, and DSA).

Unfortunately using ADD and DEL with text objects was unsupported so i implemented into CSB4win myself and included a modified version of CSB4win compiled by myself with the implementation of such a feature just to show off what you can do!

http://www.qwplayers.org/~rain/DSARandomChars.zip

Paul Stevens, I think you should finish up all the implementations of ADD and DEL stack functions to handle more then just miscellaneous items.

Also, I think some of these features may come in handy as well:

DSA stack function "add object to object". Since you can give actuators to monsters and texts to monsters in CSBuild, why not do it on the fly as well?

DSA stack function "delete object from object". Well if you can give a monster an item you gotta be able to delete them too

DSA stack function "fetch object from object". So specifying an object ID of a monster and an objectID of a steak would find the steak object the monster is carrying... need that for delete and add.

DSA stack function "rand", returns a random number =]
Basically what im saying is I want the ability to use DSA's to make... yes.. randomly placed monster generators, randomly placed teleporters, randomly placed monsters which contain random items. Or how bout gigglers that are generated by a monster generator that, upon creation, step on a pad and receive in their inventory a dragon, then continue off into a room full of teleporters and get teleported randomly throughout the dungeon and turn into a pandoras box generator!

all this would be possible with just add/del/fetch working with objects on monsters =] rand would be nice so i dont have 50 gigglers running around all over the place in 2x2 rooms just to produce random effects.

-rain` =]
ran`

Post by ran` »

quite note: DSA's in walls receive all messages, set, clear, and toggle of bits 0-3 while if the DSA is on a floor tile it only receives set clear and toggle messages on bit 0, is this meant to be or a bug? I had a DSA on a floor tile and had a pressure pad that set the room containing the actuator on the east side and it did not register in the DSA for S1.

-rain`
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

DSA is on a floor tile it only receives set clear and toggle messages on bit 0
This has been well-documented.
http://www.dianneandpaul.net/CSBwin/Tec ... Action.png
I do not know why but the original runtime
engine carefully clears the 'Position' of any message destined for non-wall
cell to zero (or North).
handle more then just miscellaneous items.
Did you use the latest version? It added Potions, Weapons, Clothing.
Be careful of that business with text. I hope you were careful to
be sure no scrolls were pointing to the text you removed. And I hope
you were careful when you removed the text itself from the compressed
text array. Removing the database entry does not do this. I was not
going to allow text to be deleted. Moving text from one place to another
should be OK.

Monsters, chests, and scrolls have some similar problems because they
point to other objects in the dungeon. If cloned objects were impossible
it would be somewhat easier but there are die-hard cloners in our midst.

Actuators should be OK. But wow! Maps are suddenly useless.

So what is the state of affairs here?
0 - Doors - Copy ok. Delete ok changes map. Move ok changes map.
1 - Teleporter - Copy already done. Effectively delete using copy. Move why?
2 - Text - Copy Ugly. Delete (by turning off the 'Show Text'). Move ok.
3 - Actuators - Copy??? Delete??? Move ok.
4 - Monsters - Copy very difficult. Delete difficult. Move within level ok.
5 - Weapons - Copy ok. Delete ok. Move ok.
6 - Clothes - Copy ok. Delete ok. Move ok.
7 - Scroll - Copy Ugly. Delete Ugly. Move ok.
8 - Potion - Copy ok. Delete ok. Move ok.
9 - Chests - Copy difficult - Delete difficult. Move ok.
10 - Misc - Copy ok. Delete ok. Move ok.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

I should add a quick note here.........DSAs are the one thing that
have not been converted to work with more than 16 levels. Nobody
seemed to want to use them so I put that work (a lot of work....have
to change the Actuator database formats) off until it was really needed.
Perhaps I had best get with it. Oh, pain.

The bright side of this is that all actuators will have 2 additional bytes
of information. Those bytes will undoubtedly get put to good use someday.
User avatar
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

Post by rain` »

actually i used the same code for misc objects as i did text objects for ADD and DEL, it contains 1 16 bit integer which correpsonds to the nth item in the text list. If you use add you get 2 'text' objects pointing to the same contents of text. Since the list of text itself is never manipulated, created, or deleted in the dungeon i figured there would never ever be a problem.
User avatar
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

Post by rain` »

CSBuild 1.4

Store Value from Stack
[<next state>]S<A|B|C|....>-----

=] woot!

Now, what are limitations, just A-Z? This makes me very happy!
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Since the list of text itself is never manipulated, created, or deleted in the dungeon
Then I hope you mark any saved dungeons as 'Non-Editable'. If you
like, I can set aside a flag for that purpose.
Now, what are limitations, just A-Z
Yes
User avatar
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

Post by rain` »

Using CSB4win.exe from overlaydemo.rar (compiled 7/15/2004 10:20pm) I get a few problems with SC, SI, LC, and LI. Heres the tracelog:

(0)Execute DSA at 0(3,6) master at 0(3,6) state=18677933,msg=0
JUMP Jump 0S2
LOAD INTEGER 0 0
STORE Parameter I = Missing = 0
LOAD INTEGER 0 0
STORE Parameter C = Missing = 0
GOSUB 0C2
(1)Execute DSA at 0(3,6) master at 0(3,6) state=12288,msg=7
LOAD Parameter I = Missing = 0 0
LOAD Parameter B = 70 0 70

"Missing" ?
and storing values into I and C then reloading them always yields a 0.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Thou may misunderstand. Or I may never have implemented anything
but A and B.

There can be at most two variables stored in a single instance
of a DSA. Namely A and B. In order to store C and D you need to add
another (do nothing) DSA at the same location. For E and F yet another.
Etc. Moreover, these are 16-bit variables. In case you did not know.

All of which brings up the 64-level business. Your old DSAs are going
to get broken, especially if you use Absolute locations in the code or
initialize parameters to integers. I have thought about it quite a
while. I am going to break the backward compatibility rule. Old
DSAs will not generally work with the new 64-level runtime and editor.
I figured there are so few of them in existence (mostly my own) and
enforcing the rule results in such ugliness that this is the time to
break it. A side-effect is that the Parameters A through Z will be
18-bit quantities.

Here is what I think will break:
--Absolute in-line locations like L0(2,3)S and other instructions
that reference absolute locations. Messages that reference locations
for example.
--Parameters that are used as integers rather than as locations.

Sorry about that. I'll have a new CSBuild/CSBwin in a day or so
with these changes. If you Export old DSAs using an old CSBuild
then you can (currently manually perhaps someday automatically)
Import them into the new CSBuild and they should work. But that
only fixes the inline code compatibility, not the parameter problem.
Guest

Post by Guest »

more tidbits

&NOT doesnt seem to work on 0, "!0" is supposed to be 1, at least i thought

Using SA SB SC SD and LA LB LC LD work now that i have a second DSA on the tile =] Thnx for the info.

&ADD for weapons/potions does not seem to work in the CSB4win.exe compiled on 7/15/2004 10:20pm which is included in OverlayDemo.

&ROLL -1 1 101 28
&ADD &ADD of unimplemented type -1
JUMP Jump 2C2 -1

item 28 is infact a ful bomb. This same code works for keys, coins, and gems perfectly.
User avatar
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

Post by rain` »

another quick note

You cant use L80000 in CSBuild, it converts it into a 16 bit integer but you can do L10000 L10000 L10000 L10000 L10000 L10000 L10000 L10000 &+ &+ &+ &+ &+ &+ &+ to create 80000 in the stack. I was using this because Im making an 'item changer' and it involved potions, but potions itemtype contains its 'power', so i did an if itemtype is between 80000 and 90000 (potion) then subtract itself&255 to get a 'power 0' version of itself to compare to. Not a problem though because i found a work around.

Am I the only one besides you that understands this DSA stuff? =]

-rain`
User avatar
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

Post by rain` »

Another one: Multiple Item Swapper (Money Changer clone)

This DSA takes any number of input items and when activated replaces them with a new set of items. It is stackable as well (So putting 10 of this DSA on one tile and setting the DSA will essentially yield 10 different unique recipes). The only problem with this is if one recipe says exchange 5 silver coins for 1 gold coin, and another recipe says exchange 1 gold coinf or 5 silver coins, it will change the silver coins to a gold coin, and back to silver coins instantly. So no outputs of one DSA should match inputs of another or you will lose your feature =[).

http://www.qwplayers.org/~rain/DSAMultiItemSwap.zip

-rain`
User avatar
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

Post by rain` »

I forgot to mention, I do not have a copy of CSB4win.exe with support for creating potions on the fly so the recipe of ful bomb + orange gem -> mon ful bomb will not work until the feature is implemented.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

I very much appreciate your inputs. But I am going to
ignore them for now and pick them up later. I am working
on the 64-level problem.

L80000 cannot work because the literals are 16-bits. The
stack is 32 bits. L80000 WILL WORK after I get the 64 levels
going (because 18 bits are required to reference a location
in the dungeon so I had to invent 32-bit literals).

(L10000 L8 &* is a bit easier).

You are the only person who has even attempted to know what
a DSA is. Now that some neat features depend on it (overlays
and save-disables and more to come) it will become more widely
studied, I am sure. But some folks have made up their minds in
advance that anything that looks like a program is not to be
understood under any circumstances. That's OK. These things are
fun to write, as you have discovered. We can write for them and
make them think we are super-human.
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

I *already* think you are superhuman!
User avatar
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

Post by rain` »

(L10000 L8 &* is a bit easier).

Yeah, but there is no &* =]
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Well there is a left shift. Or DUP + DUP + DUP +.

How can there not be a &*? I have quotient and modulus.
Mostly there are only things that I needed to do my demos.
I'll put in a &* while making the 64-levels work.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

while if the DSA is on a floor tile it only receives set clear and toggle messages on bit 0, is this meant to be or a bug?
CSBuild should have complained about this when you tried to reference
other than bit 0 on a Floor Tile. If it did not, let me know. (Check/Actuators?)
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

I posted CSBuild141.rar and version Overlay Alpha3 of CSBwin
(as part of OverlayDemo.rar).

These two new versions should add two bytes to all actuator
records and implement the 64-level capability of the DSA.

I recommend that you keep careful backups for a while and try
the following tests:

1) Use CSBwin to run your DSA dungeon.
2) Save and restart the dungeon.
Then use CSBuild to make a small change. Then run the same
two tests again on the edited dungeon.

I am starting work on some of your needs/suggestions/bug reports.
User avatar
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

Post by rain` »

ran into a stray branch today.

Either im doing this wrong, or somet new things need to be tweaked from the 64 level capability implementation.

CSBwin.exe :Overlay Alpha 3
CSBuild.exe: version 1.41

Problem: Im using a DSA which is set by 3 and/or gates (they are working, according to the tracelog), but in the DSA i have "LA L32 &NEG &+ 1MC" as state 1 for example, which should send a clear message to 'one room left of A' provided A is not in the first column of the first level (which it isnt, and that works wonderfuly!). The next time i send a SET message to the DSA it should be in state 1 correct? Well its always in state 0. I must be doing something wrong =] I tried using global and local state as well as paramater B state. I also checked the tracelog and found this:

(0)Execute DSA at 0(5,3) master at 0(5,3) state=18677933,msg=9
LOAD Parameter A = 229 229
LOAD INTEGER 32 229 32
&NEG 229 -32
&+ 197
MESSAGE SET delay=0, 0(6,5)000002e timer create 001 00 DLY=0000 0a 00 06 05 00 00 25d512f6

LOAD Parameter A = 229 229
LOAD INTEGER 32 229 32
&+ 261
MESSAGE SET delay=0, 0(8,5)000002e timer create 002 00 DLY=0000 0a 00 08 05 00 00 25d512f6

LOAD Parameter A = 229 229
LOAD INTEGER 1 229 1
&NEG 229 -1
&+ 228
MESSAGE SET delay=0, 0(7,4)000002e timer create 003 00 DLY=0000 0a 00 07 04 00 00 25d512f6

(0)RETURN


And other similar intstances of the DSA being executed with a listed state of some random 32 bit integer it seems like.

Any clue paul stevens?

-rain`
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Oh, yes. We have clues.
The next time i send a SET message to the DSA it should be in state 1 correct?
You end that line with 1MC. Why? You said you were already in state 1. So
why specify state 1 again? Moreover, if I remember correctly, it will not even
display that '1' in state 1 because it is the default. Moreover, how does that
send a message to 1 room left of A? 1MC should send a message to A. Did
you mean "1MC*"?

So. First you must answer these questions.

But did you realize that the FIRST command executed specifies the next
state. So if, for example you were in state 0, you might want to say:

Code: Select all

1LA L32 &NEG &+ MC*
to send a message left of A and then go to state 1 to receive the next message.
Guest

Post by Guest »

yes it was 1MC*, inside state 0 actually. I tried 1LA ... MC* and it worked. I assumed by putting a number before any Message command it would change the state afterwords. Now i know to just put it on the first command.

But I also ran into an issue with &GENERATORDELAY, it says the arguments are (target delay ... ). My DSA right now is:

MS M4S M8S M12S L1 L2 L3 LA 1984 &GENERATORDELAY

So the stack reads
1 2 3 (location A) 1984

I get an runtime stack underflow error.

Heres the snippet from trace =]

LOAD INTEGER 1 1
LOAD INTEGER 2 1 2
LOAD INTEGER 3 1 2 3
LOAD Parameter A = 3817 1 2 3 3817
LOAD INTEGER 1984 1 2 3 3817 1984
&

---
location 3817 is 3(23,9) which is correct, 1984 is a legatiment number to set the generator delay to..

I checked CSBwin 9.7 source code and sure enough it only pops twice, one target, one delay. Don't see a problem in your code at all so i must be doing something wrong! hahaha

-rain`
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Thanks for the report. There is a missing 'break' at the end of
that case clause. It fall into the next case and empties the stack.
I'll post a new CSBwin in a couple hours.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Veersion Alpha4 is in OverlayDemo.rar.
Post Reply

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