Page 1 of 1

Fun DSB fact...

Posted: Wed Nov 07, 2007 6:01 am
by Remy
In case anyone is keeping score, as of DSB .22 the base scripts define some 400 global functions (including dsb_*s - okay, so those aren't defined in the base, but I include them anyway; if you're wondering, they are about a third of that total), 60 or so global tables, and about 140 constants and assigned values.
Further, those 400 functions define 1039 arguments, so they average about 2.5 each. dsb_make_wallset has the most, at 20.

I'm not trying to make a point or anything, just illustrating how big DSB really is.

Posted: Thu Nov 08, 2007 8:06 am
by ian_scho
That's great!

Now pop this info in a wiki, documenting each function along the way, creating an über dsb-api. :lol:

Posted: Thu Nov 08, 2007 12:26 pm
by Joramun
All dsb_ functions are already documented here.
And exvars too...
True, I (or anyone) could start a project to fully comment DSB's lua code.
But exploring the code is also a good way to learn LUA and DSB at the same time.
I suggest using SCITE (scite is a greatly upgraded notepad with syntax highlighting for many languages)
Starting with : test_dungeon/ dungeon.lua, objects.lua, startup.lua
then : base/global.lua, startup.lua, graphics.lua, objects.lua
then the others, looking for the functions used in objects.lua (mainly in triggers.lua, util.lua, msg_handlers.lua ...)

Posted: Thu Nov 08, 2007 4:17 pm
by Trantor
Sorry to go off-topic, but where has your d gone Joramun?

Posted: Thu Nov 08, 2007 5:17 pm
by Joramun
My d has gone down a pit.

Ok, it seems it is bothering a lot of people. :roll:
A small tale : :D
My name is taken from a book, which I happen to have re-read a few weeks ago. :o
And I could verify the real character's name is "Joramun" not Joramund. :?
Hence the 'd' was simply an error. But since it seems so much people miss it, maybe I'll put it back. :lol:
But not just yet, I want to try without it a bit more, it feels lighter :P

Posted: Thu Nov 08, 2007 5:50 pm
by Remy
Now pop this info in a wiki, documenting each function along the way, creating an über dsb-api.
Can I just first say, I dislike this use of the acronym "API". Yes, I know that that makes me stuffy and dated, but a webpage cannot act as a programming interface unless you use a hefty web-scraper to poll the data. Otherwise, it's just documentation.

Secondly, you don't really believe I collected that data for nothing, do you? Obviously, I intend to do something with it.

Here's a couple of screens of a proof-of-concept test I did:
Code Completion

Intellisense

Now, obviously these are just basic tests - it's a long way from actually being anything productive.

Posted: Thu Nov 08, 2007 7:16 pm
by Sophia
:shock:

As for the documentation, there's already a fair bit of it... the core code that already exists is set up to make dungeons of the variety that we're all used to fairly easy to produce. So I'd say the best thing if you're trying to learn is to just dive in and start making something, and when you get an idea for strange mechanics that can't be done in default DM, find something close, see how that works, and make your own with slightly modified code.

Lua is actually a pretty easy language to learn. :)

Posted: Thu Nov 08, 2007 10:10 pm
by ian_scho
Yeah well I was joking, just a little bit. From what little I've seen of the code you provide helpful comments along the way - most unusual for a software developer! 8)

The intellisense thing can make things much easier, that's for sure. We could use notepad to write these files, but to have it colour formatted with prompts certainly helps. I have the Java api/documentation open most of the time at work, which is why I chirped up with the comment in the first place. Sophia's copy and paste and modify idea is how I learnt to code anyways :P

Posted: Wed Nov 14, 2007 12:25 am
by Remy
Sophia's copy and paste and modify idea is how I learnt to code anyways
I actually did alot of this the past few days, using a little utility I made, testing Lua integration. It's not overly complicated or all that useful, but it does give easy access to the functions in DSB's base files.

Screenshot

Basically, it uses a Lua script to pick out the functions in the base files (I've included those from DSB v.22, but you can swap them out -- check 'config.lua' for details) and puts them in a set of tables. The table is then parsed to an expandable treeview. Clicking on a function displays it's name, arguements, and the source-code so you can copy/paste it.

If you want it, you can download it here.

There's also a file for dsb_* functions, but it's not all that useful or complete.

Posted: Wed Nov 14, 2007 10:13 am
by ian_scho
Have you used a little 'bomb' symbol for the application? - You're a true DM pro! I remember seeing those on the AtariST for ChaosStrikes back when the app crashed.

Posted: Wed Nov 14, 2007 7:35 pm
by Sophia
That's the Lua symbol, I think.
At least, I think that's a more auspicious interpretation for that little symbol than something having to do with an app crashing. :P :wink:

Posted: Thu Nov 15, 2007 7:53 am
by ian_scho
lol Didnt think of it that way :wink:

Posted: Thu Nov 15, 2007 11:21 pm
by Remy
It's the Lua logo -- though considering how easy it is to crash, the bomb might have been a better choice. :)

I miss that bomb. I'd prefer it to blue-screens and that stupid "Send a Message to Microsoft" box.