Fun DSB fact...

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting. You may Image to help finance the hosting costs of this forum.
Post Reply
Remy
Craftsman
Posts: 111
Joined: Wed Sep 05, 2007 5:24 pm
Contact:

Fun DSB fact...

Post 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.
User avatar
ian_scho
High Lord
Posts: 2807
Joined: Fri Apr 07, 2006 8:30 am
Location: Zaragoza, Spain

Post 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:
User avatar
Joramun
Mon Master
Posts: 927
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Post 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 ...)
What Is Your Quest ?
User avatar
Trantor
Duke of Banville
Posts: 2467
Joined: Wed Mar 09, 2005 4:16 am
Location: Berlin, Germany
Contact:

Post by Trantor »

Sorry to go off-topic, but where has your d gone Joramun?
User avatar
Joramun
Mon Master
Posts: 927
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Post 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
What Is Your Quest ?
Remy
Craftsman
Posts: 111
Joined: Wed Sep 05, 2007 5:24 pm
Contact:

Post 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.
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post 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. :)
User avatar
ian_scho
High Lord
Posts: 2807
Joined: Fri Apr 07, 2006 8:30 am
Location: Zaragoza, Spain

Post 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
Remy
Craftsman
Posts: 111
Joined: Wed Sep 05, 2007 5:24 pm
Contact:

Post 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.
User avatar
ian_scho
High Lord
Posts: 2807
Joined: Fri Apr 07, 2006 8:30 am
Location: Zaragoza, Spain

Post 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.
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post 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:
User avatar
ian_scho
High Lord
Posts: 2807
Joined: Fri Apr 07, 2006 8:30 am
Location: Zaragoza, Spain

Post by ian_scho »

lol Didnt think of it that way :wink:
Remy
Craftsman
Posts: 111
Joined: Wed Sep 05, 2007 5:24 pm
Contact:

Post 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.
Post Reply