Paul Stevens wrote:Sophia, are you ready for this? Will you have a tool to convert DSAs to LUA code?

Moderator: Sophia
Paul Stevens wrote:Sophia, are you ready for this? Will you have a tool to convert DSAs to LUA code?
Code: Select all
LA L2147485696 &THISCELL L0 L17834 L15 L16 F
Code: Select all
LA();
L(2147485696);
aTHISCELL();
L(0);
L(17834);
L(15);
L(16);
F();
Code: Select all
void L(int i)
{
stack[--sp] = i;
};
That was just an example of how you mightFor example, I've never heard of the filter/opcode/etc
Me too.Paul Stevens wrote:It would be a lot of work on your part. I'd help.
Not me, but other people might extend it.Paul Stevens wrote:But the only value that I can
see is that it would make Conflux a more easily
extended game. And zyx is talking about not
extending.
There are relatively few functions that interact with the external world of a DSA:Paul Stevens wrote:Mostly, for Conflux, it has become a method of
'hooking into the code'. I call them 'filters'. The
DSA scripts filter the wired-in actions and modifies
them.
Code: Select all
ADD (posMsk <location> obj ...) ;Add item to dungeon
&CAST(...) ; Cast spell using previously stored parameters
&CAUSEPOISON ( poisonValue Char# ... )
&CELL! (location index num ...); Set info about dungeon location
&CHAR! ( char# index num ... ) ; Set info about a character
© ( idSrc idDst ... ) ; Copy an object (eg: Change Actuator target.)
&CREATECLOUD(<location> type size ... )
&DEL (obj <location> ...) ;Delete from dungeon
&DELMON (<location> index ... ) ; Delete single monster from group of more than one
&FILTEREDCAST(...) ; Cast spell (with filtering) using previously stored parameters
&INSMON (<location> position ... ) ; Insert single monster into group
&MONSTER! (id index num ...) ;Set monster information
&MOVE ( <source> <destination> ... ); Move item within game.
<source> and <destination> are identical. Each with 5 parameters.
( locationType objMask positionMask location depth )
&SWAPCHARACTER ( charIndex fingerPrint ... successFlag )
&TELEPORTPARTY (<location> ... )
&THROW (type objectLocation launchLocation direction range damage delta ...)
-----
In this form, in all honesty, it's not hugely helpful. However, the fact that this exists is very helpful, as it means there is code somewhere that can take all of the important parts of the dungeon and output them-- which in turn means that changing it so that it is output in a form that is much more friendly to DSB might not be such a terrible task.Paul Stevens wrote:Would it help if we were to start with an
ASCII representation of the Conflux Dungeon?
http://dianneandpaul.net/CSBwin/AsciiDump.txt
I think you are wrong. Writing a program external toIn this form, in all honesty, it's not hugely helpful.
I bet zyx could be a big help. It is a one-time thingfigure out just what all of those wall/floor/door decoration types, monster types, etc. numbers meant.
Oh, I agree that making large changes to CSBwin in order to produce code that is directly useful in DSB would be entirely too much work and probably not the best approach. However, the thing that is going to help us a lot here is that a DSB dungeon is actually just an ordinary Lua program and does not need to look anything like something ESB (the editor) saves in order to be useful to DSB. That is to say, I was thinking of pretty much only superficial changes to what CSBwin output. If this dump was in a form that looked like calls to Lua functions, that would be enough. All that would be missing would be understanding of what the type numbers meant. I think that doing the reformatting within Lua code that is parsed directly by DSB will be even easier than an external program, too.Paul Stevens wrote:I think you are wrong. Writing a program external to CSBwin to reformat this information would be a lot easier than changing CSBwin itself to reformat this information. What you see is the raw data. It needs to be reformated for DSB. Reformating it within CSBwin would require a lot of code that would be useless when playing the game.
All I really need is an ASCII dump in a form that looks like a Lua program, where each section is the name of a function, and each line of data is a call to that function. To avoid any namespace problems we should probably put it all in a "convert" table. But anyway, instead ofYou would have to tell me what you need.
Code: Select all
##Level Information
#
#level width height x0 y0 numRanWall numRanFloor ExpMult doora doorb
0 31 31 0 0 1 2 0 0 1
1 31 31 0 0 2 2 2 0 1
Code: Select all
convert.level_information(0, 31, 31, 0, 0, 1, 2, 0, 0, 1)
convert.level_information(1, 31, 31, 0, 0, 2, 2, 2, 0, 1)
Code: Select all
##Database 3 = Actuators
#
# index link type Options
0 16902 <Pressure Pad> OpBy:PartyMovesOrTurnsSouth Target:(01,00)0 Graphic:0 OO:Yes Sound:No Delay:0 NC:No Msg:Clear
Code: Select all
convert.actuator(0, 16902, "Pressure Pad", { opby = "PartyMovesOrTurnsSouth", target = { 0, 1, 0 }, graphic = 0, OO = true, sound, = false, delay = 0, NC = false })
Yes, I agree.Paul Stevens wrote:I bet zyx could be a big help. It is a one-time thing that needs doing. He did offer to help. I don't think it will be as daunting to him as to you.
You're probably right.Paul Stevens wrote:Notice that no DSA information is included in the dump I posted. I believe that the DSAs will be the daunting task.
Ok, I agree.Paul Stevens wrote:Another way of saying what I'm trying to say....The raw data is in a very arcane format....almost enciphered. Dividing the job into deciphering and reformatting makes each job easier. CSBwin is attempting to decipher. It is far from complete, by the way. Not all the information is in that dump you see.
Ok, sounds good. These are the basic "rules" I would like to follow. It's mostly mangling various fprintfs so I'm hoping they're not too troublesome.Paul Stevens wrote:Can we start by making a dungeon? With all the levels and at least some of the
contents? You say you have figured this out to some extent. Start there.....if you want CSBwin to be less wordy, or put semi-colons where there are commas, or put function-names and parameters around lines, or whatever, speak up. What I cannot easily do is combine information from several of these tables into a single, more coherent mess. The individual lines can be formatted however we please. I can certainly make each into a function call with string parameters very easily. Then we can try to tighten it up into well-defined values if it makes sense to do that.
Code: Select all
821 7043 <And/Or> Graphic:1 Delay:0 OO:Yes NC:No Target:(23,11)0 Initial:0 Final:15 Msg:Set
Code: Select all
convert.actuator(821, 7043, "And/Or", { graphic = 1, delay = 0, oo = true, nc = false, target = { 23, 11, 0 }, initial = 0, final = 15, msg = "Set" } )
Ok, thanks.Paul Stevens wrote: "OO" means only once.
"NC" means normally closed. ie: toggle the
outout from 'Set'/'Clear'. Sorta.
Of course. I'm travelling by plane in a few minutes, though, and I won't able to connect to the forum for a week.Zyx, when you have some time, can you help here?![]()
OK, I'll document a few DSA for a try.Zyx, another way you could be a great help is, of course, explaining what the various DSAs of Conflux are actually intended to do.
Code: Select all
convert.level( {level= 0,size={32,32},offset={ 0, 0},numRanWall=1,numRanFloor= 2,expMult= 0,doors={ 0, 1}} )
Code: Select all
convert.actuator(index= 386,link= 4043,PressurePad(OpBy=Object=147,Target={08,05,0},Graphic=0,OO=true,Sound=false,Delay=1,NC=false,Msg=Set))
Code: Select all
convert.actuator({index= 386,link= 4043, type="PressurePad", OpBy="Object", OpByArgument=147, Target={08,05,0}, Graphic=0, OO=true, Sound=false, Delay=1, NC=false, Msg="Set"} )
Enjoy your trip.Zyx wrote:Of course. I'm travelling by plane in a few minutes, though, and I won't able to connect to the forum for a week.
Ok, I can see there is good reasoning behind that, but in my opinion calling this PressurePad function and passing its return value to the master convert.actuator function is the wrong way of achieving this separation. I'd rather make actuator a table rather than a function and build the functions into it:Paul Stevens wrote:The various actuators are so different that I thought it best to use different functions for them. Couldn't you provide a function named "PressurePad" that would return whatever table you like? Certainly a parameter to a function can itself be a function call.
Code: Select all
convert.actuator.PressurePad( { index= 386, link= 4043, OpBy="Object", OpByArgument=147, Target={08,05,0}, Graphic=0, OO=true, Sound=false, Delay=1, NC=false, Msg="Set"} )
I was going to use the integer provided as an index into an array to get the item information. So I agree with you but I've just got a different method in mind (#define doesn't exist in Lua) so I'd rather just have integers. The array will be changed just as easily as the defines, though, so it'll still avoid the bad practices.Paul Stevens wrote:I thought the CT0049 might be actually better so tha you could define the various contstants at the front of the program (#define CT0049 "HELM" or whatever). Generally goo practice not to put numeric constants in programs. But I can do whatever you think best.
Great.Paul Stevens wrote:The other things you suggest are easily done.
I agree with zyx that there is no way these can beYeah, I'm not sure about the DSAs...
What whole business?Paul Stevens wrote:I personally think that this whole business is a lost cause.
Getting Conflux to run in DSB.What whole business?
I do. That is why I am willing to help. And that is whyload CSBwin dungeons into DSB, don't you?