↓ Skip to main content

MSDP.STRING_AFFECTS bug

·125 words·1 min

** problem fixed **

Here is mudlet code to parse MSDPAFFECTS correctly:

Alias:

if not checkSpell("regeneration") then send("cast 'regen'") end
if not checkSpell("darksight") then send("darksi") end
if not checkSpell("stone skin") then send("cast 'stone skin'") end
if not checkSpell("infravision") then send("cast 'infravision'") end
if not checkSpell("mobility") then send("cast 'mobility'") end -- Mobility
if not checkSpell("detect magic") then send("cast 'detect m'") end
if not checkSpell("detect invisibility") then send("cast 'detect i'") end

Function:

function get_affects() 
	stringAffects=atcp.MSDPAFFECTS
	stringAffects=string.gsub(stringAffects,string.char(3)..string.char(1),"")
	stringAffects=string.gsub(stringAffects,string.char(1),",")
	stringAffects=string.gsub(stringAffects,string.char(2),": ")
	stringAffects=string.gsub(stringAffects,string.char(3)," ")
	stringAffects=string.gsub(stringAffects,string.char(4),"")
	affectsTable=stringAffects:split(",")
	affects={}
	for i,v in ipairs(affectsTable) do
		if not (v:split(": ")[2]=="-1") then
			affects[v:split(": ")[1]]=v:split(": ")[2]+0
		end
	end
end
function checkSpell(spell)	
	if table.contains(affects,spell) then 
		return true
	else
		return false
	end
end

I told you string_affects is obsolete. MSDPAFFECTS is the newer one.

yeah, it works

Thanks