Place 300 random letters in luai:
loadscript("vodur", "birthday")
for i=1,300 do
make_letter(getrandomroom():oload(31450))
end
Area: [ 57] Aes Sedai Clan Area
Vnum: [31450]
Type: [treasure]
Level: [ 1]
Wear flags: [take]
Extra flags: [nolocate]
Material: [unknown]
Condition: [ 100]
Weight: [ 0]
Cost: [ 0]
OPs: [ 0/ 5]
Short desc: birthday quest letter
Long desc:
Birthday quest letter
Notes:
Used for birthday quest, progs will set the actual
name, desc, etc.
OBJPrograms for [31450]:
Number Vnum Trigger Phrase
------ ---- ------- ------
[ 0] 31450 put 100
-- birthday.lua
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