(fixed) An 'on_move' error and some other random things...

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

(fixed) An 'on_move' error and some other random things...

Post by Remy »

First, I had a crash with this error:
FATAL LUA ERROR: Lua Function sys_ai_near: base/monster_ai.lua:892: attempt to call method 'on_move' (a nil value)
At the time I was in a room with a bunch of materializers, so I think the error came from them. I changed it to:

Code: Select all

if (arch.on_move) then arch:on_move(id, true) end
and it doesn't seem to be causing any problems, but to be honest I really haven't dug enough around in the AI code to understand it.

And, there's a couple of descrepencies in the documentation in the 'Exvar' sticky thread- 'opby_party_carry' isn't a string (or table of strings), it's a boolean that uses 'opby' to determine which arches operate the trigger. Also, 'shoots' says if it isn't set, the shooter will use whatever's on the square - it actually uses what's "inside" the shooter (though I guess this was written for those using dungeon_translate to fix these kinds of things).

Also, dsb_export doesn't seem to work with tables. I really don't know if this is an error or just how it works, but I think that maybe this should be in the documentation. Unless I did something wrong, which is a definite possibility.

Oh, yeah, I was also wondering if it were possible to control the volume of a sound, other than lowering the volume of the sound itself (I mean, other than recreating the sound file itself at a lower volume). Normally, volume should be dictated by distance and dsb_sound_3d handles that just fine, but in this case, I'm using background sound with no origin, and it's currently not so much in the background.

And, can I just take a moment to say Sophia is amazing? Honestly, if I had to deal with someone like me reporting errors every other day, I'd probably have told myself to go away.
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: An 'on_move' error and some other random things...

Post by Sophia »

Remy wrote:At the time I was in a room with a bunch of materializers, so I think the error came from them.
It did. Most monsters have an on_move, but materializers don't. Fixed now. Also, if you're fixing this for yourself, you'll have to change a few more lines; there are more instances where it tries to call on_move without checking.
Remy wrote:'opby_party_carry' isn't a string (or table of strings), it's a boolean that uses 'opby' to determine which arches operate the trigger.
Hehe, this one is a bug in the code, not the documentation. :) I think opby_party_carry should be independent from opby, because if they're not, any trigger that's operated by the party carrying something over it can also be operated by dropping that same something on it-- and sometimes that's not so good. Still, to make it behave just in case someone wanted this behavior, I've rewritten the code like this:

Code: Select all

		if (exvar[id].opby_party_carry) then
			local optable = exvar[id].opby_party_carry
			if (optable == true) then optable = exvar[id].opby end
			
			if (type(optable) == "table") then
				for i in pairs(optable) do
					local opby = optable[i]
					local res = dsb_party_scanfor(opby)
					if (res == true) then return true end
				end
			else
				if (dsb_party_scanfor(optable)) then
					return true
				else 
					return false
				end
			end
		end
Remy wrote:Also, 'shoots' says if it isn't set, the shooter will use whatever's on the square - it actually uses what's "inside" the shooter
This one's just a mistake. I'll fix the documentation.
Remy wrote:dsb_export doesn't seem to work with tables.
It works with some tables. Basically, anything that's essentially an array, just { 1, "two", 3456 } etc., it will handle, but if you try to name elements: { one = 1, two = "two" } or the like, it won't save those.
EDIT: Changed for 0.28. It will now work with all tables.
Remy wrote:I was also wondering if it were possible to control the volume of a sound, other than lowering the volume of the sound itself (I mean, other than recreating the sound file itself at a lower volume).
Not currently. Since the system now keeps track of sound handles, it would not be too much trouble to add something.
Remy wrote:And, can I just take a moment to say Sophia is amazing? Honestly, if I had to deal with someone like me reporting errors every other day, I'd probably have told myself to go away.
Aww.... :D :oops:
Seriously, though, I appreciate the reports. It helps the program get better!
Last edited by Sophia on Thu Dec 06, 2007 11:02 pm, edited 1 time in total.
Remy
Craftsman
Posts: 111
Joined: Wed Sep 05, 2007 5:24 pm
Contact:

Post by Remy »

Also, if you're fixing this for yourself, you'll have to change a few more lines
Eh. I have to wait for the next version anyway, for other fixes, but I'll keep that in mind. :)
If this is a huge problem, I can see what can be done about it, but I really hate to rip this code up...
Considering it can handle arrays, I don't see why this would be a problem (I only discovered it 'cause I thought I'd be all clever and store all my globals in an indexed table -- it wasn't a big deal to change the "." seperator to a "_" - I just thought I'd mention in case someone else tried it).
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

I took another look at it and realized that it wasn't nearly as complicated as I was making it out to be.

It's now a non-issue. DSB 0.28 will be able to export arbitrary tables.
Post Reply