DSA: check if false wall is open

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.
Post Reply
User avatar
ADDF_Toxic
On Master
Posts: 623
Joined: Wed Apr 27, 2005 2:43 pm
Location: Canada
Contact:

DSA: check if false wall is open

Post by ADDF_Toxic »

I was wondering if there's any way with DSA to check if a specific false wall is open or closed before doing some other DSA tricks. Thanks.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

Yes, if you check the documentation for using the @cell command you can check to see if the tile is a flase wall, and then if so do a further check to make sure it is visible or invisible
User avatar
ADDF_Toxic
On Master
Posts: 623
Joined: Wed Apr 27, 2005 2:43 pm
Location: Canada
Contact:

Post by ADDF_Toxic »

oh ok, I'll try that when I get a chance, thanks!
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

If I find the code I used for my dragon firebreating (it checked to see if a wall was fake or not, and if it was, and was 'present', it would blow it up into ashes) I will post it but it should be straightforward from the notes Paul has on his webpages

http://www.dianneandpaul.net/CSBwin/doc ... ation.html
User avatar
ADDF_Toxic
On Master
Posts: 623
Joined: Wed Apr 27, 2005 2:43 pm
Location: Canada
Contact:

Post by ADDF_Toxic »

lol I emailed that link to myself when I found it...thanks for posting it here anyway though...and thanks for that extra help too...(I can only figure out one paramater of it right now :O that's the location one)
I'm a boy, unlike my avatar.
User avatar
ADDF_Toxic
On Master
Posts: 623
Joined: Wed Apr 27, 2005 2:43 pm
Location: Canada
Contact:

Post by ADDF_Toxic »

I wrote:I emailed that link to myself when I found it
I suppose you're thinking "Why don't you just add it to your favourites?" lol, I was on the other computer when I found it, so I emailed it to myself so I can find it on my Dungeon Master computer...but anyway...

I'm working on figuring that out...lots of the stuff that he is talking about is still alien to my mind (like "put in the array starting at index 10, then the 3 says that 3 words of data are to be obtained."), but I'm sure I'll figure it out sometime...Ah, I am guessing that I have to type one &CELL@ for the false wall and then another &CELL@ for the state of it (somehow,,,)...I can't seem to link the information at the top of the page (the long description) to the info on the bottom (where the info about removable walls is)! But I don't have any more time to stare at this DSA window uselessly...but there's some more info that might be helpful for you to help me...I'm starting a tongue-twister there :O
I'm a boy, unlike my avatar.
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 DSA 'Engine' includes a 100-word array that
you can use to save/manipulate/recall data to/from.
The &CELL@ instruction puts the cell information
into that array. The words in the array are numbered
from 0 to 99. You have to tell the &CELL@ instruction
how many words of information you want and where
to put that information in the array.

All the information about a single cell is contained
in 10 or fewer words. What information is in what word
is described for each type of cell. After doing the &CELL@
you can fetch the results from the array by using
&@ instructions.

Once you understand the paradigm you will amazed at
its simplicity and, perhaps, slap yourself aside the head
for being so dim-witted. :wink:
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

If you read Paul's own explaination of DSA's at the start of the notes he makes it quite simply actually

Imagine that each time the DSA is run, a filing cabinet with 100 drawers marked 0 - 99 is created

When you call the command @cell, the three parameters are actually saying 'see that cell at location x? Well could you put it's y bits of information into the same number of drawers, starting at the drawer marked z (I may have the order of syntax wrong, sorry)

So then you can use another command, the &@ command, to look in the drawers and check out the information.

So you can look at the drawer storing the cell type value and using the command &= for 'is this equal to the number for false walls' and the jump command ?J<line> for 'if it is, then please jump to this line of code and carry on' to firstly check for a false wall, then do the same again to check the drawer holding the 'is it on or off' value.

And you understand that you put the parameters (telling the command what to do) the command, and that to load values into the temprary memory (it's like a notebook) you use the L<value> command

So for example:

L<location> L0 L5 &Cell@ actually means 'take the values associated with the cell at the location I've said, there are five values, please put the first in drawer '0'. Or, drawer '0' now has the tile type value, drawer 1 - 4 now has the information as detailed in the documatation for each tile type.

In your case, if the cell is a trick wall (ie drawer '0' contains the value 6) then drawer 1 will tell you it's sub-type (passable or not) and if it is open or closed.

So to check this, if say you were in DSA line 0S0 you would then say L0 &@ for (give me the value of drawer 0) then L6 &= for 'is it equal to six (False walls) then ?JC0 for 'if so, jump to line 0C0. Note it's important to put the ? or else the DSA will always jump, and note that if the answer is no then the code carries on doing anything after the command in that line, but then stops (so if you have nothing after the ?J<line> then nothing happens.

So in drawer 1, if you have a false wall, a value of:

0 = normal false wall (solid) that is present
1 = normal false wall that is not there (empty tile)
4 = illusionary (Walk through-able) wall that is present
5 = illusionary (Walk through-able) wall that is not there (empty tile)

So if i understand this correctly, you just care about a value of 0 for a solid fake wall that is present. So you would use

L1 &@ L0 &= ?J0T0 in line 0C0

Then, in line 0T0 you can put the code that you want for what happens if a wall is present at that location.

Another DSA trick si that each DSA has two permenant parameters whch can be targets or numbers, A and B you set in the editor. To get the value, you use LA or LB

To summarise:

Code: Select all

0S0: LA L0 L6 &CELL@ L0 &@ L6 &= ?JC0
0C0: L1 &@ L0 &= ?JT0 
User avatar
ADDF_Toxic
On Master
Posts: 623
Joined: Wed Apr 27, 2005 2:43 pm
Location: Canada
Contact:

Post by ADDF_Toxic »

Paul Stevens wrote:Once you understand the paradigm you will amazed at
its simplicity and, perhaps, slap yourself aside the head
for being so dim-witted.
Yeah, that will probably happen...thanks for the explanation on that
beowuuf wrote:In your case, if the cell is a trick wall (ie drawer '0' contains the value 6
There's where the six of trick wall I saw on the doc page comes in!
beowuuf wrote:Another DSA trick si that each DSA has two permenant parameters whch can be targets or numbers, A and B you set in the editor. To get the value, you use LA or LB
I figured that one out some time ago...it's much easier to set locations in there than it is to try and figure out the location from that confusing calculation...also useful when I need to do this in 16 different places in the dungeon, instead of writing out the whole thing 16 times.
OK, I think that makes sense now, so I'll try that when I get a chance...thanks for the help
I'm a boy, unlike my avatar.
User avatar
ADDF_Toxic
On Master
Posts: 623
Joined: Wed Apr 27, 2005 2:43 pm
Location: Canada
Contact:

Post by ADDF_Toxic »

Got a chance...I guess I should target it before it will work? *shakes his head in the air* It doesn't seem to be working...maybe I read something wrong...oh, 0T0 is where the code goes if there is a wall at that location (I want something to happen if the wall isn't there) woops! Let's see if this works better...nope, but I just realized that I wrote ?JS1 instead of ?JS2, so it must be looping the whole checking thing...let's see if that works! no, checking code again (wait, did I even save my changes?) apparently I did, it's still not working
I wrote:?JS1 instead of ?JS2
oh right, it starts at 0, maybe that was right! still didn't work
Here is an exported version of my DSA code...maybe you can spot an error that I can't see:

Code: Select all

Description = Return Skeleton Key
State = 0
StateLocation = 0
GroupID = 0
Number of States = 1
First Displayed State = 0
Number of non-empty states = 1
State Number = 0
Number of Actions = 3
S0 = LA L0 L6 &CELL@ L0 &@ L6 &= ?JC0
C0 = L1 &@ L1 &= ?JT0
T0 = L15 LB L438 &ADD
signature = CEEBB1AEA05BC4D12693D28DE47F4A5B
CSBWin DSA exporter wrote:Number of non-empty states = 1
What does that mean? It sounds like the same thing as "Number of States"
EDIT: No I'm not editing the main game and playing a save or vice verse, and there are no errors when exiting the DSA window.
I'm a boy, unlike my avatar.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

When I write DSAs I always make mistakes.
Generally I am very sloppy and rely on
debugging. So there is a way to see what
is happening in your DSA. Turn on DSA Trace
and each instruction will appear in the trace
along with its parameters.
User avatar
ADDF_Toxic
On Master
Posts: 623
Joined: Wed Apr 27, 2005 2:43 pm
Location: Canada
Contact:

Post by ADDF_Toxic »

Man, that should be really helpful. Thanks for that tip Paul! Let's see...Tracing->DSA Trace...where is it telling me what's happening? Is the trace the text at the right when the size is 1? All I see changing in there is my Total moves (goes up by 2 everytime I click the thing)...that and the ones at the top that change every second...
I'm a boy, unlike my avatar.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

Yes, the text shows alot of stuff, if you zero in on your DSA name, and just realise it is showing you every action.

The numbers in brackets will be what is on the stack - that's the temporary notepad all your numbers go

So for example you would see a large number,0,6 and then after you do your &CELL@ there would be no numbers in brackets until your next command

Number non-empty states is juts telling you how many of the 255 pages you are using - you are only using one, so it;s telling you you are using one

Three things i would say - are you targetting the DSA with an 'open' effect to the north face? Otherwise it won't work

Are you wanting to make sure a fake wall is not present on that tile? (You are checking if cell value in 1 is 1)

Are you sure the value of the skeleton key is 438? (might be best to recalcute - if the CSBwin is telling you it's ID is 438, realise this is in hex - it actually means 4 x 16 x 16 + 3 x 16 + 8 for the value


Oh, wait - are you removing a false wall with a skeleton key, and leaving the skeleton key on the empty tile? If so, quite cool
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

OOps, sorry, re-read - the text is a text file called trace000, trace001 you need to open in notepad, created i nthe folder with your dungeon
User avatar
ADDF_Toxic
On Master
Posts: 623
Joined: Wed Apr 27, 2005 2:43 pm
Location: Canada
Contact:

Post by ADDF_Toxic »

I was wondering if it would show me in a text file, and I'm not getting that, so that must mean it's not activating the DSA...but right after I shut off my DM computer earlier, I figured out my problem (I think...I hope): I still have the pushbutton activating something on the north side of the tile (nothing) not the south...I'm just about to try that...
beowuuf wrote:Oh, wait - are you removing a false wall with a skeleton key, and leaving the skeleton key on the empty tile? If so, quite cool
[offtopic]What I am doing is something like the skeleton stairs in original DM where you use a skeleton key on a skeleton lock to open the false wall and then inside the first one (wall on the first level), there is a chest with a few scrolls and a key. Thouch this key against the skeleton lock to close the wall and get your key back (using &ADD for the skeleton key and &CELL! (aah!) for the false wall, but that shouldn't be that complicated). This way, if you open a wall then decide that was a bad idea, then you can close it and use your key on another lock. The key can be used as much as you want...but that's off topic in the direction of a thread on my dungeon (there is none) or the "Any new dungeons on the way" thread...[/offtopic]

Wait a minute, it's already set to south, strange??? still not working, but at least I know the problem is in the pushbutton...changed it to north, not working, it is saying "Set"
beowuuf wrote:Are you wanting to make sure a fake wall is not present on that tile? (You are checking if cell value in 1 is 1)
Yes I am making sure the trick wall is invisible("1 = normal false wall that is not there (empty tile)"), I changed it to 1 in 0C0, never even thought that there might be somewhere else I need to change 0 to 1 also...
About the skeleton key ID, I recalculated the one that is sitting on an unaccessible square (so it's always there unless I teleport it for some reason), but there is another skelton key with a different ID (74 in decimal), but that one will disappear when the player grabs it and uses it.
Like I said, I've set the pushbutton target to north (even though I put the DSA on the south side of the tile, right against an open tile, like it's a wall ornate or something<' ><' >) and I'll try the DSA trace again to see if it's doing anything with that now...where's the trace file?:@ that must mean it's still not even finding the DSA (it's not working either) :twisted:
I'm a boy, unlike my avatar.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

DSAs ignore the facing of the object - you use north/south/east/west and set/upset/toggle to do the commands on S/C/T lines, ), 1, 2, 3

So set north runs line 0S0
Close north runs 0C0
Toggle south would run 0T2 et

So to start with you were activating a blank tile - ignore the DSA facing!

The trace file will just run, even if you are running no DSAs. So you aren't runnign the trace file

Ypu need to click on 'timer trace' and 'DSA trace' - if this is not intended, then it's an engine bug. The text file should then appear where the dungeon.dat file is

Hmm, maybe you should delay the pushbutton by 1 tick - the DSA may be running so fast that it still looks at the tile before the false wall disappears...
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

Oh, and you only need the '1' for checking a blank tile where you have it - don't play aroudn wit hthat code, it seems right
User avatar
ADDF_Toxic
On Master
Posts: 623
Joined: Wed Apr 27, 2005 2:43 pm
Location: Canada
Contact:

Post by ADDF_Toxic »

beowuuf wrote:the DSA may be running so fast that it still looks at the tile before the false wall disappears...
Let me just try to figure out what you think I'm doing...the thing doesn't run that fast. I open the false wall with my skeleton key, go inside where the false wall was, and then grab the chest with the solid key, take out the solid key, and then I touch the solid key to the lock. It has plenty of time to say "This wall is now open."
I will try turning on the DSA trace and the Timer trace...I don't know anything about traces :) If nothing works, I'll try the delay...and I won't play around with the code...except to add in my &CELL! that I will also need in 0C0.
EDIT: I will do all this when I get a chance, I am currently not on my Dungeon Master computer, so I don't have my dungeon with me...I don't even have CSBuild :)
I'm a boy, unlike my avatar.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

???

Why do you need &CELL! in 0C0? I forget what you can and can't toggle with that command, but easier to just target a normal message to that location using MCA or MSA if you are closing the wall again

Anything you add to 0C0 will either a) always run, or b) only run if the false wall isn't open ...
User avatar
ADDF_Toxic
On Master
Posts: 623
Joined: Wed Apr 27, 2005 2:43 pm
Location: Canada
Contact:

Post by ADDF_Toxic »

I'm talking about putting it in 0T0, not 0C0, so that it only closes if it's already open...if it's already closed, it won't do any difference anyway...and I always thought triggering a normal message would be just as complicated as closing the wall through DSA...it sounds like almost the same thing as &CELL@ but instead of fetching the value of the cell, it changes it (so I can change it to blocking)
Oh, woops! I didn't mean to say 0C0 in that last post, sorry, what was I thinking? Get a brain, Tox! I meant to say 0T0, as you may have been able to infer from the rest of this post.
I'm a boy, unlike my avatar.
User avatar
ADDF_Toxic
On Master
Posts: 623
Joined: Wed Apr 27, 2005 2:43 pm
Location: Canada
Contact:

Post by ADDF_Toxic »

I guess if it doesn't really matter if the wall is open or closed before I close it (if it's open, close it...if it's closed, closing it keeps it closed), I could just tell my lock to activate the DSA that returns the key as well as (the lock) closing the wall...that way I don't need to mess around with DSA to close the wall...
I'm a boy, unlike my avatar.
User avatar
ADDF_Toxic
On Master
Posts: 623
Joined: Wed Apr 27, 2005 2:43 pm
Location: Canada
Contact:

Post by ADDF_Toxic »

Well, got the trace file...oh, boy, that does tell me everything...WOW, find the DSA and it looks pretty cool! Found my problem, maybe I do need to delay it

Code: Select all

  &Fetch  (6)
  LOAD INTEGER 6  (6 6)
  &=  (1)
  QUESTION (true) Jump 0C0 ()
  LOAD INTEGER 1  (1)
  &Fetch  (0)
  LOAD INTEGER 1  (0 1)
  &=  (0)
  QUESTION (false) Do Nothing ()
So it gets to 0C0, but it doesn't seem to think the wall is there...ooh, I also closed that wall at the same time as I activated the DSA, so that's probably what it's reading, maybe I'll delay closing that wall...I'll try the trace again with that...newer code

Code: Select all

DSA Return Skeleton Key State 0 MSG 0
(0)Execute DSA at 0(31,30) master at 0(31,30) state=0,msg=0
  LOAD Parameter A = 663 (663)
  LOAD INTEGER 0  (663 0)
  LOAD INTEGER 6  (663 0 6)
  &Cell@ { 6 4 0 0 0 0} ()
  LOAD INTEGER 0  (0)
  &Fetch  (6)
  LOAD INTEGER 6  (6 6)
  &=  (1)
  QUESTION (true) Jump 0C0 ()
  LOAD INTEGER 1  (1)
  &Fetch  (4)
  LOAD INTEGER 1  (4 1)
  &=  (0)
  QUESTION (false) Do Nothing ()
(0)RETURN ()[14]
I included more this time...this is after I put a delay on the closing of the wall (the delay is 1). I notice 1.5 differences (the second one follows the first). First, at the last &Fetch, it is followed by 4, not 0. Second, 0.5, the LOAD INTEGER right after that is 4 1 not 0 1...it's the same change (0 to 4)...WOW! It's starting to make sense...it's fetching 4 in 0C0...but why? It's not an "illusionary (Walk through-able) wall that is present "!!! I wonder how it would work if I said "If it's 4 then go to 0T0"...that might be a cheaters method...unless u got the wall types mixed up...IT WORKED IT WORKED! :):D I did mess with that code a bit...but I fixed it.
Thanks for the original help and all that extended help to try and fix my problem...I'll remember that DSA trace trick, Paul!
I'm a boy, unlike my avatar.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

yes, it's seeing a closed illusionary (Walk throaughable) wall instead of a solid fake wal!

did I mix up which bit means what? Check the cdocumentation for &cell, perhaps I gave you the wrong values for open/closed illusionary/solid :(
User avatar
ADDF_Toxic
On Master
Posts: 623
Joined: Wed Apr 27, 2005 2:43 pm
Location: Canada
Contact:

Post by ADDF_Toxic »

I did check the documentation...Your values were much more descriptive than the ones in the documentation...but looking back at it, it did seem kind of like what I discovered is right, but I'm still not quite sure, they still both look like the same thing :O
beowuuf wrote:perhaps I gave you the wrong values for open/closed illusionary/solid :(
Don't worry, I don't expect you to know everything :)
I'm a boy, unlike my avatar.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

whew, cause I don't!

I think for now if it works then yes, cheat... hopefully someone can then point out later which assumption, or what dungeon thing was wrong
User avatar
ADDF_Toxic
On Master
Posts: 623
Joined: Wed Apr 27, 2005 2:43 pm
Location: Canada
Contact:

Post by ADDF_Toxic »

beowuuf wrote:hopefully someone can then point out later which assumption, or what dungeon thing was wrong
Hopefully
I'm a boy, unlike my avatar.
Post Reply

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