Problems with const weight

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

Problems with const weight

Post by Sophia »

Version 0.34 has some bugs in the Lua code that handles constant weight triggers.

If you find you're having problems, delete the messages_to_targets function found at the end of base/triggers.lua and replace it with this code:

Code: Select all

function messages_to_targets(id, opby, target, msg, delay, reverse)
	local i
	
	if (not opby) then opby = 0 end  		
	if (not delay) then delay = 0 end

	if (type(target) == "table") then
		for i in pairs(target) do
			local targ = target[i]
			local cmsg, cdelay, copby

			if (type(msg) == "table") then cmsg = msg[i]
			else cmsg = msg end
			
			if (type(delay) == "table") then cdelay = delay[i]
			else cdelay = delay end			

            if (type(opby) == "table") then copby = opby[i]
			else copby = opby end
			
			if (reverse) then
				local rmsg = reverse_msg(cmsg)
				if (rmsg) then
				    dsb_msg(cdelay, targ, rmsg, copby, id)
				end
			else
				dsb_msg(cdelay, targ, cmsg, copby, id)
			end
		end
	else
	    if (type(msg) == "table") then
			for i in pairs(msg) do
				local cmsg = msg[i]
				local cdelay, copby
				
				if (type(delay) == "table") then cdelay = delay[i]
				else cdelay = delay end

	            if (type(opby) == "table") then copby = opby[i]
				else copby = opby end

            	local rmsg = cmsg
				if (reverse) then rmsg = reverse_msg(cmsg) end
				dsb_msg(cdelay, target, cmsg, copby, id)
			end
		else
			local rmsg = msg
			if (reverse) then rmsg = reverse_msg(msg) end
			dsb_msg(delay, target, rmsg, opby, id)
		end
	end
end
This fix will be in DSB 0.35 of course.
Post Reply