Questions about DSB/ESB

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

Re: Questions about DSB/ESB

Post by Sophia »

Yes, the subrenderer size is hardcoded. There is a bunch of code, mostly related to the resurrection/reincarnation interface, that is expecting things to be a certain size, so the clickzones can go in a certain location. At some point, I'll go digging around and clean this all up, but don't hold your breath.
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

OK, glad I checked, I was going to do something fancy with a larger one. I'll leave it well alone...! :-)
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: Questions about DSB/ESB

Post by Mon Ful Ir »

Okay, I'm now officially intrigued to see what interface Gambit is in the process of cooking up. :)

At this rate we're not far short of being able to clone Eye of the Beholder with the DSB engine.
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

Don't expect any major changes. DSB core is still tied into rendering the DM interface, so anything majorly different isn't really possible. (Currently anyway ;-) )
Some elements can be customised quite well, such as the runes interface or the movement arrows, but stuff like the inventory screen and the portrait areas/stat bars are not fully editable yet as they are handled by the core -- well, as far as I can tell anyway.
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

Next question: is it possible to override a scroll's default subrenderer, and instead show a fullscreen renderer? I'd like larger scrolls with longer messages, those DM ones are so tiny!

Another question: I remember a test dungeon that had a subrenderer showing a poison bar with green markers -- anyone know where that is?
User avatar
Sophia
Concise and Honest
Posts: 4249
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Questions about DSB/ESB

Post by Sophia »

Gambit37 wrote:Next question: is it possible to override a scroll's default subrenderer, and instead show a fullscreen renderer?
Yes, that's not that difficult.
You could give it an attack method that triggers a fullscreen renderer, or place it in the on_look event, or both!
(EDIT: Wrong event name)
Gambit37 wrote:I remember a test dungeon that had a subrenderer showing a poison bar with green markers -- anyone know where that is?
That was the old test_dungeon. I never bothered to port that over because it really was a terrible hack.

Since DSB gives you full control over the drawing of the food and water bar subrenderer now, if you want to do something like that, you're really better off just putting it all in that code.
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

OK. But I don't think I can pass exvars from the scroll arch to the full-screen renderer though?
User avatar
Sophia
Concise and Honest
Posts: 4249
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Questions about DSB/ESB

Post by Sophia »

Well, no. But there are plenty of ways around that.
A temporary global variable will work well, I think.
(You are only going to be invoking one fullscreen renderer at a time, so it shouldn't create any real problems.)
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

Right, that makes sense. I'll give it a go, thanks :-)

Last question for today: can DSB read external text files? I think for long strings of text (for a scroll) it may make more sense to store it externally for easier editing...
User avatar
Sophia
Concise and Honest
Posts: 4249
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Questions about DSB/ESB

Post by Sophia »

No, but that doesn't mean you can't create something called strings.lua that only contains your text strings.

Code: Select all

strings = {
   my_scroll = "Some text! You can write a big long string if you want.",
   another_scroll = "Another scroll. All the strings are here so it's easy to edit."
}
Then just set it up to use an entry in strings rather than using an exvar directly.
(i.e., instead of using exvar[id].text, use strings[exvar[id].string], or whatever)
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

Perfect! :-)
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

In the wiki, there's a dsb_wakeup() but I can't find an associated dsb_sleep(). How do I send the party to sleep?
User avatar
Sophia
Concise and Honest
Posts: 4249
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Questions about DSB/ESB

Post by Sophia »

Gambit37 wrote:How do I send the party to sleep?
You can't.

I honestly couldn't think of any time when this would be needed. 8)
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

OK, let me phrase it another way ;-) Is there a way of moving the zZZ button out of the inventory and into the main interface area, so it's always available?
User avatar
Sophia
Concise and Honest
Posts: 4249
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Questions about DSB/ESB

Post by Sophia »

Gambit37 wrote:Is there a way of moving the zZZ button out of the inventory and into the main interface area, so it's always available?
Oh, I get it now. :mrgreen:

Not at the moment. I'll look into this, too!
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

I'd like to create a creature that both walks and flies. But I'm not sure how to get it to swap 'modes' and bitmaps?
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: Questions about DSB/ESB

Post by Mon Ful Ir »

Create flying_creature and walking_creature as separate monsters and have triggers or attack modes that swap them?
User avatar
Sophia
Concise and Honest
Posts: 4249
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Questions about DSB/ESB

Post by Sophia »

That's how I'd do it, too. :mrgreen:
User avatar
ian_scho
High Lord
Posts: 2807
Joined: Fri Apr 07, 2006 8:30 am
Location: Zaragoza, Spain

Re: Questions about DSB/ESB

Post by ian_scho »

I'd appreciate it if you didn't swapped their HP values as well ;)
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

Looks like dsb_qswap(id, new_arch) does what I need, and will preserve the HP. Nice :-)
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

Is there a way of looping a monsters move sound? When I tried it, the sounds remained playing all over the map, even though the monsters were now dead (makes sense I guess). Basically, I'd like the sound to repeat while the monster is stationary, but then reset and start again when it moves. Think in terms of a bee buzzing... it doesn't only buzz when it moves from tile to tile, but continuously.
User avatar
Sophia
Concise and Honest
Posts: 4249
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Questions about DSB/ESB

Post by Sophia »

Gambit37 wrote:Is there a way of looping a monsters move sound?
No, but I'll add this for the next version.
(It's complicated enough it's best integrated into the base code instead of something you patch in yourself)
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

Cool, thanks :-) I got my flying/walking creature working, it all works really well. So much better than RTC for this sort of thing ;-)
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

Is it possible to dynamically change the bitmaps/speed of animations used by an instance of a creature? I know I can do animations at the setup stage, but then all creatures animate in sync which looks un-natural when they are in groups.
User avatar
Sophia
Concise and Honest
Posts: 4249
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Questions about DSB/ESB

Post by Sophia »

Ok, another one that is best handled as a feature request.
The current animation system is kind of a mess anyway. It'll be a lot cleaner internally in DSB 0.53.
(End users won't notice anything if I did it right)
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

Sorry, I don't mean to keep adding to the list...! :oops:
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

How do I pass an array of gfx entries to dsb_animate()? Seems like it won't accept an array as a passable parameter and that I have to write out the full list of frames? I'm trying to build an array like gfx.frame00, gfx.frame01, ... etc using a loop to avoid having to hard code names in my source.

When I pass an array, DSB crashes:

Code: Select all

PROGRAM CRASH!
Location: -5 0 0
Reason: Segmentation Fault
Stack Dump:
DSBmain
manifest_files
execute_stacktop_manifest
src_lua_file(dungeon/_lua/ui_title.lua)
src_lua_file.pcall
lua.dsb_animate
setup_animation
This is my code, it creates both a string and an array. Neither can be passed to dsb_animate without it crashing:

Code: Select all

snow_frames = ""
snow_array = {}
for i = 0,63 do
	label = "snow"
	if (i < 10) then label = label .. "0" end
	label = label .. i
	gfx[label] = dsb_get_bitmap(path .. label)
	-- Create a string of frames
	snow_frames = snow_frames .. "gfx." .. label
	if (i < 63) then snow_frames = snow_frames .. "," end
	-- Create an array of frames
	snow_array[i] = "gfx." .. label
end
User avatar
Sophia
Concise and Honest
Posts: 4249
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Questions about DSB/ESB

Post by Sophia »

You set it up wrong. I should probably figure out why this just goes ahead and tries to use the bad input and crashes rather than printing an error, but anyway, you're passing it an array of strings when what you really want are graphics table entries:

Code: Select all

snow_array = {}
for i = 0,63 do
   label = "snow"
   if (i < 10) then label = label .. "0" end
   label = label .. i
   gfx[label] = dsb_get_bitmap(path .. label)
   -- Create an array of frames
   snow_array[i+1] = gfx[label]
end
gfx.animated_snow = dsb_animate(snow_array, 0, delay)
The 0 in the call to dsb_animate is the number of frames parameter, which is not needed and ignored when you're passing a table.
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

Argh, right, that's me totally once again misunderstanding the difference between a string ("gfx." .. label) and the actual pointer to the graphics entry (gfx[label])
I *keep* doing that. Mostly I find it and fix it, but I just didn't spot it this time :(
User avatar
Gambit37
Should eat more pies
Posts: 13728
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about DSB/ESB

Post by Gambit37 »

Does an object's TYPE affect its rendering in the viewport in any way? For example, does setting to FLOORFLAT rather than FLOORUPRIGHT change the rendering order of items on a tile?

Similarly, does the CLASS affect rendering order?
Post Reply