MSDP.STRING_AFFECTS bug

Report a bug you found.

MSDP.STRING_AFFECTS bug

Postby Tuck » Mon Jan 16, 2017 9:13 am

** problem fixed **
Here is mudlet code to parse MSDPAFFECTS correctly:
Alias:
Code: Select all
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:
Code: Select all
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
Last edited by Tuck on Mon Jan 16, 2017 2:55 pm, edited 2 times in total.
Tuck
Triple 40 Poster
 
Posts: 323
Joined: Mon Jun 22, 2009 12:06 pm
Location: Planet Earth
Status: Offline

Re: MSDP.STRING_AFFECTS bug

Postby *juggleblood* » Mon Jan 16, 2017 10:55 am

I told you string_affects is obsolete. MSDPAFFECTS is the newer one.
Talk to the clown.
User avatar
*juggleblood*
Hall of Fame Avatar Poster
 
Posts: 1304
Joined: Sun Jan 22, 2006 6:36 am
Location: Beyond Yonder
Status: Offline

Re: MSDP.STRING_AFFECTS bug

Postby Tuck » Mon Jan 16, 2017 11:15 am

yeah, it works

Thanks
Tuck
Triple 40 Poster
 
Posts: 323
Joined: Mon Jun 22, 2009 12:06 pm
Location: Planet Earth
Status: Offline


Return to Bug Reporting

Who is online

Users browsing this forum: No registered users and 3 guests

cron