Creating a new object with DSAs

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
zoom
Grand Master
Posts: 1819
Joined: Tue Sep 23, 2003 1:27 am
Location: far away but close enough

Post by zoom »

I want to use a DSA to emulate T0Mi's example
on dmwiki about the torch maker.

I have 2 pushbuttons that react to special objects.

Sticks let the first pushbutton send (set, north) S0 and
ashes let second pushbutton send (clear, north) C0 to
this DSA:


Description = return excess stickS or ashes and wait or yield torch and reset
State = 0
StateLocation = 0
GroupID = 0
Number of States = 3
First Displayed State = 1
Number of non-empty states = 3
State Number = 0
Number of Actions = 2
S0 = 1N
C0 = 2N
State Number = 1
Number of Actions = 2
S0 = L1 &NEG LB L1 LA L15 L32 F &ADD
C0 = 0L1 &NEG LB L0 LA L15 L32 F &ADD
State Number = 2
Number of Actions = 2
C0 = L1 &NEG LB L2 LA L15 L1024 F &ADD
S0 = 0L1 &NEG LB L0 LA L15 L32 F &ADD
signature = D183EA6FD180450465519E5ABCFA7C31


I have a cell (LA) where I put the stuff to be copied.
Ashes (L2)below a Stick(L1) below a Torch(L0).
Position is irrelevant(L15 = north1+east2+south4+west8)
Torch is on top, Stick next and Ashes on the bottom of the pile.

Problems:
The DSA does not have the cursor as a resulting spot
where the torches or the excess sticks or excess ashes
should definitely appear.

Instead they appear on the ground and
only with some strange time delay!
I guess the &neg is somehow omitted.
I cannot remove the space between L1 &NEG

Furthermore I think something is wrong, because
I cannot add &OBJECTID &DROP after each productive line
as some examples showed.
like this:
L1 LB L0 LA L15 L1024 F &ADD &OBJECTID &DROP
(this example was from move key from A to B)
I don't get why use &OBJECTID and &DROP it
afterwards from the stack but that just for a side note.

------------------------------------------------------
------------------------------------------------------
Long talk, I turned on Tracing and DSATrace and
it seems the possession of my cursor gets duplicated.

I was so close :cry:
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, what fun. But you have selected
a nice example. I will install your DSA
and see what I can discover about its
inner workings. One does not read this
stuff as one would read a newspaper
column.
they appear on the ground and
only with some strange time delay!
I wonder if this is because nobody bothered
to tell the graphics engine that something
changed.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

That usually only happens with items in the hand/inventory since the refresh is only supposed to happen when items transfer I guess, items on the floor appeared instantly whenever I did anything

First question - what is LB? What value have you assigned this, or have you actually assigned it?

I remembered the negative numbers were body positions for &add - so are your hands full when you try to add the item? If so, it will appear on the ground. Odd about the time delay though, it should be instant

I assume the getting bject ID must be a diagnostic tool or a hook so you can tell what item you have created or go on to monitor it with another DSA?
User avatar
zoom
Grand Master
Posts: 1819
Joined: Tue Sep 23, 2003 1:27 am
Location: far away but close enough

Post by zoom »

Beo thanks for your tips and questions.

LB is a selected cell in the dungeon and also a number.
see:
http://members.at.infoseek.co.jp/danmas ... %20Integer
It is the "target location" of the DSA.
THe place where the thing's ID (from F)
should be &ADDed to the cursor

All I want is to put things(stick and ashes) into the grate.
Then get a torch in return to cursor.

The thing is, I wanted to give excess sticks and ashes back
to the player's hand when the DSA had already received
a message from the pushbutton corresponding to the item.
(Ashes or Stick)

So you put the stick in the pushbutton (grate)
and if you already put one there before, you
would (instantly?) get a stick back to your cursor.

So the theory... I had the cursor not occupied.
I think there is no time to collect something ..
Then again, if the cursor would be full, it would only
make sense to have some location to put the things,?LB?
even if the party moved in the meantime.

I reckon the F's purpose is to get the OBJECTID for
&ADD command of an existing object.
see:
http://members.at.infoseek.co.jp/danmas ... ntax.htm#F
http://www.dianneandpaul.net/CSBwin/doc ... mmand.html
(here you get info about the output. That is right to the "...")

http://members.at.infoseek.co.jp/danmas ... ator%20add
http://www.dianneandpaul.net/CSBwin/doc ... rator.html
I don't know of any way to copy things out of nowhere.

here an overview page, because it does not hurt much:
http://www.dianneandpaul.net/CSBwin/doc ... guage.html
I do not know about monitoring etc.. :)
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 wiki has DSA Lesson 6 with a working
example of the Torch construction.
User avatar
zoom
Grand Master
Posts: 1819
Joined: Tue Sep 23, 2003 1:27 am
Location: far away but close enough

Post by zoom »

Doh! I overread the part posMsk is then ignored.
Furthermore I mixed the order up.
Why the need for a posMsk when the cursor is not
bound to a position..now clear as dumplings' soup

@Beo: note if something is already carried in the
cursor, the engine won't put anything anywhere!
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

I thought you were putting it into a character's hand, not the mouse cursor - I was rushing off for work so didn't check the documentation. Still good to know though.
User avatar
zoom
Grand Master
Posts: 1819
Joined: Tue Sep 23, 2003 1:27 am
Location: far away but close enough

Post by zoom »

Just found another flaw in the dungeon cell
where I had put the items. It should be a wall
and not an open space! Well, it worked now. YAY :)
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

zoom wrote: It should be a wall
and not an open space!
It should work in an open space.
0 NW, 1 is NE, 2 is SE, and 3 is SW.
User avatar
zoom
Grand Master
Posts: 1819
Joined: Tue Sep 23, 2003 1:27 am
Location: far away but close enough

Post by zoom »

It is then possible to define more "positions" ?
like NW + SW in Fetch?
in an open cell you cannot add the values
NW + NE would be 0 + 1 that is 1 (NE!)
It is probably best to forget about more than
one position in a cell..
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

In places you can do this, it is assigned thus:

Position 0 = 1
1 = 2
2 = 4
3 = 8

Hence the highest value is 15, all the positions, and the lowest 1, which is north/north west
User avatar
zoom
Grand Master
Posts: 1819
Joined: Tue Sep 23, 2003 1:27 am
Location: far away but close enough

Post by zoom »

position isn't integer!?

Code: Select all

N | E | S | W
Default is N.
A position within a dungeon cell.  In a wall it means North, East, South, or West.  In an open cell it is NW, NE, SE, or SW.  When converted to numbers, N is 0, E is 1, S is 2, and W is 3.
So all you have to take care for is, in case of F:
posMsk

Code: Select all

<integer>
This integer is a bit mask.  The bits and their respecive values are:

0 1 North
1 2 East
2 4 South
3 8 West

You add values to specify more than one allowed position.  For example, to specify positions East and South you would write the sum of the values of East and South.  2 plus 4.  In other words 6.  To specify North or West you would write the sum of 1 and 8.  That is 9.
Then N(wall) is NW(open space) , each would be 1.
Depending on the cell you put things they would be
N or NW and so on..
There is no N + NW !! Only N+E or NW +NE
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

Exactly, a tile cannot be a wall and floor at the same time!

Glad to see it's all coming together for you
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

zoom wrote:Depending on the cell you put things they would be
N or NW and so on..
You see why this is, do you not?

In a wall, the objects would be displayed
in alcoves in the centers of the walls.

In an open cell, objects are always placed
in the corners of the cell.
User avatar
zoom
Grand Master
Posts: 1819
Joined: Tue Sep 23, 2003 1:27 am
Location: far away but close enough

Post by zoom »

I did not know. But now that you
mention it , it is rather logical!!
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

Ooh, while my desktop PC is actually online:

Code: Select all

S0: L0 &@ L0 &CHPOSS L1 &NEG &= ?J0T3 L0 &@ L1  &CHPOSS &TYPE ??{(50004,C0)(50017,C0)(50021,C0)(50024,S1)(50029,C1)(50035,C1)(60006,C1)}
C0: L0 &@ L0 L3 &MASTERY L10 &< ?JT0
T0: L0 &@ L30 L12 &CHAR@ L41 &@ L256 &% L70 &< ?JC1
S1: L0 &@ L30 L12 &CHAR@ L41 &@ L256 &% L130 &< ?JC1
C1: L$ L15 &SAY L1 L1 &!

T3: LT LW LO LH LA LN LD LE LD LC LH LE LC LK LS
Right, this was my two handed weapon check sub-routine (i simply G48 to it at the start of the party attack filter). You can see how I comment my DSAs - I use the L to create harmless parameter calls :D

So, there is the recogniseable left hand check first. In my case, if the left hand was free, who cared. In your case zoom, you wanted to have more damage done with a free hand on certain weapons, so you would want to jump to a separate routine where you then checked for one handed weapons that could do more damage now.

Anyway, I then do the right handed check, I had split weapons into several categories, ones that just needed two hands to use or else(jump directly to C1), ones that needed a very high strength (above 130) to use one handed (S1 check) and ones where a high-ish strength (70) or fighter level (master) could bypass the two handed requirement (C0/T0 checks)

The C0 call is checking for a high enough fighter level. If it doesn't find that it moves on to the 70 strength check. Not finding that, on to C1

Similarly, the S1 check is just looking for 130 strength.

C1 is the reject line - if you don't meet the requirements for that weapon, then it negattes the attack, but first prints to screen a message using &SAY. I think simply 'you need two hands to use this item'
User avatar
zoom
Grand Master
Posts: 1819
Joined: Tue Sep 23, 2003 1:27 am
Location: far away but close enough

Post by zoom »

have to read that carefully slice by slice.
Many new things there!
all in all nice ideas, Beo. 130 Str is overkill! ;)

As said, I only quickly read through.
(you could circumvent this STr check
by quaffing str potions, neh?
Would there be a way to refer to
normal , initial str of a champion?)

I would like to tell the players a bit
more about what to expect roughly from weapons.
readme or in game.. finding the str thing out by
oneself would be a bit hard. But on the other
hand no need to tell players everything
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

Eh, think you can see the unmodified strength, but i think the point of a strength potion is to allow you do do these feats. I think to see thier unmodified strength it is the next number across, or perhaps it is the other half of that number (I can't recall why I used the L256 &% to get the first half of the number now)

You can always hint by putting &SAY for failure the first time (Saying ' i don't feel strong enough to weild this')

But yes, sometimes funto let the players work stuff out themselves (liek conflux does)
Post Reply

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