lua:scripting:examples:vodurbirthdayletters
This is an old revision of the document!
local lettervnum=31450 local bname="Vodur" local bcolor="{m" local qpreward=29 -- try to make word out of obj and all letters in cont -- return true if doesn't make word or return false -- and reward qp and destroy the letters function put_trigger( ch, cont ) local letters={} for i=1,#bname do letters[i]=bname:sub(i,i) end local items={ obj } for k,v in pairs(cont.contents) do if v.vnum==lettervnum then table.insert(items, v) end end local used={} for k,v in pairs(items) do local iletter=string.match(v.name, "letter (%a)") for i=#letters,1,-1 do if iletter==letters[i] then table.insert(used, v) table.remove(letters,i) break end end end if #letters<1 then sendtochar( ch, "The letters merge together to form the word "..bcolor..bname.."{x!".. "\n\rAfter an instant it vanishes completely.\n\r") ch:reward(ch, "qp", qpreward) for k,v in pairs(used) do v:destroy() end return false end return true end function make_letter(l) if not(l.vnum == lettervnum) then error("wtf") end local letters={} for i=1,#bname do letters[i]=bname:sub(i,i) end local letter=letters[randnum(1, #letters)] l.name="letter "..letter l.shortdescr="the letter "..bcolor..letter.."{x" l.description="It's a letter. Put it in a container with other letters and see what happens!" end
lua/scripting/examples/vodurbirthdayletters.1404758298.txt.gz · Last modified: 2014/07/07 18:38 by vodur